# WebServices & WSDL

**URL:** <https://www.ruby-forum.com/t/webservices-wsdl/113457>\
**Category:** Ruby\
**Created:** [August 31, 2007, 10:02am UTC](https://www.ruby-forum.com/t/webservices-wsdl/113457 "2007-08-31T10:02:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sirtyman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@sirtyman](https://www.ruby-forum.com/u/sirtyman)\
**Post date:** [August 31, 2007, 10:02am UTC](https://www.ruby-forum.com/t/webservices-wsdl/113457/1 "2007-08-31T10:02:07Z")

</div>

Hi guys,

Here is a part of my code (part o my class):

```
  @soaps<<SOAP::WSDLDriverFactory.new("http://#{@Address}:#{@wsPort}/#{wsdl}").create_rpc_driver()

```

def method\_missing(m,\*args)  
@soaps.each do |soap|  
begin  
result = soap.send("#{m}",\*args)  
return result  
rescue NoMethodError  
end  
end  
raise NoMethodError  
puts m  
end

I invoke soap.send by passing #{m} (as a WS method name) and \*args are  
arguments of the method which are ruby primitives (int, float, string  
etc.)  
But the problem is that WebServices will change and instead of  
primitives their methods will get WSDL objects i.e. like that:

How to create such object in ruby. What library can I use?

Any help will be helful  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![sirtyman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@sirtyman](https://www.ruby-forum.com/u/sirtyman)\
**Post date:** [September 2, 2007, 9:49pm UTC](https://www.ruby-forum.com/t/webservices-wsdl/113457/2 "2007-09-02T21:49:59Z")

</div>

Have you tried wsdl2ruby script, this will create you a fully  
functioning  
ruby wsdl client ?

---

<div class="post-metadata">

**Author:** ![sirtyman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@sirtyman](https://www.ruby-forum.com/u/sirtyman)\
**Post date:** [September 3, 2007, 8:25am UTC](https://www.ruby-forum.com/t/webservices-wsdl/113457/3 "2007-09-03T08:25:35Z")

</div>

Lee I. wrote:

> Have you tried wsdl2ruby script, this will create you a fully  
> functioning  
> ruby wsdl client ?

No, I haven’t. But I found out about it. Ehm… We’ll see how it works.  
Thanks for answer.

---

<div class="post-metadata">

**Author:** ![sirtyman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@sirtyman](https://www.ruby-forum.com/u/sirtyman)\
**Post date:** [September 3, 2007, 11:53am UTC](https://www.ruby-forum.com/t/webservices-wsdl/113457/4 "2007-09-03T11:53:57Z")

</div>

Lee I. wrote:

> Have you tried wsdl2ruby script, this will create you a fully  
> functioning  
> ruby wsdl client ?

can you explain how to use it. Because I realized that wsdl2ruby.rb  
contains only class definition and there is no documentation for it.

---

<div class="post-metadata">

**Author:** ![sirtyman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@sirtyman](https://www.ruby-forum.com/u/sirtyman)\
**Post date:** [September 3, 2007, 7:21pm UTC](https://www.ruby-forum.com/t/webservices-wsdl/113457/5 "2007-09-03T19:21:23Z")

</div>

Hi,

On 9/3/07, Marcin T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Lee I. wrote:
> 
> > Have you tried wsdl2ruby script, this will create you a fully  
> > functioning  
> > ruby wsdl client ?
> 
> can you explain how to use it. Because I realized that wsdl2ruby.rb  
> contains only class definition and there is no documentation for it.

There should be a wsdl2ruby script, but AFAIK it’s not usually  
distributed.

This is what I do:

require ‘wsdl/soap/wsdl2ruby’

wsdl = WSDL:🧼:WSDL2Ruby.new  
wsdl.location = “wsdl/data/ps/ps.wsdl”  
wsdl.opt[‘force’] = true  
wsdl.opt[‘classdef’] = “wsdl/ps”  
wsdl.opt[‘module\_path’] = “PS”  
wsdl.opt[‘mapping\_registry’] ||= nil  
wsdl.opt[‘driver’] ||= nil  
wsdl.run

You can ask for more information in:  
[http://groups.google.com/group/soap4r](http://groups.google.com/group/soap4r)
