Forum: Ruby Soap4R - Question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1bb8d2f105bfc1095bad2c513681737a?d=identicon&s=25 Ball Balla (balla123)
on 2009-01-20 00:06
I am trying to add a custom header to my outgoing SOAP4R messages.

I figured out how to add a header by doing the following.


class ClientAuthHeaderHandler < SOAP::Header::Handler
    NAMESPACE = XSD::QName.new("somenamespace", "test")

    def initialize
      super(NAMESPACE)
     end

    def on_simple_outbound
      { "MY_KEY" => 'somevalue' }
    end

  end

driver = SOAP::WSDLDriverFactory.new('somewsdl').create_rpc_driver
driver.headerhandler << ClientAuthHeaderHandler.new

Which will produce the following output for the header

<env:Header>
 <n1:test xmlns:n1="somenamespace" env:mustUnderstand="0">
  <n1:MY_KEY>somevalue</n1:MY_KEY>
 </n1:test>
</env:Header>

But I do not want the n1:test namespace. IE all I want is

<env:Header>
  <n1:MY_KEY>somevalue</n1:MY_KEY>
</env:Header>

How can I accomplish this?
This topic is locked and can not be replied to.