Please read for an updated status on RailsCasts:
Learn more or hide this
Nice to see this as a screencast.
We once wrote a small app that consume complex types objects using Savon.
Please see https://github.com/spritle/awssoap4r
We wrote a small blog as well http://www.spritle.com/blogs/2011/09/28/consume-soap-webservices-using-ruby-with-savon/
Thought this might help your followers/readers
Balaji, Spritle Software
Good cast for me.
What about errors handling raised by Savon?
Only by request.succes? ?
there are 3 types of errors, one from the SOAP service it self, one from savon and one from the communications gem ( timeout error or no response) for the first one the web service should be able to notify of the error somehow (return a status tag) so you can handle that without the need of a begin rescue block the other cases are handled with with beging rescue.
Awesome as alway.
Ryan i will take this opportunity to motivate a topic that i think you have work with and i did have to solve when dealing with savon. The web service i comunicate with takes a couple of second to respond ( the rails app waits and does not answer to user request), so i took an approach i saw you using in episode 243, i used beanstalk and stalker, but then came the problem of updating the view instantly without the need to refresh the page when stalker/beanstalk finish.
Apparently i was the only one who didnt know how it was done but i still could not find a good example. Then in episode 281 i saw you were using faye with stalker.
I did figure out how to update the view with faye from stalker, but, could you touch this topic in a future episode? i think is a very common problem and there is not much documentation out there about how to update the view asynchronously after a background process finishes working.
Thanks for the suggestion. Pushing API requests into a background process is a good thing and would make a good episode. Good idea.
Oh, one other thing, it is also posible and very easy to read the values with nokogiri using a css selector.
doc = Nokogiri::XML(response.to_xml)
zipcode = doc.css("USzip").inner_text
I find it most useful when dealing with collections
doc.css('ProductCode').each do |product|
since Savon v0.9.7, the response object comes with a #doc method which returns a (memoized) Nokogiri object:
zipcode = response.doc.css("USzip").inner_text
Ill use it in my next project which starts tomorrow. Thanks for sharing.
Savon means soap in French in case you want to know.
Exactly and Ryan's pronunciation is ... ahem ... pas tr
I used it in our project. Cool library!!!
Btw, take a look on em-net-http (https://github.com/jfairbairn/em-net-http). Sometimes SOAP server might respond slowly. I used this library with Savon to improve performance and I reached it.
Can you give any example, how to use em-net-http with Savon?
While on SOAP and webservice, the rails app that I work on is expected to expose couple of methods as SOAP Webservice. I know Ruby has ditched SOAP in favor of REST, but I really dont have an option as the client app expect it. Is there any gems out there that support creation of a SOAP web service on Rails 3.x?
As far as i know, Soap4r and ActionWebService are the only SOAP server libraries.
Unfortunately both of those aren't actively maintained, I doubt that either works on Ruby 1.9 (if you search you may find a fork of one or the other that could do the job).
Doing it yourself completely isn't as hard as you may think though. Today I finished up an article on my blog on this topic, the example service I present in it is written using Sinatra (and not Rails).
I'm working on building an example of the same SOAP service inside of a Rails app: https://github.com/mkremer/echo_service_rails. I'll expect this example to be finished somewhere in the coming days
I just finished the Rails implementation of the EchoService, hopefully it will be of use to someone :)
And also there is SimpleWS lib: https://github.com/mikisvaz/simplews
Which is actually a wrap around Soap4r but much easier to get started.
We used this to communicate with Yodlee API. Worked wonderfully!
I'm seeing some pretty serious redraw bugs with SoapUI (Mac 10.7.2, latest java update). Are there any other similar tools?
There is SOAPClient. It's very simple - not a near SoapUI in terms of features.
But it might be a plus for simple queries and testing. Was a god bless for me for some time. But as you go deeper there is no alternative SoapUI which is really a pain to use on Mac.
It was very useful, but a review is needed, Savon has changed a lot in version 2, and it's very important working with delayed jobs...
Ryan, as always great video.
But, I am having trouble with credentials need to get in to a secure Soap api. Also, now there is a new version of Savon. I was wondering if you can do a revised tutorial which will include using an action that requires login, if possible.
First sign in through GitHub to post a comment.