0

I have overridden the SimpleHandler to pass a username and password using soap4r. the problem is that I am forced to give a QName, and this is causing the result to fail because it's not in the right format.

What soap4r is adding is something like this (the "ns1" things are dummy values):

<env:Header>
  <n1:ns1 env:mustUnderstand="0"
    xmlns:n1="ns1">
    <n1:Username>someuser</n1:Username>
    <n1:Password>topsecret</n1:Password>
   </n1:ns1>
 </env:Header>

What it needs to be is this:

<env:Header>
  <n1:Username>someuser</n1:Username>
  <n1:Password>topsecret</n1:Password>
</env:Header>

How can I NOT pass in a containing name?

Wayne Molina
  • 19,158
  • 26
  • 98
  • 163

2 Answers2

0

Soap4R is quite picky about overriding headers. In your situation, you'll need to add two "flat" handlers (one for Username, and another for Password) instead of a single one with both.

Sérgio Gomes
  • 720
  • 5
  • 14
0

Looks like you need to make some changes to soap4r: http://dev.ctor.org/soap4r/browser/branches/1_5/lib/soap/header/handler.rb

If the service isn't all that complicated you could try Handsoap https://github.com/unwire/handsoap/wiki/authentication#WS-Security

RamC
  • 1,287
  • 1
  • 11
  • 15
Jonas Elfström
  • 30,834
  • 6
  • 70
  • 106