Forum: Ruby help with a simple SOAP WSDL client?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eea3feaacbe44706164289d068d94828?d=identicon&s=25 unknown (Guest)
on 2006-03-17 20:24
(Received via mailing list)
Hi,

I'm trying to write a little SOAP WSDL client to get a currency
conversion rate. I have tried what is listed below but I get the error
below. I don't know what I'm doing but I've been trying to follow the
pickaxe book on page 252. Any suggestions to get this working?

Thanks,
Peter



## RUBY SCRIPT

require 'soap/wsdlDriver'
require 'cgi'

WSDL_URL = "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL"

soap = SOAP::WSDLDriverFactory.new(WSDL_URL).createDriver

result = soap.ConversionRate("USD", "CAD")

puts result




## ERROR

Unknown element {http://schemas.xmlsoap.org/wsdl/http/}binding.
Unknown element {http://schemas.xmlsoap.org/wsdl/http/}operation.
Unknown element {http://schemas.xmlsoap.org/wsdl/http/}urlEncoded.
Unknown element {http://schemas.xmlsoap.org/wsdl/mime/}mimeXml.
Unknown element {http://schemas.xmlsoap.org/wsdl/http/}binding.
Unknown element {http://schemas.xmlsoap.org/wsdl/http/}operation.
Unknown element {http://schemas.xmlsoap.org/wsdl/mime/}content.
Unknown element {http://schemas.xmlsoap.org/wsdl/mime/}mimeXml.
Unknown element {http://schemas.xmlsoap.org/wsdl/http/}address.
Unknown element {http://schemas.xmlsoap.org/wsdl/http/}address.
soap_currency_conversion.rb:8: undefined method `ConversionRate' for
#<SOAP::WSDLDriver:0x13202b4> (NoMethodError)
Eea3feaacbe44706164289d068d94828?d=identicon&s=25 unknown (Guest)
on 2006-03-22 07:08
(Received via mailing list)
anyone?
B2413530781793f1069936f3b13d2c49?d=identicon&s=25 Emil Marceta (emil)
on 2006-03-23 06:48
unknown wrote:
> anyone?

Here is the example. The service is doc literal
and for those services pass the arguments as a
hash.

------------------------------

require 'soap/wsdlDriver'

WSDL_URL = "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL"

soap = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver
# soap.wiredump_dev = STDOUT
result = soap.ConversionRate(:FromCurrency => "USD", :ToCurrency =>
"CAD")

puts result.conversionRateResult
--------------------------------

The messages :
ignored element: {http://schemas.xmlsoap.org/wsdl/http/}binding
ignored element: {http://schemas.xmlsoap.org/wsdl/http/}operation
ignored element: {http://schemas.xmlsoap.org/wsdl/http/}urlEncoded
ignored element: {http://schemas.xmlsoap.org/wsdl/mime/}mimeXml
ignored element: {http://schemas.xmlsoap.org/wsdl/mime/}content
ignored element: {http://schemas.xmlsoap.org/wsdl/http/}address

are for unsupported bindings in soap4r. .NET services often include
bindings for as urlEncoded, http GET and http POST in addition to
SOAP.

cheers,
emil
Eea3feaacbe44706164289d068d94828?d=identicon&s=25 unknown (Guest)
on 2006-03-24 18:14
(Received via mailing list)
Hi Emil,

Thanks for the respone. I've tried what you posted and it didn't work.
Did you test this? I got the following error

Unknown element {http://schemas.xmlsoap.org/wsdl/http/}binding.
Unknown element {http://schemas.xmlsoap.org/wsdl/http/}operation.
Unknown element {http://schemas.xmlsoap.org/wsdl/http/}urlEncoded.
Unknown element {http://schemas.xmlsoap.org/wsdl/mime/}mimeXml.
Unknown element {http://schemas.xmlsoap.org/wsdl/http/}binding.
Unknown element {http://schemas.xmlsoap.org/wsdl/http/}operation.
Unknown element {http://schemas.xmlsoap.org/wsdl/mime/}content.
Unknown element {http://schemas.xmlsoap.org/wsdl/mime/}mimeXml.
Unknown element {http://schemas.xmlsoap.org/wsdl/http/}address.
Unknown element {http://schemas.xmlsoap.org/wsdl/http/}address.
conversionWS2.rb:5: undefined method `create_rpc_driver' for
#<SOAP::WSDLDriverFactory:> (NoMethodError)


I have also tried another suggestion that almost works. It always
returns a conversion rate of zero. But it is nice because it doesn't
use WSDL.

require 'soap/rpc/driver'

service =
SOAP::RPC::Driver.new("http://www.webservicex.net/CurrencyConvertor.asmx"...)
service.default_encodingstyle =
SOAP::EncodingStyle::ASPDotNetHandler::Namespace
service.add_method_with_soapaction("ConversionRate",
"http://www.webserviceX.NET/ConversionRate", "FromCurrency",
"ToCurrency")
service.wiredump_dev = STDERR
puts service.ConversionRate("USD","CAD")


Any other ideas?

Thanks,
Peter
Eea3feaacbe44706164289d068d94828?d=identicon&s=25 unknown (Guest)
on 2006-03-25 00:18
(Received via mailing list)
Resolved.

I upgraded to Ruby 1.8.4 and now my example code works.

- Peter
65c6722246f3eba675e41ebfbc5619fa?d=identicon&s=25 Craig T. (craig_t)
on 2010-11-04 16:53
Emil Marceta wrote in post #51768:
> ... .NET services often include bindings for as urlEncoded, http GET and
> http POST in addition to SOAP.

Apologies for bumping a ridiculously old thread, but it's exactly on the
topic I'm looking for help with. I'm working with an application that
runs a web service using POST bindings. It's been my experience that,
even four years later, when people say "web service" they still
basically mean SOAP.

I'm wondering, though, if there are Ruby now has any support for WSDL
1.1 POST and GET bindings?

http://www.w3.org/TR/wsdl#_http

A quick Google search seems like it's not there yet, but I wanted to
ask. I'm working with another developer using Ruby, and her job would
probably be a lot easier is she could just use wsdl2ruby or a similar
rather than have to write her own code for POST requests.

- Craig
C2c9a9a76a9e859e4bd00cfda181c660?d=identicon&s=25 Tony Arcieri (Guest)
on 2010-11-04 16:56
(Received via mailing list)
This might be what you're looking for:

https://github.com/rubiii/savon
This topic is locked and can not be replied to.