# Help with a simple SOAP WSDL client?

**URL:** <https://www.ruby-forum.com/t/help-with-a-simple-soap-wsdl-client/83326>\
**Category:** Ruby\
**Created:** [March 17, 2006, 8:24pm UTC](https://www.ruby-forum.com/t/help-with-a-simple-soap-wsdl-client/83326 "2006-03-17T20:24:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 17, 2006, 8:24pm UTC](https://www.ruby-forum.com/t/help-with-a-simple-soap-wsdl-client/83326/1 "2006-03-17T20:24:19Z")

</div>

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](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/](http://schemas.xmlsoap.org/wsdl/http/)}binding.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/http/](http://schemas.xmlsoap.org/wsdl/http/)}operation.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/http/](http://schemas.xmlsoap.org/wsdl/http/)}urlEncoded.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/mime/](http://schemas.xmlsoap.org/wsdl/mime/)}mimeXml.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/http/](http://schemas.xmlsoap.org/wsdl/http/)}binding.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/http/](http://schemas.xmlsoap.org/wsdl/http/)}operation.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/mime/](http://schemas.xmlsoap.org/wsdl/mime/)}content.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/mime/](http://schemas.xmlsoap.org/wsdl/mime/)}mimeXml.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/http/](http://schemas.xmlsoap.org/wsdl/http/)}address.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/http/](http://schemas.xmlsoap.org/wsdl/http/)}address.  
soap\_currency\_conversion.rb:8: undefined method `ConversionRate’ for  
#SOAP::WSDLDriver:0x13202b4 (NoMethodError)

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 22, 2006, 7:08am UTC](https://www.ruby-forum.com/t/help-with-a-simple-soap-wsdl-client/83326/2 "2006-03-22T07:08:55Z")

</div>

anyone?

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 24, 2006, 6:14pm UTC](https://www.ruby-forum.com/t/help-with-a-simple-soap-wsdl-client/83326/3 "2006-03-24T18:14:01Z")

</div>

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/](http://schemas.xmlsoap.org/wsdl/http/)}binding.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/http/](http://schemas.xmlsoap.org/wsdl/http/)}operation.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/http/](http://schemas.xmlsoap.org/wsdl/http/)}urlEncoded.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/mime/](http://schemas.xmlsoap.org/wsdl/mime/)}mimeXml.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/http/](http://schemas.xmlsoap.org/wsdl/http/)}binding.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/http/](http://schemas.xmlsoap.org/wsdl/http/)}operation.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/mime/](http://schemas.xmlsoap.org/wsdl/mime/)}content.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/mime/](http://schemas.xmlsoap.org/wsdl/mime/)}mimeXml.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/http/](http://schemas.xmlsoap.org/wsdl/http/)}address.  
Unknown element {[http://schemas.xmlsoap.org/wsdl/http/](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","http://www.webserviceX.NET/](http://www.webservicex.net/CurrencyConvertor.asmx%22,%22http://www.webserviceX.NET/)”)  
service.default\_encodingstyle =  
SOAP::EncodingStyle::ASPDotNetHandler::Namespace  
service.add\_method\_with\_soapaction(“ConversionRate”,  
“[http://www.webserviceX.NET/ConversionRate](http://www.webserviceX.NET/ConversionRate)”, “FromCurrency”,  
“ToCurrency”)  
service.wiredump\_dev = STDERR  
puts service.ConversionRate(“USD”,“CAD”)

Any other ideas?

Thanks,  
Peter

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 23, 2006, 6:48am UTC](https://www.ruby-forum.com/t/help-with-a-simple-soap-wsdl-client/83326/4 "2006-03-23T06:48:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [November 4, 2010, 4:53pm UTC](https://www.ruby-forum.com/t/help-with-a-simple-soap-wsdl-client/83326/5 "2010-11-04T16:53:23Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 25, 2006, 12:18am UTC](https://www.ruby-forum.com/t/help-with-a-simple-soap-wsdl-client/83326/6 "2006-03-25T00:18:58Z")

</div>

Resolved.

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

- Peter

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [November 4, 2010, 4:56pm UTC](https://www.ruby-forum.com/t/help-with-a-simple-soap-wsdl-client/83326/7 "2010-11-04T16:56:30Z")

</div>

This might be what you’re looking for:

> **[GitHub - rubiii/savon: Moved to savonrb/savon](https://github.com/rubiii/savon)**
>
> Moved to savonrb/savon. Contribute to rubiii/savon development by creating an account on GitHub.
