Ruby and Soap Soap4r


#1

I can’t wrap my head around a soap4r issue i’m having, need some help
please!

So here is what I have:

This is the example envelope from a .net web service to authorize:

POST /PublicAPIReport/publicapiservice.asmx HTTP/1.1
Host: 10.1.2.64
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: “http://REMOVEDFORSECURITY/WebServices/PublicAPIService/
Authorize”

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

<soap:Envelope xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:soap=“http://
schemas.xmlsoap.org/soap/envelope/”>
soap:Body


string
string
string
string


</soap:Body>
</soap:Envelope>

Here is my code to create this envelope:

def store_metric

endpoint_url = "http://REMOVEDFORSECURITY/PublicAPIReport/

publicapiservice.asmx"
namespace = “http://REMOVEDFORSECURITY/WebServices/
PublicAPIService”
soapaction = “http://REMOVEDFORSECURITY/WebServices/
PublicAPIService/Authorize”
user = “REMOVEDFORSECURITY”
pass = “REMOVEDFORSECURITY”
company = “REMOVEDFORSECURITY”
version = “7.0.1”

driver = SOAP::RPC::Driver.new(endpoint_url, namespace,

soapaction)
driver.add_rpc_method(‘Authorize’, ‘User’ , ‘Password’,
‘CompanyID’ , ‘Version’)
authorize = driver.Authorize(user, pass, company , version)

end

But this code of course results in this:

Wire dump:

= Request

! CONNECT TO 10.1.2.64:80
! CONNECTION ESTABLISHED
POST /PublicAPIReport/publicapiservice.asmx HTTP/1.1
SOAPAction: “http://REMOVEDFORSECURITY/WebServices/PublicAPIService/
Authorize”
Content-Type: text/xml; charset=utf-8
User-Agent: SOAP4R/1.5.5 (/187, ruby 1.8.6 (2007-03-13) [powerpc-
darwin8.8.0])
Date: Thu, 04 Dec 2008 10:44:16 GMT
Content-Length: 640
Host: 10.1.2.64

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

<env:Envelope xmlns:xsd=“http://www.w3.org/2001/XMLSchema
xmlns:env=“http://schemas.xmlsoap.org/soap/envelope/
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”>
env:Body
<n1:Authorize xmlns:n1=“http://REMOVEDFORSECURITY/WebServices/
PublicAPIService”
env:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”>
REMOVEDFORSECURITY
REMOVEDFORSECURITY
Uinta
7.0.1
</n1:Authorize>
</env:Body>
</env:Envelope>

= Response

HTTP/1.1 200 OK
Date: Thu, 04 Dec 2008 10:44:16 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 388

<?xml version="1.0" encoding="utf-8"?><soap:Envelope

xmlns:soap=“http://schemas.xmlsoap.org/soap/envelope/
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xmlns:xsd=“http://www.w3.org/2001/
XMLSchema”>soap:Bodyfalse</
AuthorizeResponse></soap:Body></soap:Envelope>

Thanks so much for any help! I’m pulling my hair out trying to figure
out how to get it working.

-Cam