Ruby Talking to MBT SoapInput Node

This is a basic Ruby Script to engage with SoapInput Node running on localhost 7800 with MBT

require 'net/http'
require 'net/https'

# Create te http object
http = Net::HTTP.new('localhost', 7800)
http.use_ssl = false
path = '/acmeOrders/WADDR/ProcessOrders'

# Create the SOAP Envelope
data = <<-EOF
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<submitPORequest xmlns="http://www.acmeOrders.com/OrderService">
<partNo xmlns="">11</partNo>
<partQuantity xmlns="">0</partQuantity>
<personName xmlns="">
<firstName>Trevor</firstName><lastName>O Connell</lastName>
</personName>
<address xmlns="">
<street>DTM</street>
<city>DTM</city>
<zipCode>111</zipCode>
</address>
</submitPORequest>
</soap:Body>
</soap:Envelope>
EOF

# Post the request
resp, data = http.post(path, data)

# Output the results
puts 'Code = ' + resp.code
puts 'Message = ' + resp.message
resp.each { |key, val| puts key + ' = ' + val }
puts data

Expected results



Code = 200
Message = OK
connection = close
content-length = 366
content-type = text/xml;charset=utf-8
date = Sun, 29 Jan 2012 20:53:54 GMT
server = Apache-Coyote/1.1
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<NS1:submitPOResponse xmlns:NS1="http://www.acmeOrders.com/OrderService">
<orderStatus>AVAILABLE</orderStatus><or
derAmt>50</orderAmt><partNo>11</partNo><partQuantity>0</partQuantity>
</NS1:submitPOResponse>
</soapenv:Body>
</soapenv:Envelope>

Comments

Popular posts from this blog

ActiveMQ, easy to use open source message oriented middleware (MOM)

Basic Send Message to MQ with Java and IBM MQ JMS

MySQL Error Invalid Table or Database Name