通过一个空白XSD::QName使用soap4r。

时间:2020-12-20 06:26:28

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.

我已经重写了SimpleHandler以使用soap4r传递用户名和密码。问题是,我*给出一个QName,这导致结果失败,因为它不是正确的格式。

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

soap4r添加的是这样的东西(“ns1”的东西是虚拟值):

<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?

我怎么能不传递一个包含的名字呢?

2 个解决方案

#1


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

看起来您需要对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 http://wiki.github.com/unwire/handsoap/authentication#WS-Security

如果服务不那么复杂,您可以尝试使用Handsoap http://wiki.github.com/unwire/handsoap/authentication#WS-Security。

#2


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.

Soap4R对于覆盖头非常挑剔。在您的情况下,您需要添加两个“扁平”处理程序(一个用于用户名,另一个用于密码),而不是同时添加两个。

#1


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

看起来您需要对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 http://wiki.github.com/unwire/handsoap/authentication#WS-Security

如果服务不那么复杂,您可以尝试使用Handsoap http://wiki.github.com/unwire/handsoap/authentication#WS-Security。

#2


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.

Soap4R对于覆盖头非常挑剔。在您的情况下,您需要添加两个“扁平”处理程序(一个用于用户名,另一个用于密码),而不是同时添加两个。