soap4r header without a namespace

W

Wayne Molina

Hello all. I'm trying to create a header using soap4r and the web
service I'm calling requires a Username and Password to be sent as
individual elements of the header. I've overridden
SOAP::Header::SimpleHandler as follows:

class CelltrustAuthHeader < SOAP::Header::SimpleHandler
attr_accessor :username, :password

def initialize(username, password)
super(XSD::QName::EMPTY)
@username, @password = username, password
end

def on_simple_outbound
{"Username" => @username, "Password" => @password}
end
end

However this is giving me an error when I call the web services method
stating SOAP::Generator::FormatEncodeError: Element name not defined:
#<SOAP::SOAPElement:0x122c968>.

If I pass in dummy values to the call to super, then it executes the
request but the response gives me an error ("Security Violation" which
means that it's not getting my username/password) since the request XML
looks like this:

<env:Header>
<n1:dummy env:mustUnderstand="0"
xmlns:n1="dummy">
<n1:Username>myusername</n1:Username>
<n1:password>topsecret</n1:password>
</n1:dummy>
</env:Header>

When the web service is expecting it to look like this:

<env:Header>
<n1:Username>myusername</n1:Username>
<n1:password>topsecret</n1:password>
</env:Header>

I don't need or want the <n1:text env:mustUnderstand="0"
xmlns:n1="text"> portion; how can I get rid of it?
 

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,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top