adding soap element attributes

A

Andrew Tongen

Hi,

I have a question that I hope will be simple for someone to answer.

I am using soap4r to write a simple library to consume web services from
an application. The application does not include a WSDL document, so I
have to write everything by hand.

The application requires attributes in certain elements of the soap
request, and I am having a little trouble figuring out how to do this.
So far, a portion of my test code looks like this:

driver = SOAP::RPC::Driver.new(endpoint, 'urn:namespace')
driver.add_method_as('get_account', 'GetAccountRequest', 'account')
get_account = driver.get_account('(e-mail address removed)')

which produces this:

<n2:GetAccountRequest xmlns:n2="urn:namespace"
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<account xsi:type="xsd:string">[email protected]</account>
</n2:GetAccountRequest>

but I need the soap request to look like this:

<n2:GetAccountRequest xmlns:n2="urn:namespace"
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<account by="name" xsi:type="xsd:string">[email protected]</account>
</n2:GetAccountRequest>

with the by="name" attribute in the account element.

I've been experimenting with SOAP::Mapping::Registry to achieve this,
but I am not sure how it would be done, or even if this is the correct
approach to take. If anyone can offer any assistance, it would be
appreciated.

Thanks,
Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,218
Latest member
JolieDenha

Latest Threads

Top