[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

help with a simple SOAP WSDL client?

Peter Michaux

3/17/2006 7:19:00 PM

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

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

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

puts result




## ERROR

Unknown element {http://schemas.xmlsoap.org/...}binding.
Unknown element {http://schemas.xmlsoap.org/...}operation.
Unknown element {http://schemas.xmlsoap.org/...}urlEncoded.
Unknown element {http://schemas.xmlsoap.org/...}mimeXml.
Unknown element {http://schemas.xmlsoap.org/...}binding.
Unknown element {http://schemas.xmlsoap.org/...}operation.
Unknown element {http://schemas.xmlsoap.org/...}content.
Unknown element {http://schemas.xmlsoap.org/...}mimeXml.
Unknown element {http://schemas.xmlsoap.org/...}address.
Unknown element {http://schemas.xmlsoap.org/...}address.
soap_currency_conversion.rb:8: undefined method `ConversionRate' for
#<SOAP::WSDLDriver:0x13202b4> (NoMethodError)

4 Answers

Peter Michaux

3/22/2006 6:06:00 AM

0

anyone?


petermichaux@gmail.com wrote:
> 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?...
>
> soap = SOAP::WSDLDriverFactory.new(WSDL_URL).createDriver
>
> result = soap.ConversionRate("USD", "CAD")
>
> puts result
>
>
>
>
> ## ERROR
>
> Unknown element {http://schemas.xmlsoap.org/...}binding.
> Unknown element {http://schemas.xmlsoap.org/...}operation.
> Unknown element {http://schemas.xmlsoap.org/...}urlEncoded.
> Unknown element {http://schemas.xmlsoap.org/...}mimeXml.
> Unknown element {http://schemas.xmlsoap.org/...}binding.
> Unknown element {http://schemas.xmlsoap.org/...}operation.
> Unknown element {http://schemas.xmlsoap.org/...}content.
> Unknown element {http://schemas.xmlsoap.org/...}mimeXml.
> Unknown element {http://schemas.xmlsoap.org/...}address.
> Unknown element {http://schemas.xmlsoap.org/...}address.
> soap_currency_conversion.rb:8: undefined method `ConversionRate' for
> #<SOAP::WSDLDriver:0x13202b4> (NoMethodError)

Emil Marceta

3/23/2006 5:49:00 AM

0

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

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/...}binding
ignored element: {http://schemas.xmlsoap.org/...}operation
ignored element: {http://schemas.xmlsoap.org/...}urlEncoded
ignored element: {http://schemas.xmlsoap.org/...}mimeXml
ignored element: {http://schemas.xmlsoap.org/...}content
ignored element: {http://schemas.xmlsoap.org/...}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





--
Posted via http://www.ruby-....


Peter Michaux

3/24/2006 5:13:00 PM

0

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/...}binding.
Unknown element {http://schemas.xmlsoap.org/...}operation.
Unknown element {http://schemas.xmlsoap.org/...}urlEncoded.
Unknown element {http://schemas.xmlsoap.org/...}mimeXml.
Unknown element {http://schemas.xmlsoap.org/...}binding.
Unknown element {http://schemas.xmlsoap.org/...}operation.
Unknown element {http://schemas.xmlsoap.org/...}content.
Unknown element {http://schemas.xmlsoap.org/...}mimeXml.
Unknown element {http://schemas.xmlsoap.org/...}address.
Unknown element {http://schemas.xmlsoap.org/...}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","http://www.webserviceX....)
service.default_encodingstyle =
SOAP::EncodingStyle::ASPDotNetHandler::Namespace
service.add_method_with_soapaction("ConversionRate",
"http://www.webserviceX.NET/Conversion..., "FromCurrency",
"ToCurrency")
service.wiredump_dev = STDERR
puts service.ConversionRate("USD","CAD")


Any other ideas?

Thanks,
Peter

Peter Michaux

3/24/2006 11:15:00 PM

0

Resolved.

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

- Peter