# Ruby SOAP WSDL client call not working?

**URL:** <https://www.ruby-forum.com/t/ruby-soap-wsdl-client-call-not-working/92371>\
**Category:** Ruby\
**Created:** [April 18, 2007, 7:47pm UTC](https://www.ruby-forum.com/t/ruby-soap-wsdl-client-call-not-working/92371 "2007-04-18T19:47:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moazam\_Raja](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/94ad74/32.png) [@Moazam\_Raja](https://www.ruby-forum.com/u/Moazam_Raja)\
**Post date:** [April 18, 2007, 7:47pm UTC](https://www.ruby-forum.com/t/ruby-soap-wsdl-client-call-not-working/92371/1 "2007-04-18T19:47:45Z")

</div>

Hi all, I am testing out SOAP/WSDL interaction between Ruby and a  
webservice written in Java. I am able to test the Java webservice via  
a Java client and get a proper response back, but for whatever reason  
when  
I use Ruby to call my webservice, I get a null SOAP Mapping Object  
returned back to me.

My Ruby code which is calling the webservice is as follows,

require ‘soap/wsdlDriver’  
wsdl =‘[http://localhost:8080/helloservice-war/HelloService?wsdl](http://localhost:8080/helloservice-war/HelloService?wsdl)’  
driver = SOAP::WSDLDriverFactory.new(wsdl).create\_rpc\_driver  
String myString = ‘pookieMon’  
puts “Your answer = %s” % driver.sayHello(myString)  
puts driver.sayHello(nil)

I’m trying two different ‘puts’ statements, just in case. I noticed by  
looking at my server logs that Ruby is not even passing an argument to  
the webservice and hence is not getting anything back either.

Here is what Ruby sends,

\<env:Envelope xmlns:env=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)”  
xmlns:xsd=“[http://www.w3.org/2001/XMLSchema](http://www.w3.org/2001/XMLSchema)”  
xmlns:xsi=“[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)”\>env:Header/env:Body\<n1:sayHello  
xmlns:n1=“[http://endpoint.helloservice/](http://endpoint.helloservice/)”\>  
\</n1:sayHello\>\</env:Body\>\</env:Envelope\>

Here is what my Java code sends (and is successful),

\<?xml version="1.0" encoding="UTF-8"?\>

\<S:Envelope xmlns:S=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)”\>  
\<S:Header/\>  
\<S:Body\>  
\<ns2:sayHello xmlns:ns2=“[http://endpoint.helloservice/](http://endpoint.helloservice/)”\>  
pookieMon  
\</ns2:sayHello\>  
\</S:Body\>  
\</S:Envelope\>

What’s going on here, am I just making a very obvious simple mistake  
here,  
or does the Ruby soap/wsdlDriver work differently? I’m a Ruby (and  
SOAP!)  
newbie.

Thanks.

-Moazam

---

<div class="post-metadata">

**Author:** ![Moazam\_Raja](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/94ad74/32.png) [@Moazam\_Raja](https://www.ruby-forum.com/u/Moazam_Raja)\
**Post date:** [April 19, 2007, 7:19am UTC](https://www.ruby-forum.com/t/ruby-soap-wsdl-client-call-not-working/92371/2 "2007-04-19T07:19:37Z")

</div>

I figured out my earlier problem, here is the solution to talking to  
my own Java webservice via WSDL,

* * *

# main.rb

# April 18, 2007

# 

require ‘soap/wsdlDriver’

wsdl =‘[http://localhost:8080/helloservice-war/HelloService?wsdl](http://localhost:8080/helloservice-war/HelloService?wsdl)’  
driver = SOAP::WSDLDriverFactory.new(wsdl).create\_rpc\_driver

## sayHelloResponse = driver.sayHello(:arg0 =\> ‘pookieMon’) puts sayHelloResponse.return

Earlier, the two main problems were,

1.) I was doing ‘sayHelloResponse = driver.sayHello(‘pookieMon’)’,  
but that kept sending a null to my webservice. I had to change this  
to ‘sayHelloResponse = driver.sayHello(:arg0 =\> ‘pookieMon’)’.

2.) I kept getting a SOAP Message Object returned as a result and had  
to use object.inspect to get the actual message. Turns out the  
returning XML returns the result String in a String  
format. The solution is to call the return method via Object.return.

Thanks.

-Moazam
