使用soap4r传递空白XSD::QName
我已经重写了 SimpleHandler 以使用soap4r 传递用户名和密码。问题是我被迫提供 QName,这导致结果失败,因为它的格式不正确。
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>
它需要的是这样的:
<env:Header>
<n1:Username>someuser</n1:Username>
<n1:Password>topsecret</n1:Password>
</env:Header>
我如何不传入包含名称?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来您需要对soap4r进行一些更改: http://dev.ctor.org/soap4r/browser/branches/1_5/lib/soap/header/handler.rb
如果服务不是那么复杂,你可以尝试 Handsoap
https://github.com/unwire/handsoap/wiki/authentication#WS-安全
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 对于重写标头非常挑剔。在您的情况下,您需要添加两个“平面”处理程序(一个用于用户名,另一个用于密码),而不是一个同时包含两者的处理程序。
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.