Solution consuming .NET SOAP service


#1

Hey all

I have been trying to consume a .NET exposed web-service with soap4r and
have found some things that might help others when doing the same thing

Oddly, soap4r interprted the following WSDL

<s:element name=“GetAllProperties”>
<s:complexType>
<s:sequence>
<s:element minOccurs=“0” maxOccurs=“1” name=“inUsername”
type=“s:string” />
<s:element minOccurs=“0” maxOccurs=“1” name=“inPassword”
type=“s:string” />
<s:element minOccurs=“0” maxOccurs=“1” name=“inAccountID”
type=“s:string” />
</s:sequence>
</s:complexType>
</s:element>

As only having the one paramater, inAccountID. So to get around this and
pass all three params as a struct object like this:

soap = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
Request = Struct.new(:inAccountID, :inUsername, :inPassword)
soap.GetAllProperties(Request.new(‘2’, ‘test’, ‘test’))

And as its a .NET WS, i had to employ the following also:

soap.default_encodingstyle = SOAP::EncodingStyle::ASPDotNetHandler.new

Hope this helps somone

Tim


#2

On 3/4/07, Tim P. removed_email_address@domain.invalid wrote:

I have been trying to consume a .NET exposed web-service with soap4r and
have found some things that might help others when doing the same thing

I too have found soap very difficult to work with. It doesn’t
necessarily help that soap4r is virtually undocumented. Here’s the
approach that ended up working for a particularly troublesome wdsl: I
generated a client using apache axis, ran a couple of tests, sniffed
the traffic and generated templates from the xml axis produced for the
call. Then picked the responses apart using REXML. Not pretty, but it
works well enough and was easier than guessing around with soap4r.

Just my opinion: Soap itself is entirely convoluted, if you really
need xml overhead for rpc (hint: you don’t) it should at least be
human readable, xmlrpc I can live with, I don’t see the point of soap.
-tim


#3

I agree - the lack of documentaion and per-service implementation
differences does make it somewhat of a minefield!

SOAP implementations tend to be quite complex on most platforms/lanuages
(unless your using an IDE to do all the work for you with somthing like
C# VS) - even for those which have frameworks in place e.g. soap4R,
WebServicesCore etc etc. I have been working on a SOAP client in
objective-c consuming the same service and in comparison makes Soap4R
seem like a well implemented walk in the park! haha

If anyone has any other handy SOAP tips by all means tag them onto here

Cheers

Tim