How do I pass objects to RPC style web services when working with soap4r at runtime?
I am creating a proxy for a soap web service at runtime using soap4r.
proxy = SOAP::WSDLDriverFactory.new("http://www.example.com/endpoint?wsdl").create_rpc_driver
开发者_Python百科How do I execute a rpc with a object parameter?
I found the answer to my question. Let's say I have an RPC style web service with the following signature:
result SaveProduct(Product product)
I can execute that with soap4r:
proxy = SOAP::WSDLDriverFactory.new("http://www.example.com/endpoint?wsdl").create_rpc_driver
proxy.SaveProduct(:Product => {:name => 'product one', :cost => '12.50'})
Having spent some time with soap4r, I would recommend using wsdl2ruby.rb to generate the proxy objects if possible.
精彩评论