Ruby SOAP proxy classes

610 views Asked by At

I am working with a complicated SOAP service and I was wondering if there is a ruby tool that allows you to generate proxy classes with all the methods pre-generated.

NetBeans does a pretty good job of providing intellisence for classes and I'd love to work with SOAP from Ruby like I used to work with SOAP from Java/C#

2

There are 2 answers

0
chuck son On

No but give Savonrb a shot. http://www.savonrb.com.

0
Greg On

Soap4r looks like the only code that will autogenerate proxy classes.

Handsoap will generate stubs for your services but doesn't appear to generate proxy classes.

Savon, as far as I know, requires you to hand code everything. I hope they one day add a stub generator.

Soap4r usage to make proxy classes and service

console> gem install soap4r

console> wsdl2ruby.rb --wsdl yourWsdlFileOrAddress.wsdl --type client

Dot notation

If you don't want static classes (e.g. not using autocomplete or IDE error checking), but want to access your hashes using dot notation, you can use one of the methods presented in this question:

hash['key'] to hash.key in Ruby

This enables you to access a hash similarly to an object.

a = myHash[:someField] # the standard way
a = myHash.someField   # with hash to hash key function