# Problem with soap and wsdl

**URL:** <https://www.ruby-forum.com/t/problem-with-soap-and-wsdl/154956>\
**Category:** Ruby\
**Created:** [December 5, 2008, 4:05pm UTC](https://www.ruby-forum.com/t/problem-with-soap-and-wsdl/154956 "2008-12-05T16:05:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Larz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/85f322/32.png) [@Larz](https://www.ruby-forum.com/u/Larz)\
**Post date:** [December 5, 2008, 4:05pm UTC](https://www.ruby-forum.com/t/problem-with-soap-and-wsdl/154956/1 "2008-12-05T16:05:55Z")

</div>

If anyone can help me figure this out, I’d appreciate it. I’m trying  
to do soap calls to a a condor web service.  
Some of the calls work ok, but below I try to call commitTransaction  
and it gets an error. Then below there is a second attempt using wsdl,  
but that fails also in some other way …

================================

require ‘soap/rpc/driver’

drv = SOAP::RPC::Driver.new(‘[http://133.24.112.97:63962](http://133.24.112.97:63962)’,  
‘urn:condor’)

drv.add\_method(‘beginTransaction’,‘duration’)  
drv.add\_method(‘commitTransaction’,‘transaction’,‘two’)

p drv

res = drv.beginTransaction(20)

p res  
p res.transaction

#p res.status.code

sleep 2

id = res.transaction.id.to\_i

p id.class

stat = drv.commitTransaction(id,{‘id’ =\> id, ‘duration’ =\> 20})  
p stat

#\<SOAP::RPC::Driver:#SOAP::RPC::Proxy:http://133.24.112.97:63962\>  
#\<SOAP::Mapping::Object:0x…fdbec7498 {}status=#\<SOAP::Mapping::Object:  
0x…fdbec72c2 {}code=“SUCCESS” {}message=“Success”\> {}  
transaction=#\<SOAP::Mapping::Object:0x…fdbec6d36 {}id=“960467459” {}  
duration=“20”\>\>  
#\<SOAP::Mapping::Object:0x…fdbec6d36 {}id=“960467459” {}  
duration=“20”\>  
Fixnum  
: Validation constraint violation: data type mismatch xsd:int in  
element (SOAP::FaultError)

The error here occurs at the commitTransaction call …

==========================================

Here is what Transaction and commitTransaction looks like in wsdl:

- - -
- 

- -

==============================================

wsdl = ‘[http://133.24.112.97:63962/condorSchedd.wsdl](http://133.24.112.97:63962/condorSchedd.wsdl)’

drv = SOAP::WSDLDriverFactory.new(wsdl).create\_rpc\_driver

p drv

res = drv.beginTransaction({‘duration’ =\> 20})

ignored attr: {}nillable  
#\<SOAP::RPC::Driver:#SOAP::RPC::Proxy:http://localhost:80\>  
/usr/local/lib/ruby/1.8/net/http.rb:560:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED) from /usr/local/lib/ruby/1.8/net/http.rb:560:in `open’  
from /usr/local/lib/ruby/1.8/net/http.rb:560:in `connect' from /usr/local/lib/ruby/1.8/timeout.rb:48:in `timeout’  
from /usr/local/lib/ruby/1.8/timeout.rb:76:in `timeout' from /usr/local/lib/ruby/1.8/net/http.rb:560:in `connect’  
from /usr/local/lib/ruby/1.8/net/http.rb:553:in `do_start' from /usr/local/lib/ruby/1.8/net/http.rb:542:in `start’  
from /usr/local/lib/ruby/1.8/soap/netHttpClient.rb:115:in  
`start' from /usr/local/lib/ruby/1.8/soap/netHttpClient.rb:92:in `post’  
from /usr/local/lib/ruby/1.8/soap/streamHandler.rb:170:in  
`send_post' from /usr/local/lib/ruby/1.8/soap/streamHandler.rb:109:in `send’  
from /usr/local/lib/ruby/1.8/soap/rpc/proxy.rb:170:in `route' from /usr/local/lib/ruby/1.8/soap/rpc/proxy.rb:141:in `call’  
from /usr/local/lib/ruby/1.8/soap/rpc/driver.rb:178:in `call' from /usr/local/lib/ruby/1.8/soap/rpc/driver.rb:232:in `beginTransaction’  
from soap3.rb:11

If I do this, passing the parameter like this:

res = drv.beginTransaction(20)

I get:

#\<SOAP::RPC::Driver:#SOAP::RPC::Proxy:http://localhost:80\>  
/usr/local/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:133:in  
`complexobj2soap': nil not allowed: duration (SOAP::Mapping::MappingError) from /usr/local/lib/ruby/1.8/wsdl/xmlSchema/complexType.rb: 56:in `each\_element’  
from /usr/local/lib/ruby/1.8/wsdl/xmlSchema/complexType.rb:  
52:in `each' from /usr/local/lib/ruby/1.8/wsdl/xmlSchema/complexType.rb: 52:in `each\_element’  
from /usr/local/lib/ruby/1.8/soap/mapping/  
wsdlliteralregistry.rb:122:in `complexobj2soap' from /usr/local/lib/ruby/1.8/soap/mapping/ wsdlliteralregistry.rb:108:in `obj2typesoap’  
from /usr/local/lib/ruby/1.8/soap/mapping/  
wsdlliteralregistry.rb:93:in `obj2elesoap' from /usr/local/lib/ruby/1.8/soap/mapping/ wsdlliteralregistry.rb:39:in `obj2soap’  
from /usr/local/lib/ruby/1.8/soap/mapping/mapping.rb:127:in  
`_obj2soap' ... 10 levels... from /usr/local/lib/ruby/1.8/soap/rpc/proxy.rb:123:in `call’  
from /usr/local/lib/ruby/1.8/soap/rpc/driver.rb:178:in `call' from /usr/local/lib/ruby/1.8/soap/rpc/driver.rb:232:in `beginTransaction’  
from soap3.rb:12
