views:

346

answers:

2

Untill now I used soap4r as my SOAP-client with Ruby 1.8.x, but now I am moving on to Ruby 1.9.x. Unfortunately soap4r doesn't work with Ruby 1.9.x I just get the "invalid multibyte escape" which seems not solvable, mostly because the soap4r gem wasn't updated since 2007, so I assume the project is dead.

I had a look at handsoap but there I have to map all the stuff by hand it will take several days to do that by hand, it is a big API.

Is there some other soap client which automaticly maps all the soap-xml stuff to ruby-objects (link soap4r did) and vise versa?

+1  A: 

If that is the issue with handsoap then you can use the hashie gem with handsoap. Hashie converts the xml elements to instance method calls, if that helps.

Soap4R is a pain but I like it for one reason, that is the standalone soap server that it provides. It makes testing external soap services so much easier by building your own soap server in a snap that just mocks the response so that, one you don't have to make request to external soap server for integration tests and second it doesn't leaves the code related with soap client untested.

nas
+2  A: 

Savon abstracts the XML part into a Ruby Hash. Have a look: http://github.com/rubiii/savon

rubiii
I never understood that, but now I see how it works. Anywas there is still one problem, it looses all XML attributes like <tag attr="lang">my content</tag>. But I can take the XML and parse it with XmlSimple.xml_in(response.to_xml, { 'ForceArray' => false }). Thanks for pointing me in the right direction!
Jeena