# Help with SOAP4R and a simple complex type

**URL:** <https://www.ruby-forum.com/t/help-with-soap4r-and-a-simple-complex-type/63509>\
**Category:** Ruby\
**Created:** [June 15, 2006, 7:28pm UTC](https://www.ruby-forum.com/t/help-with-soap4r-and-a-simple-complex-type/63509 "2006-06-15T19:28:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fxn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/77aa72/32.png) [@fxn](https://www.ruby-forum.com/u/fxn)\
**Post date:** [June 15, 2006, 7:28pm UTC](https://www.ruby-forum.com/t/help-with-soap4r-and-a-simple-complex-type/63509/1 "2006-06-15T19:28:36Z")

</div>

I am trying to do a remote call with SOAP4R (loading a WSDL), the  
signature has a parameter of this complex type

Passing a Ruby array of strings is not working. I am not 100% sure  
that parameter is the guilty, but I’d bet a dinner :-).

Should I do something special to build and pass an objetc for that  
complex type?

– fxn

---

<div class="post-metadata">

**Author:** ![fxn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/77aa72/32.png) [@fxn](https://www.ruby-forum.com/u/fxn)\
**Post date:** [June 15, 2006, 9:57pm UTC](https://www.ruby-forum.com/t/help-with-soap4r-and-a-simple-complex-type/63509/2 "2006-06-15T21:57:03Z")

</div>

On Jun 15, 2006, at 19:27, Xavier N. wrote:

> Passing a Ruby array of strings is not working. I am not 100% sure  
> that parameter is the guilty, but I’d bet a dinner :-).
> 
> Should I do something special to build and pass an objetc for that  
> complex type?

I reply to myself for the sake of the archives.

Thanks to a blog entry[\*] from someone who I own a beer, I learnt  
that you need to download the soap4r tarball. In the tarball there is  
a utility called wsdl2ruby.rb. I executed

ruby wsdl2ruby.rb --wsdl wsdl\_url --type client

and got a few Ruby files that represent the service and its metadata.  
In particular you get a driver named like the service:

require ‘defaultDriver’

# MyService is generated by wsdl2ruby.rb

serv = MyService.new

# ArrayOfstring is defined as child of Array by wsdl2ruby.rb

ros = ArrayOfstring.new  
ros \<\< “foo”

# my\_method receives an ArrayOfstring

result = serv.my\_method(ros)

It works like a charm!

– fxn

[\*] [http://thebogles.com/blog/2005/12/09/](http://thebogles.com/blog/2005/12/09/)
