Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > NANWSI: Not Another .NET Web Service Issue

Reply
Thread Tools

NANWSI: Not Another .NET Web Service Issue

 
 
Massimo Bensi
Guest
Posts: n/a
 
      10-14-2009
Hi all,

I'm still quite new to Ruby, I come from years of "evil" development (MS
and .NET).
I am using ruby1.9.1 and soap4r to communicate with a .NET web service.

I've seen several posts, several advices, several "solutions"; I tried
them all, and still it doesn't work...
I've been trying different approaches for a couple of days now, and I
feel I am getting stuck.

My dumb web service is here: http://78.136.25.213/Test/ws/Service.asmx
From here you can get its WSDL:
http://78.136.25.213/Test/ws/Service.asmx?wsdl

It's a basic ws that expects a single string parameter ("inputString")
as input and returns a single string as output. That simple (this is a
test of course).

This is the code of my client:
-------------------------------------------------------------------------------
require "soap/rpc/driver"
require "RechnerServiceModule"
include RechnerServiceModule

server = 'http://78.136.25.213/Test/ws/Service.asmx'
wiredump_dev=STDERR
service = SOAP::RPC:river.new(server,
RechnerServiceModule::InterfaceNS)
service.use_default_namespace = true
service.default_encodingstyle =
SOAP::EncodingStyle::ASPDotNetHandler::Namespace
service.wiredump_dev=wiredump_dev
RechnerServiceModule::add_method(service)
result = service.TestWS(arameter => "testString")
print("Result: ", result)
-------------------------------------------------------------------------------

This is the RechnerServiceModule:

-------------------------------------------------------------------------------
###file:servicemodule.rb
module RechnerServiceModule
InterfaceNS = 'http://tempuri.org/TestWS'
Methods=[['TestWS', 'inputString']]

def RechnerServiceModule.add_method(drv)
Methods.each do |method, *param|
drv.add_method_with_soapaction(method, InterfaceNS, *param)
end
end
end
-------------------------------------------------------------------------------

Looking at the wiredump I see that this is the SOAP XML sent (which
apparently is identical to the one .NET expects - on the TestWS web
page: http://78.136.25.213/Test/ws/Service.asmx?op=TestWS):

-------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?><soap:Envelope
xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
xmlnssd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body>
<TestWS xmlns="http://tempuri.org/TestWS">
<inputString>testString</inputString> </TestWS>
</soap:Body></soap:Envelope>
-------------------------------------------------------------------------------

Unfortunately I keep on receiving an error, as you can see in the
response:

-------------------------------------------------------------------------------
HTTP/1.1 500 Internal Server Error
Date: Wed, 14 Oct 2009 13:07:26 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 433

<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
xmlnssd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap: Server</faultcode><faultstring>Server
was unable to process request. ---&gt; Value cannot be null.
Parameter name: String</faultstring><detail
/></soap:Fault></soap:Body></soap:Envelope>

: Server was unable to process request. ---> Value cannot be null.
(SOAP::FaultError)
Parameter name: String

Process finished with exit code 1

-------------------------------------------------------------------------------

I tried the approach of generating the WSDL proxy, and this is the error
I received:

-------------------------------------------------------------------------------
wsdl2ruby.rb --wsdl http://78.136.25.213/Test/ws/Service.asmx?wsdl
--type client --force
ignored element: {http://schemas.xmlsoap.org/wsdl/soap12/}binding
ignored element: {http://schemas.xmlsoap.org/wsdl/soap12/}operation
ignored element: {http://schemas.xmlsoap.org/wsdl/soap12/}body
ignored element: {http://schemas.xmlsoap.org/wsdl/soap12/}address
I, [2009-10-14T14:58:09.237427 #35258] INFO -- app: Creating class
definition.
I, [2009-10-14T14:58:09.237637 #35258] INFO -- app: Creates file
'default.rb'.
F, [2009-10-14T14:58:09.239160 #35258] FATAL -- app: Detected an
exception. Stopping ... undefined method `collect' for
"{http://tempuri.org/}TestWS\n inputString - SOAP::SOAPString":String
(NoMethodError)
/usr/lib/Ruby1.9/rubygems-1.3.5/gems/soap4r-1.5.8/lib/xsd/codegen/gensupport.rb:239:in
`trim_eol'
....
etc
-------------------------------------------------------------------------------

So, if anybody has the solution to this, I would really love to hear
that, since this is killing me now...

Thanks for the help!
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Massimo Bensi
Guest
Posts: n/a
 
      10-16-2009
I guess nobody has the answer to this, hence nobody was able to make
soap4r working with .NET web services?
Anybody could please suggest me a working SOAP library for Ruby that
works for real with .NET ws?
Sure appreciated, thanks!
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Dirkjan Bussink
Guest
Posts: n/a
 
      10-16-2009

On 16 Oct 2009, at 11:55, Massimo Bensi wrote:

> I guess nobody has the answer to this, hence nobody was able to make
> soap4r working with .NET web services?
> Anybody could please suggest me a working SOAP library for Ruby that
> works for real with .NET ws?
> Sure appreciated, thanks!


I've been successful in using various wsdl's for communicating with
some services which are also .NET based afaik. I've used wsdl2ruby.rb
in all cases and it didn't fail on the wsdl's I've given it.

But I'd probably use this now if I need to write additional clients:

http://github.com/unwire/handsoap/

I'd suggest giving it a try to see if it fits your needs.

--
Regards,

Dirkjan Bussink

 
Reply With Quote
 
brabuhr@gmail.com
Guest
Posts: n/a
 
      10-16-2009
On Fri, Oct 16, 2009 at 5:55 AM, Massimo Bensi <(E-Mail Removed)> wrote:
> I guess nobody has the answer to this, hence nobody was able to make
> soap4r working with .NET web services?
> Anybody could please suggest me a working SOAP library for Ruby that
> works for real with .NET ws?
> Sure appreciated, thanks!


Sorry, for the delay. I also haved used soap4r successfully in the
past to talk to .net web services. After your initial post, I grabbed
your wsdl and ran it through wsdl2ruby, the result was the same as
yours: the request appeared identical to the sample request provided
by the web service but the response was parameter String cannot be
NULL.

I would recommend trying another library such as suggested by Dirkjan
Bussink. Also, are you certain that the service itself is not the
issue (e.g. it appears that the error references a parameter named
String but the request only has a parameter testString)?

 
Reply With Quote
 
Massimo Bensi
Guest
Posts: n/a
 
      10-19-2009
unknown wrote:
> On Fri, Oct 16, 2009 at 5:55 AM, Massimo Bensi <(E-Mail Removed)>
> wrote:
>> I guess nobody has the answer to this, hence nobody was able to make
>> soap4r working with .NET web services?
>> Anybody could please suggest me a working SOAP library for Ruby that
>> works for real with .NET ws?
>> Sure appreciated, thanks!

>
> Sorry, for the delay. I also haved used soap4r successfully in the
> past to talk to .net web services. After your initial post, I grabbed
> your wsdl and ran it through wsdl2ruby, the result was the same as
> yours: the request appeared identical to the sample request provided
> by the web service but the response was parameter String cannot be
> NULL.
>
> I would recommend trying another library such as suggested by Dirkjan
> Bussink. Also, are you certain that the service itself is not the
> issue (e.g. it appears that the error references a parameter named
> String but the request only has a parameter testString)?


Thanks,

unknown: you were right, it was totally my fault!
I was too busy debugging this "new" (to me) Ruby library that I didn't
bother checking for issues in the web service.
Well, the problem was actually there..
Sorry about this, my bad.

Dirkjan: thank you much, I'll keep handsoap in mind in case I need
another soap library.

For now it works just fine with soap4r!
Thanks all!

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
asp.net web service connecting to another web service jazzydance ASP .Net Web Services 3 02-08-2010 11:59 PM
Web service autentication problem when call another web service Redhot ASP .Net Web Services 0 07-18-2009 09:43 PM
Does timer in Web Service Global.asax block my Web Service from processing web-site requests? Leo Violette ASP .Net Web Services 0 04-17-2009 12:39 AM
InvocationTargetException when calling "new Service()" in Axis web service to call another web service Michael Averstegge Java 0 01-10-2006 11:05 PM
calling web-service from another web-service Mr. x ASP .Net Web Services 0 09-29-2003 02:47 PM



Advertisments