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.
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:
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: