# Soap4r attributes vs elements

**URL:** <https://www.ruby-forum.com/t/soap4r-attributes-vs-elements/86913>\
**Category:** Ruby\
**Created:** [February 26, 2007, 9:37pm UTC](https://www.ruby-forum.com/t/soap4r-attributes-vs-elements/86913 "2007-02-26T21:37:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roy\_Britten](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a5b964/32.png) [@Roy\_Britten](https://www.ruby-forum.com/u/Roy_Britten)\
**Post date:** [February 26, 2007, 9:37pm UTC](https://www.ruby-forum.com/t/soap4r-attributes-vs-elements/86913/1 "2007-02-26T21:37:00Z")

</div>

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:

What I’m after is this:

the web service doesn’t accept this:

 bar 

Is there any means of achieving this with soap4r?

Thanks,  
Roy.

---

<div class="post-metadata">

**Author:** ![Roy\_Britten](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a5b964/32.png) [@Roy\_Britten](https://www.ruby-forum.com/u/Roy_Britten)\
**Post date:** [June 6, 2007, 4:03pm UTC](https://www.ruby-forum.com/t/soap4r-attributes-vs-elements/86913/2 "2007-06-06T16:03:24Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![Roy\_Britten](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a5b964/32.png) [@Roy\_Britten](https://www.ruby-forum.com/u/Roy_Britten)\
**Post date:** [August 2, 2007, 4:34am UTC](https://www.ruby-forum.com/t/soap4r-attributes-vs-elements/86913/3 "2007-08-02T04:34:54Z")

</div>

On 07/06/07, NAKAMURA, Hiroshi [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.
