Question

I have a need to have SOAP web service on my rails app. (this is for a Quickbooks integration and QB web connector expects you to have web services on your end :(

I tried dnordberg's actionwebservice gem (gem 'actionwebservice', :git => "git://github.com/dnordberg/actionwebservice.git") which is Rails 3 port of the original data-noise/actionwebserice gem.

Since i am a relative newby to RoR (not to programming though), I am not very sure what other missing steps are. I have added the above actionwebservice gem and SOAP4R (github.com/felipec/soap4r.git)

Gemfile

gem 'soap4r', :git => 'git://github.com/felipec/soap4r.git'
gem 'actionwebservice', :git => 'https://github.com/dnordberg/actionwebservice.git'

and followed the instruction here: http://www.ibm.com/developerworks/opensource/library/os-ws-rubyrails/index.html.

But I just cant get the Web Service to work. I keep getting route error. (apparently rails hasn't recognised it as a WS yet, and hence looking for appropriate controller routes?).

No route matches [GET] "/hello_message/wsdl"

for http://localhost:3000/hello_message/wsdl

Can anyone provide a quick run down on the steps needed on rails 3.x ? Thanks!

ps: rails g web_service doesn't work either

Was it helpful?

Solution

I have been working on a fork of ActionWebService and have fixed this issue for Rails 3.1.x, as well as some of the scaffolding issues. You can find my fork at http://github.com/livestation/actionwebservice

Keep an eye on it as I will be adding more fixes over the next week or so (such as the "Cannot map SOAP::Mapping::SOAPException to SOAP/OM." error you get when using the scaffold when an exception in the code is generated.)

One current caveat is that you need to add a log_error(message) function to your controller that you've assigned as an webservice controller because I haven't added this into the gem yet.

Don't forget to add the acts_as_web_service call into your controller to hook it all together, because that wasn't mentioned in the original docs.

[edit] forgot to mention i am using this version of SOAP4r https://github.com/spox/soap4r-spox

Look forward to your comments

OTHER TIPS

Have you tried adding a new route to routes.rb?

match "/hello_message/wsdl" => "hello_message#wsdl"

Rails3 is stricter about having all routes defined

http://guides.rubyonrails.org/routing.html

I needed to add the following to my routes.rb:

  get "hello_message/wsdl"
  post "hello_message/api"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top