soap4r attributes vs elements

R

Roy Britten

Hi list,

soap4r is great when it comes to creating requests consisting of elements

require 'soap/wsdlDriver'
driver = SOAP::WSDLDriverFactory.new(wsdlURL).create_rpc_driver
driver.getSomething:)foo=>"bar")

I have a third-party web service utilising attributes of the request
object, rather than nested elements.

soap4r is generating this:

<name>
</name>

What I'm after is this:

<name foo="bar" />

the web service doesn't accept this:

<name>
<foo>bar</foo>
</name>

Is there any means of achieving this with soap4r?

Thanks,
Roy.
 
N

NAKAMURA, Hiroshi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Sorry for the late response.

Roy said:
I have a third-party web service utilising attributes of the request
object, rather than nested elements.
What I'm after is this:

<name foo="bar" />
Is there any means of achieving this with soap4r?

You need to construct SOAP element object.

ele = SOAP::SOAPElement.new("name")
ele.extraattr["foo"] = "bar"
driver.invoke(ele)

Regards,
// NaHi

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)

iQEVAwUBRma+ax9L2jg5EEGlAQIzKQgAv9Ffq4Ny+zpZ0kxfT/2cCpKJWxFY4msd
QxEahJ5dWDtRYUkIoUGu7sZ1LwDAZ8NyznkjctH14wjih42YDf5vOKyzC6fr+jak
KKfXFMGmSGlAHD9zfsmIixdIqx8F2eh8E0zwMSv/JUgECw9/5/f9ZPPeEDT5No7B
jjmgmK8diVS+jzOix5dyZSsIFPAprxS06VOQrD5qs91ijQhoWx63odml0CamGiWv
Xf0zex3VTBybQ6xufpeNaDAYRX9EPFNHjJBEYYLc4plPoWGHLC2soUdwUSyL5fIg
LHzlwP9V28Qnnkjk1VquryOsOP01Sn6x/jXiK61MZEPG1DTJYX4OAA==
=kept
-----END PGP SIGNATURE-----
 
R

Roy Britten

You need to construct SOAP element object.

ele = SOAP::SOAPElement.new("name")
ele.extraattr["foo"] = "bar"
driver.invoke(ele)

Many thanks. That'll make life easier.

Cheers,
Roy.
 

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,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top