Problem Consuming a Web Service

I’m trying to consume a webservice from my rails application and have
discovered an interesting problem. I can call webservice functions
just fine, as long as they do not require any arguments, but function
that do require arguments do not work. The arguments are sent as
either null or an empty string.

My API has these method definitions:

api_method :otherFunction, :expects=>[{:username=>:string}],
:returns=>[:string]

api_method :test, :returns=>[:int]

Calling test works perfectly. When I try to call otherFunction from
my controller, after setting up the soap_client:

soap_client.otherFunction(‘name’)

Somehow the username parameter is not being filled out properly. Has
anyone else ran into this? Is there anyway to test the request that
Rails is sending out?

Thanks,
Josh

On 5/17/06, Josh C. [email protected] wrote:

I’m trying to consume a webservice from my rails application and have
discovered an interesting problem.

Is there anyway to test the request that Rails is sending out?

soap_client.wiredump_dev = STDERR

wiredump_dev does not seem to be a valid method… Is there another
solution?

Thanks,
Josh

I’m trying to consume a webservice from my rails application and have
discovered an interesting problem.

Is there anyway to test the request that Rails is sending out?

soap_client.wiredump_dev = STDERR

wiredump_dev does not seem to be a valid method…

What SOAP client library are you using?

Is there another solution?

Use Ethereal to capture a test session. Select a packet and ‘Analyze’
-> ‘Follow TCP Stream’.

Ah, that’s a great tool. I see the problem is that the generated soap
request has alot of strange xml namespace problems. I don’t know what
to make of it yet, but I guess it’s a start.

I’m using the
ActionWebService::Client::Soap.new(UmkcApi, “http://…”,
:namespace=>“https://…mynamespace”,
:driver_options=>{:default_encodingstyle =>
SOAP::EncodingStyle::ASPDotNetHandler::Namespace })

Thanks for your help so far

I don’t understand what is going wrong. Here is the envelope that is
being sent:

<?xml version="1.0" encoding="us-ascii" ?>

<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:Changed xmlns:n1=“https://Changed/
env:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”>
charlesj
</n1:Changed>
</env:Body>
</env:Envelope>

When it should simply be this:

<?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

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

Any ideas on what might be causing this, and how I might be able to
fix it? I’ve been looking through the documentation for:
ActionWebService::Client::Soap, but it certainly appears that I’ve
done everything correctly… The webservice I’m calling without
parameters works perfectly.

Josh

On 5/18/06, Josh C. [email protected] wrote:

Ah, that’s [Ethereal] a great tool.

Yes it is; I had to use the same method last night to help track down
a bug in a .net SOAP service. :slight_smile:

I see the problem is that the generated soap
request has alot of strange xml namespace problems. I don’t know what
to make of it yet, but I guess it’s a start.

I had a problem awhile back that was namespace related in SOAP client.
In my case the problem was I was just sending a Hash as the parameter
for the SOAP call instead of an instance of the Request class that
wsdl2ruby (soap4r) generated for me from the WSDL.

I’m using the
ActionWebService::Client::Soap.new(UmkcApi, “http://…”,
:namespace=>“https://…mynamespace”,
:driver_options=>{:default_encodingstyle =>
SOAP::EncodingStyle::ASPDotNetHandler::Namespace })

I later thought that might be the case; explains why soap4r’s
wiredump_dev didn’t work. :slight_smile: