[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

soap4r attributes vs elements

Roy Britten

2/26/2007 8:36:00 PM

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.

2 Answers

NAKAMURA, Hiroshi

6/6/2007 2:03:00 PM

0

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

Hi,

Sorry for the late response.

Roy Britten wrote:
> 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-----

Roy Britten

8/2/2007 2:33:00 AM

0

On 07/06/07, NAKAMURA, Hiroshi <nakahiro@sarion.co.jp> wrote:
> 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.