使用 Savon 手动组装 SOAP 标头

发布于 2024-11-17 16:33:06 字数 488 浏览 2 评论 0原文

使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

叹梦 2024-11-24 16:33:06

这可能是由于您尚未设置任何值造成的。

当我返回一个仅包含一个自定义对象的哈希时,我收到此错误,因为它试图访问已自动删除的哈希部分。 (它为我删除了不必要的哈希层:@)

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 :@)

痴情换悲伤 2024-11-24 16:33:06

我相信标头只会接受来自 savon.rb 页面的哈希值:

Besides the body element, SOAP requests can also contain a header with
additional information. Savon sees this header as just another Hash following
the same conventions as the SOAP body Hash.

soap.header = { "SecretKey" => "secret" }

I believe the header will only accept a Hash - from the savon.rb page:

Besides the body element, SOAP requests can also contain a header with
additional information. Savon sees this header as just another Hash following
the same conventions as the SOAP body Hash.

soap.header = { "SecretKey" => "secret" }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文