hey everyone can any one help me writing web services.i need web
services in in my project. i know purpose of the web services but i
have no idea how to write the web services. i refer few site but none
of the sites gave a clear information. do i need any gems for web
services how do i get the xml output.

Thanks in advance

I responded to a similar request some time ago:







I think to deploy the server side of a RESTful web service, the built-in support in rails is pretty good. Support for building the client side (ie. consuming a web service) is still not great. You can try using activeResource which promises a similar model as activeRecord but with a web service instead of a database as the back end. Unfortunately, in my experience AResource (as of 3.0.9) falls short of delivering on this promise so I have been writing my models on top of HTTP/S.

I would love to hear back what other people are using to implementing a consumer of a RESTful web service.


Our implementation is pretty simple.
in routes.rb build a match route like so:
match '/data_import/input(.:format)' => 'import_data#xml_received'
create an imports controller
then you can create a method that will receive the xml
def receive_xml


then you can pass that data using a curl command
curl --user xxxx@xxxx:xxxx -i -X GET -H 'Content-Type: application/
xml' -H 'Accept: application/xml' -d '<ROW></ROW>'

because the file has a .xml extension rails will pick it up and parse
the xml.

This is a very simple way to do a web service although maybe not the
best performance.

We use soap4r for consuming simple web services, Handsoap for slightly more complex services, and for some truly evil IBM web services, we rolled a custom java command line app that we called from rails.