Using .Net SOAP service

H

Hasham

Hi,

I am getting this error while trying to access .NET based SOAP Web
service

#<SOAP::Mapping::Object:0xb7c86218>:
System.Web.Services.Protocols.SoapException: Server was unable to
process request. ---> System.NullReferenceException: Object reference
not set to an instance of an object. (SOAP::FaultError)

My code to access this service is:

require 'soap/wsdlDriver'
wsdl = 'http://www.dotnetsite.com/MyService/Service.asmx?WSDL
driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
puts driver.GetVals('136')

I have tried many things but still i am not able to get this code
working. Please tell what should i do to get this working
 
B

Ben Burkert

Try putting the '136' in a SOAP::SOAPString or SOAP::SOAPInt:

p driver.GetVals(SOAP::SOAPString.new("136"))
or
p driver.GetVals(SOAP::SOAPInt.new(136))

If that doesn't work, i try using the wsdl2ruby generator to create
the class stubs. It will create a class for each parameter. In your
case, it will be something like:

p driver.GetVals( GetVals.new(SOAPString.new("136")))

-Ben
 
H

Hasham

Thanks Ben,

I finally figured out the problem i had to pass arguments as hash like
this:

puts driver.GetVals:)parameter => "136")
 
N

NAKAMURA, Hiroshi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Thanks Ben for answering.
I finally figured out the problem i had to pass arguments as hash like
this:

puts driver.GetVals:)parameter => "136")

FYI: Generating stub files with wsdl2ruby.rb against a WSDL could help
to understand what arguments you should pass.

% wsdl2ruby.rb --wsdl Foo.wsdl --type client --force

Regards,
// NaHi

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)

iQEVAwUBRrExqR9L2jg5EEGlAQJD5wf/RLB3kaPq115QqrkXGA/UoQy+0tF3s0u6
BaWDjyhOomXHwpbG01Xap4Hrn4Lj76RH5IM7gsnghAIdnmVUOarkIESiRMroGHnn
SLYivk18+BP9E5aC4/P9HhqgY2ENDyLbtEuZdwT03eeC8Ud9DcUUiyDwQJpCT+ot
M10KcWddGKZqutS2BBaoCfsVVPwm7ro8DybxHTu12Np9JDw8+/bs4dDNiWbElXH1
7R+clOEHHhx9mb03IWzo34tsVwFffWdEbl/Eo3XM57892wiTfZfRUvFvchqSLugo
7QOHMzN8TpSsd0b5JkhqcPl0wXn61p2waYFB7C4k78ubUj5V8jZudQ==
=7UJV
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top