Passing a blank XSD::QName using soap4r
I have overridden the SimpleHandler to pass a username and password using soap4r. the problem is that I am forced to 开发者_Go百科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?
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
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.
精彩评论