Saturday, August 18, 2007

Using .Net SOAP Services with wsdl2ruby

Easist way to use SOAP service in pure ruby is with wsdl2ruby. Simplest code would be to:


require 'soap/wsdlDriver'
wsdl = 'http://www.dotnetsite.com/MyService/Service.asmx?WSDL
driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
puts driver.GetVals(:parameter => SOAP::SOAPInt.new(136))


Where GetVals is .Net web method to call. Generating stub files with wsdl2ruby.rb against a WSDL could what arguments you should pass.


% wsdl2ruby.rb --wsdl Foo.wsdl --type client --force


I would like to thank Hiroshi NAKAMURA for this last information

1 comment:

Unknown said...

Hi;
What if the web service (i.e. SharePoint web service) needs NTLM authentication. Do you know a way to authenticate before generating driver ?

Thanks