views:

284

answers:

3

I have been looking for a fully functional WSDL client generator for ruby. I tried the one called wsdl2ruby and it didn't work. I think it has problems with detecting complex types correctly.

Can someone point me to the right library if there is one? I am specifically looking to generate a full functional client for SOAP API provided by jira. I looked into jira4r but it seems to be dead now and not up to date.

Any help is much appreciated.

Thank you.

A: 

You need to use a combination of Soap4R and the wsdl2rb tool generate the client. Checkout this blog post for details on doing this with JIRA. The article is a little dated and I don't think you'll actually have as many problems as the author did.

Mike Buckbee
+1  A: 

From personal experience I would strongly recommend using handsoap for web service clients in Ruby rather than soap4r.

http://github.com/unwire/handsoap

soap4r is an early-days ruby library, hasn't been updated for a long time, is buggy (from my own experiences with for example generating clients from WSDL) and isn't a particularly idiomatic ruby API.

handsoap is active, uses curb and nokogiri and was a delight to discover after my soap4r disappointments. Using it in production happily for some time now.

+1  A: 

Have you tried Savon? I've used a couple of times, it's super easy and fast.

  client = Savon::Client.new "http://example.com/UserService?wsdl"
  client.wsdl.soap_actions
  => [:get_all_users, :get_user_by_id, :user_magic]
  response = client.get_user_by_id { |soap| soap.body = { :id => 666 } }

http://github.com/rubiii/savon

Luke