views:

171

answers:

2

Hi, I have a question about ruby and wsdl soap.

I couldn't find a way to get each method's params and their type.

For example, if I found out that a soap has a methods called "get_user_information" (using wsdlDriver) is there a way to know if this method requires some params and what type of params does it require (int, string, complex type, ecc..)?

I'd like to be able to build html forms from a remote wsdl for each method...

Sorry for my horrible English :D

A: 

Are you using soapr4?

Soap4r comes with a command line client to build proxies for accessing web services via SOAP. This is preferable to using the wsdlDriver which has to build the proxy dynamically every time it runs.

To build a "permanent" proxy then you need to run the following command

wsdl2ruby.rb --type client --wsdl http://some/path/to/the/wsdl

When this command runs then you should end up with a bunch of ruby files one of which (probably default.rb) will call each method in turn and document the necessary inputs and outputs.

Alternatively you may find the Wsdl Analyser useful. This will allow you to enter the URL for a WSDL which it will then analyse and list all of the operations and (sometimes) the paramaters required

Steve Weet
A: 

Thank you for the very quick response!

I'll try to explain myself a little better :D

I've tried soap4r, and I'm able to get soap's methods with something like this:

require "soap/wsdlDriver"
client = SOAP::WSDLDriverFactory.new(my-wsdl-url).create_rpc_driver
puts client.singleton_methods

What I'd like to know is: If, for example, my soap has a method called "get_some_params_and_sum_them", is there a way to know how many params it takes and which type they should be?

Something like

puts client.method("get_some_params_and_sum_them").params

Wsdl Analyser does it, and I'd like to know if this is possible also in a ruby script without tons of code lines :D

marco sangiorgi