# Error using soap/wsdlDriver

**URL:** <https://rubytalk.org/t/error-using-soap-wsdldriver/20871>\
**Category:** ruby-talk\
**Created:** [15 September 2005 19:26 UTC](https://rubytalk.org/t/error-using-soap-wsdldriver/20871 "2005-09-15T19:26:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Hulse](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@Matt\_Hulse](https://rubytalk.org/u/Matt_Hulse)\
**Post date:** [15 September 2005 19:26 UTC](https://rubytalk.org/t/error-using-soap-wsdldriver/20871/1 "2005-09-15T19:26:34Z")

</div>

I am attempting to use ruby to connect to a webservice. I am able to  
create a driver which contains all of the correct methods but when I  
attempt to call a method I get the following error:

NoMethodError: undefined method `headerparts' for nil:NilClass  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from c:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:355:in  
`header\_from\_obj'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from c:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:272:in  
`document\_send'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from c:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:449:in  
`helloWorld'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from c:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:448:in  
`helloWorld'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):8

I'm using the document at  
[http://www.testing.com/writings/behind-the-screens.pdf](http://www.testing.com/writings/behind-the-screens.pdf) as a guide for  
using ruby to connect to a webservice.

The method is a simple helloWorld. I am inexperienced with both ruby  
and webservices but it seems like I'm doing this correctly.

Any ideas? Is this user error or a bug in that library?

Thanks,

Matt

---

<div class="post-metadata">

**Author:** ![NAKAMURA\_Hiroshi4](https://avatars.discourse-cdn.com/v4/letter/n/3ab097/32.png) [@NAKAMURA\_Hiroshi4](https://rubytalk.org/u/NAKAMURA_Hiroshi4)\
**Post date:** [16 September 2005 08:46 UTC](https://rubytalk.org/t/error-using-soap-wsdldriver/20871/2 "2005-09-16T08:46:28Z")

</div>

Hi,

> I am attempting to use ruby to connect to a webservice. I am able to  
> create a driver which contains all of the correct methods but when I  
> attempt to call a method I get the following error:
> 
> NoMethodError: undefined method `headerparts' for nil:NilClass  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from c:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:355:in  
> `header\_from\_obj'  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from c:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:272:in  
> `document\_send'  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from c:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:449:in  
> `helloWorld'  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from c:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:448:in  
> `helloWorld'  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):8
> 
> I'm using the document at  
> [http://www.testing.com/writings/behind-the-screens.pdf](http://www.testing.com/writings/behind-the-screens.pdf) as a guide for  
> using ruby to connect to a webservice.

Would you please try to call WSDLDriverFactory#create\_rpc\_driver instead  
of WSDLDriverFactory#createDriver to create a driver? createDriver was  
deprecated. Sorry for the inconvenience.

If the problem still occurs, please tell me the WSDL you are using. It  
may be a bug of soap4r.

Regards,  
// NaHi

> **···**
>
> matt.hulse@gmail.com wrote:

---

<div class="post-metadata">

**Author:** ![Matt\_Hulse](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@Matt\_Hulse](https://rubytalk.org/u/Matt_Hulse)\
**Post date:** [16 September 2005 17:21 UTC](https://rubytalk.org/t/error-using-soap-wsdldriver/20871/3 "2005-09-16T17:21:35Z")

</div>

Thank you for the response.

Using create\_rpc\_driver worked and I am able to call helloWorld now but  
what I've noticed with the rpc\_driver is that the expected argument is  
always one even though the functions I'm calling either have no  
parameters or 8 parameters. How do you pass arguments to the methods  
while using an rpc driver since it will only accept one? Is there a  
good tutorial somewhere on how to use soap/WSDLDriver?

I appreciate your help.

Matt

---

<div class="post-metadata">

**Author:** ![NAKAMURA\_Hiroshi4](https://avatars.discourse-cdn.com/v4/letter/n/3ab097/32.png) [@NAKAMURA\_Hiroshi4](https://rubytalk.org/u/NAKAMURA_Hiroshi4)\
**Post date:** [16 September 2005 21:35 UTC](https://rubytalk.org/t/error-using-soap-wsdldriver/20871/4 "2005-09-16T21:35:15Z")

</div>

Hi,

> Thank you for the response.
> 
> Using create\_rpc\_driver worked and I am able to call helloWorld now but  
> what I've noticed with the rpc\_driver is that the expected argument is  
> always one even though the functions I'm calling either have no  
> parameters or 8 parameters. How do you pass arguments to the methods  
> while using an rpc driver since it will only accept one? Is there a  
> good tutorial somewhere on how to use soap/WSDLDriver?

I think you are accessing to document/literal service. You shoul pass a  
Hash to a method of document/literal service.

&nbsp;&nbsp;driver.hello\_world(:name =\> "NaHi", :age =\> 99)

And with a command line program wsdl2ruby.rb, you can generate stub  
files for accessing to the service. A sample client generated will help  
to understand how to create parameters. If you're using bundled library  
in ruby (without installing an independent package at  
[http://dev.ctor.org/download/\](http://dev.ctor.org/download/%5C)), get wsdl2ruby.rb from  
[http://dev.ctor.org/soap4r/browser/trunk/bin/wsdl2ruby.rb](http://dev.ctor.org/soap4r/browser/trunk/bin/wsdl2ruby.rb)

Regards,  
// NaHi

> **···**
>
> matt.hulse@gmail.com wrote:
