Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Ruby Syntax and SOAP Web Service
Jose Luis Cortes Escolano
6/14/2007 12:11:00 AM
I need a good tutorial to show how to create a RUBY
SOAP request when I have an example SOAP request file. The example in my
book is next to useless. Also, how can I see that SOAP xml is being sent
and the client response?
An example, I am attempting to call this service
(
http://www.webservicex.net/uszip.asmx?op=Ge...
).
What I need to know is which namespace to use for the request. Also, do I
need to add anything to specify the Envelope namespaces.
Thanks
P.S.
This is the example Soap request.
POST /uszip.asmx HTTP/1.1
Host: www.webservicex.net
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "
http://www.webserviceX.NET/GetInfoB...
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="
http://www.w3.org/2001/XMLSchema-inst...
xmlns:xsd="
http://www.w3.org/2001/XMLSc...
xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/...
<soap:Body>
<GetInfoByZIP xmlns="
http://www.webserviceX.NET...
<USZip>string</USZip>
</GetInfoByZIP>
</soap:Body>
</soap:Envelope>
2 Answers
bmunat@gmail.com
6/14/2007 3:08:00 AM
0
I never did find a decent tutorial on using SOAP in Ruby. However, I
did find bits and pieces in blogs and list archives. There's actually
quite a bit of information in the SOAP4r trac (the Ruby SOAP code *is*
SOAP4r):
http://dev.ctor....
The biggest "ah-hah" moment for me was figuring out that you don't
have generate a bunch of classes from WSDL in Ruby like in other
languages... you can, but Ruby is dynamic enough that you can just
create a driver instance from the WSDL and all the signatures in that
WSDL become available as method calls on the driver [1]. Similarly,
the SOAP response object is accessible as a nested hash of data or as
pseudo-method calls.
Hope this helps some!
Ben
[1] Here's how I created my driver:
soap_driver = SOAP::WSDLDriverFactory.new(RAILS_ROOT + '/config/
somewebservice.wsdl').create_rpc_driver
Then I can call every SOAP call listed in that wsdl just by calling
the name on the driver:
response = soap_driver.someWebService({ hash of params })
On Jun 13, 2:11 pm, David <m...@me.com> wrote:
> I need a good tutorial to show how to create a RUBY
> SOAP request when I have an example SOAP request file. The example in my
> book is next to useless. Also, how can I see that SOAP xml is being sent
> and the client response?
>
> An example, I am attempting to call this service
> (
http://www.webservicex.net/uszip.asmx?op=Ge...
).
>
> What I need to know is which namespace to use for the request. Also, do I
> need to add anything to specify the Envelope namespaces.
>
> Thanks
>
> P.S.
> This is the example Soap request.
>
> POST /uszip.asmx HTTP/1.1
> Host:www.webservicex.net
> Content-Type: text/xml; charset=utf-8
> Content-Length: length
> SOAPAction: "
http://www.webserviceX.NET/GetInfoB...
>
> <?xml version="1.0" encoding="utf-8"?>
> <soap:Envelope xmlns:xsi="
http://www.w3.org/2001/XMLSchema-inst...
> xmlns:xsd="
http://www.w3.org/2001/XMLSc...
> xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/...
> <soap:Body>
> <GetInfoByZIP xmlns="
http://www.webserviceX.NET...
> <USZip>string</USZip>
> </GetInfoByZIP>
> </soap:Body>
> </soap:Envelope>
Mario Ruiz
4/30/2009 3:52:00 PM
0
So in your example would be:
mH=Hash.new()
mH["USZip"]="92210"
response = soap_driver.someWebService(mH)
but this is not working....
Do you know why?
Thanks.
bmunat@gmail.com wrote:
> I never did find a decent tutorial on using SOAP in Ruby. However, I
> did find bits and pieces in blogs and list archives. There's actually
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Ruby Syntax and SOAP Web Service
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password