Using this type of code:
service =
SOAP::RPC::Driver.new("http://www.ioperate.net/ws/order/orderws.asmx","http://chrome52/webservices/")
service.default_encodingstyle =
SOAP::EncodingStyle::ASPDotNetHandler::Namespace
service.wiredump_dev = STDERR
service.add_method_with_soapaction(
"OrderUpload",
"http://chrome52/webservices/OrderUpload",
"VendorCode",
"VendorAccessKey",
"Batch"
)
service.wiredump_dev = STDERR
service.OrderUpload(VENDOR_CODE, VENDOR_ACCESS_KEY,nil)
How would you do the add_method_with_soapaction calls for data that
needs to be in this format:
http://www.ioperate.net/ws/order/orderws.asmx
Also - I've got this in file form (using rxml to generate it) ... isn't
there just some simple method of posting a soap xml file to a server?
Here's how you do this.. god forbid this be documented anywhere - guess
that's the Ruby way...
For the search engines - this is the simplest way to post complex xml
formats to .net dotNet webservices using ruby
xml = (some xml string some like what's shown here
http://www.ioperate.net/ws/order/orderws.asmx?op=OrderUpload )
require 'net/http'
h = Net::HTTP.new('www.ioperate.net', 80)
#you just pretty much copy the header info seen on
http://www.ioperate.net/ws/order/orderws.asmx?op=OrderUpload )
headers = {
"Host" => "www.ioperate.net",
"Content-Type" => "text/xml; charset=utf-8",
"Content-Length" => xml.size.to_s,
"SOAPAction" => "http://chrome52/webservices/OrderUpload"
}
resp, data = h.post('/ws/order/orderws.asmx', xml, headers )
render :text => data
You could document it here:
http://rubymanual.org/class/Net%3A%3AHTTP#post
Actually I was going to do it for you, but I wasn't sure to what you
where referring when you said 'that' wasn't documented anywhere.
I see that aparently there's no documentation there, on how to set the
headers, however, I haven't ever used the HTTP class, so I haven't read
all the docu there is about it.
Is there anything else, that you're missing in the docu? You could of
course add the whole example as is as a comment?
require "soap/rpc/driver"
service =
SOAP::RPC::Driver.new(" http://www.ioperate.net/ws/inventory/inventoryws.asmx","http://chrome52/webservices/")
service.default_encodingstyle =
SOAP::EncodingStyle::ASPDotNetHandler::Namespace
service.add_method_with_soapaction("InventoryCountQuery",So - if VendorCode in the example above is a nested element (like <VendorCode><id/><name/><whatever/><?VendorCode> ) ... how do you that kind of thing?
"http://chrome52/webservices/InventoryCountQuery",
"VendorCode","VendorAccessKey","Sku")
service.wiredump_dev = STDERR
service.InventoryCountQuery(VENDOR_CODE, VENDOR_ACCESS_KEY,sku)
Hi,
Sorry for late reply.
ben wrote:
> I've got simple SOAP calls working but I can't seem to figure out how
> to do a soap call for complex/nested sets.
>
> Using this type of code:
> service =
>
> SOAP::RPC::Driver.new("http://www.ioperate.net/ws/order/orderws.asmx","http://chrome52/webservices/")
> service.default_encodingstyle =
> SOAP::EncodingStyle::ASPDotNetHandler::Namespace
> service.wiredump_dev = STDERR
> service.add_method_with_soapaction(
> "OrderUpload",
> "http://chrome52/webservices/OrderUpload",
> "VendorCode",
> "VendorAccessKey",
> "Batch"
> )
> service.wiredump_dev = STDERR
> service.OrderUpload(VENDOR_CODE, VENDOR_ACCESS_KEY,nil)
>
> How would you do the add_method_with_soapaction calls for data that
> needs to be in this format:
> http://www.ioperate.net/ws/order/orderws.asmx
Try to create client stub with wsdl2ruby.rb. You can get wsdl2ruby.rb
(if you don't have it) from
http://dev.ctor.org/soap4r/browser/trunk/bin/wsdl2ruby.rb?format=txt
Run wsdl2ruby.rb against http://www.ioperate.net/ws/order/orderws.asmx?WSDL
% wsdl2ruby.rb --wsdl
"http://www.ioperate.net/ws/order/orderws.asmx?WSDL" --type client --force
You'll get default.rb, defaultDriver.rb and OrderWsClient.rb. See
OrderWsClient.rb how to call the method.
Regards,
// NaHi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
iQEVAwUBRRaG6R9L2jg5EEGlAQKbhgf/T91OGvqJ+iRuGKDxHGcFOxZgGzNnZ1ka
tDh5wCsm0TwP/Ybs8lp+fRv0qQQtoIGljAVA1B7kq3HTHQP7XzChYIyufTxHcDbC
2FWvjtJaSr+hdMwWAkRU8tO5D6bdRS3juNl+bZbYModQVWE9KqMnT0BYxGdR3RBo
/1KsdFcpfdZ6ZFnc8cp5DiqJvhejA8d6MtETp5CfKm9mU69Aqlxv9nLSwhYkyFrT
Wan0vyCFzRcmiD8Vvy0hWZtkDViXuKc10pE6ecDxC6tsuZQA94MWZl3fq/z5Xp8H
vm5iRuqNeTII1kGCUJkCJN/LwrAGJlMEV7e8ueoHSrBTSsWgUW7TeQ==
=ni5w
-----END PGP SIGNATURE-----