# Solution consuming .NET SOAP service

**URL:** <https://www.ruby-forum.com/t/solution-consuming-net-soap-service/87632>\
**Category:** Ruby\
**Created:** [March 4, 2007, 5:27pm UTC](https://www.ruby-forum.com/t/solution-consuming-net-soap-service/87632 "2007-03-04T17:27:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [March 4, 2007, 5:27pm UTC](https://www.ruby-forum.com/t/solution-consuming-net-soap-service/87632/1 "2007-03-04T17:27:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [March 4, 2007, 5:45pm UTC](https://www.ruby-forum.com/t/solution-consuming-net-soap-service/87632/2 "2007-03-04T17:45:20Z")

</div>

On 3/4/07, Tim P. [removed\_email\_address@domain.invalid](mailto: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

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [March 4, 2007, 5:50pm UTC](https://www.ruby-forum.com/t/solution-consuming-net-soap-service/87632/3 "2007-03-04T17:50:54Z")

</div>

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
