Soap4r attributes vs elements

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.

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

Many thanks. That'll make life easier.

Cheers,
Roy.

···

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)