# SOAP and .NET: \<env: vs \<soap:

**URL:** <https://www.ruby-forum.com/t/soap-and-net-env-vs-soap/129030>\
**Category:** Ruby\
**Created:** [February 13, 2008, 5:36pm UTC](https://www.ruby-forum.com/t/soap-and-net-env-vs-soap/129030 "2008-02-13T17:36:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![paerez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5fc32e/32.png) [@paerez](https://www.ruby-forum.com/u/paerez)\
**Post date:** [February 13, 2008, 5:36pm UTC](https://www.ruby-forum.com/t/soap-and-net-env-vs-soap/129030/1 "2008-02-13T17:36:18Z")

</div>

I am interacting with a client’s SOAP interface, and they provided me  
with a WSDL however the create\_rpc\_driver method doesn’t get it quite  
right.

Thanks to input on these forums I’ve _almost_ got it right.

Here is my code:  
@soap = SOAP::RPC::Driver.new(SOAP\_URL,NS,action)  
@soap.wiredump\_dev = STDOUT  
@soap.add\_document\_method(‘getAllVideos’,action,  
[XSD::QName.new(NS,‘getAllVideos’)],  
[XSD::QName.new(NS,‘getAllVideosResult’)])

I have to do it that way with the namespaces so they come out right for  
.NET (I think).

Here is my generated request:  
POST [[snip]] HTTP/1.1  
SOAPAction: “[[snip]]”  
Content-Type: text/xml; charset=utf-8  
User-Agent: SOAP4R/1.5.5 (/187, ruby 1.8.6 (2007-09-24) [x86\_64-linux])  
Date: Wed, 13 Feb 2008 16:17:51 GMT  
Content-Length: 424  
Host: 66.230.202.184

\<?xml version="1.0" encoding="utf-8" ?\>

\<env:Envelope xmlns:xsd=“[http://www.w3.org/2001/XMLSchema](http://www.w3.org/2001/XMLSchema)”  
xmlns:env=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)”  
xmlns:xsi=“[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)”\>  
env:Body  
  
username  
password  
  
\</env:Body\>  
\</env:Envelope\>

And the request I wish I had:  
POST [[snip]] HTTP/1.1  
Host: 66.230.202.184  
Content-Type: text/xml; charset=utf-8  
Content-Length: length  
SOAPAction: “[[snip]]”

\<?xml version="1.0" encoding="utf-8"?\>

\<soap:Envelope xmlns:xsi=“[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)”  
xmlns:xsd=“[http://www.w3.org/2001/XMLSchema](http://www.w3.org/2001/XMLSchema)”  
xmlns:soap=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)”\>  
soap:Body  
  
username  
password  
  
\</soap:Body\>  
\</soap:Envelope\>

The ONLY difference is that ruby namespaced the envelope and body as  
“env” while the client uses “soap”.

I am told that this does not matter for soap, but this is the only  
difference. If it truly does not matter then I will have to blame my  
client, and in that case I want to be absolutely sure that I am right.

By the way, the error on the client side is that one of the variables is  
nil. I am guessing this is because he searches for an xml node named  
“soap:Envelope” or something.

Thanks.
