Could anyone can tell me how to invoke the remote web service in rails?

In J2EE development, there are a lot of tools helping us to generate stubs using wsdl file. But in rails, it seems to me there is not the tool like that. So i have a problem:

Does rails only need web service location to invoke web service? Do we need to configure somthing? For example: Api definition.

Help me. Thanks.

Hi Ken,

Take a look at soap4r or the rails ActionWebService (Peak Obsession). If it's doclit, soap4r and rails still don't support that very well. If you're trying to hit a complex doclit soap service and soap4r doesn't help, try this:

http://skwp.wordpress.com/2006/08/23/consuming-document-literal-soap-webservices-with-ruby-and-roxml

In J2EE development, there are a lot of tools helping us to generate stubs using wsdl file. But in rails, it seems to me there is not the tool like that. So i have a problem:

Does rails only need web service location to invoke web service? Do we need to configure somthing?

To invoke a remote web service from a Rails app, I use soap4r with wsdl2ruby to generate the client. Something like:

    > ruby wsdl2ruby.rb --wsdl 'path or url to WSDL' --type client

That should generate 3 files like:

    Client.rb     default.rb     defaultDriver.rb

I like to rename them to be more descriptive than 'default' like:

    NameOfService.rb     NameOfServiceDriver.rb

Then, either copy those files to app's lib directory and symlink from the app's model directory like:

    name_of_service.rb -> ../../lib/NameOfServiceDriver.rb

Or, create a new model file that requires the driver and exposes appropriate methods.