# SOAP wsdlDriver doesn't work without soap4r?

**URL:** <https://www.ruby-forum.com/t/soap-wsdldriver-doesnt-work-without-soap4r/157983>\
**Category:** Ruby\
**Created:** [January 17, 2009, 9:39am UTC](https://www.ruby-forum.com/t/soap-wsdldriver-doesnt-work-without-soap4r/157983 "2009-01-17T09:39:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henry\_Jen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f475e1/32.png) [@Henry\_Jen](https://www.ruby-forum.com/u/Henry_Jen)\
**Post date:** [January 17, 2009, 9:39am UTC](https://www.ruby-forum.com/t/soap-wsdldriver-doesnt-work-without-soap4r/157983/1 "2009-01-17T09:39:31Z")

</div>

Hi,

I am trying to access a SOAP web service implemented in Java(I  
believe), but there is a problem for xsd:string type argument, the  
result request message always be empty string if I don’t have ‘soap4r’  
(Inspired by this thread[1]).

Also, code generated with wsdl2ruby works well.

Would you please help to me understand why? I consider this is a bug  
unless there is an explanation.

Here is the request envelop without soap4r,

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

\<env:Envelope xmlns:xsd=“[http://www.w3.org/2001/XMLSchema](http://www.w3.org/2001/XMLSchema)”  
xmlns:env=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)”  
xmlns:xsi=“[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)”\>  
env:Body  
\<n1:login xmlns:n1=“urn:com.example.cwp.cwpidws/wsdl/cwpidws”  
env:encodingStyle=“[http://schemas.xmlsoap.org/soap/encoding/](http://schemas.xmlsoap.org/soap/encoding/)”\>  
\<String\_1 xsi:nil=“true”\>\</String\_1\>  
\<String\_2 xsi:nil=“true”\>\</String\_2\>  
\<arrayOfString\_3 n2:arrayType=“xsd:string[3]”  
xmlns:n2=“[http://schemas.xmlsoap.org/soap/encoding/](http://schemas.xmlsoap.org/soap/encoding/)”  
xsi:type=“n2:Array”\>  
EMAIL  
LASTNAME  
FIRSTNAME  
\</arrayOfString\_3\>  
\</n1:login\>  
\</env:Body\>  
\</env:Envelope\>

and here is the one with soap4r and works as expected,

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

\<env:Envelope xmlns:xsd=“[http://www.w3.org/2001/XMLSchema](http://www.w3.org/2001/XMLSchema)”  
xmlns:env=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)”  
xmlns:xsi=“[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)”\>  
env:Body  
\<n1:login xmlns:n1=“urn:com.example.cwp.cwpidws/wsdl/cwpidws”  
env:encodingStyle=“[http://schemas.xmlsoap.org/soap/encoding/](http://schemas.xmlsoap.org/soap/encoding/)”\>  
\<String\_1 xsi:type=“xsd:string”\>username\</String\_1\>  
\<String\_2 xsi:type=“xsd:string”\>password\</String\_2\>  
\<arrayOfString\_3 n2:arrayType=“xsd:string[3]”  
xmlns:n2=“[http://schemas.xmlsoap.org/soap/encoding/](http://schemas.xmlsoap.org/soap/encoding/)”  
xsi:type=“n2:Array”\>  
EMAIL  
LASTNAME  
FIRSTNAME  
\</arrayOfString\_3\>  
\</n1:login\>  
\</env:Body\>  
\</env:Envelope\>

The code is like following, only the wsdl URL and username/password  
are masked from original code.

#require ‘rubygems’  
#gem ‘soap4r’

require ‘soap/wsdlDriver’  
require ‘pp’  
wsdl = ‘[https://example.com/cwpidws/cwpidws?WSDL](https://example.com/cwpidws/cwpidws?WSDL)’  
driver = SOAP::WSDLDriverFactory.new(wsdl).create\_rpc\_driver

# Log SOAP request and response

driver.wiredump\_file\_base = “cwp-log.txt”

XSD::Charset.encoding = ‘UTF8’  
uid = ‘username’  
pwd = ‘password’  
response = driver.login(uid, pwd, [“EMAIL”, “LASTNAME”, “FIRSTNAME”])  
pp(response)

The environments are

$ ruby -v  
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]  
$ gem list soap4r  
  
soap4r (1.5.8)

Cheers,  
Henry

[1] [Ruby SOAP Bug? - Ruby - Ruby-Forum](http://www.ruby-forum.com/topic/155169)
