使用 Savon 手动组装 SOAP 标头
使用 Savon 提交 SOAP 请求时,我一直在处理“soap 消息头不正确”错误消息。
我将 Savon 生成的完全相同的 xml 复制/粘贴到 SOAPUI 中,但没有收到该错误,并且得到了预期的响应。
因此,由于我厌倦了尝试不同的事情,所以我想在没有 Savon 帮助的情况下组装自己的标头。
我想做的是这样的:
soap.header = "<wbs:Session><wbs:SessionId></wbs:SessionId><wbs:SequenceNumber></wbs:SequenceNumber></wbs:Session>"
但是我从 Savon 收到此错误:
无法将符号转换为字符串
为什么?
先感谢您。
I've been dealing with a "soap message header incorrect" error message when submiting a SOAP request using Savon.
I copy/pasted the exact same xml generated by Savon into SOAPUI and I don't get that error and I get the expected response.
So, since I'm tired of trying different things, I want to assemble my own header without Savon help on that.
What I want to do is something like:
soap.header = "<wbs:Session><wbs:SessionId></wbs:SessionId><wbs:SequenceNumber></wbs:SequenceNumber></wbs:Session>"
However I get this error from Savon:
can't convert Symbol into String
Why?
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可能是由于您尚未设置任何值造成的。
当我返回一个仅包含一个自定义对象的哈希时,我收到此错误,因为它试图访问已自动删除的哈希部分。 (它为我删除了不必要的哈希层:@)
Its likely caused by the fact you havent set any values.
I was getting this error when I had a hash containing just one custom object on return, as it was trying to access parts of the hash that had automatically been removed. (it removed unnesscary layer of hash for me :@)
我相信标头只会接受来自 savon.rb 页面的哈希值:
I believe the header will only accept a Hash - from the savon.rb page: