使用 Savon 将属性传递给 SOAP 请求
我正在使用一个简单的 SOAP Web 服务来获取要包含在 Rails 站点中的一小段 HTML。不幸的是,我对 SOAP 并不是特别熟悉。
我需要在下面的端点上调用 TopHtml() SOAP 方法,但我还需要传递一个 ID 号,如 TopHtml(29)。
我正在使用 Savon gem,我的代码看起来有点像:
response = Savon::Client.new('http://www.xxxxxx.xxx/webservices/services.asmx?wsdl').top_html(29)
它可以工作,但会在未提供 ID 号时返回默认响应。
看来身份证号码没有被传递。有谁知道如何向 Savon SOAP 请求传递参数?
非常感谢, 特里斯坦
I'm consuming a simple SOAP web service to get a small piece of HTML to be included in a Rails site. Unfortunately, I'm not particularly familiar with SOAP.
I need to call the TopHtml() SOAP method on the endpoint below but I need to also pass an ID number like TopHtml(29).
I'm using the Savon gem and my code looks a little something like:
response = Savon::Client.new('http://www.xxxxxx.xxx/webservices/services.asmx?wsdl').top_html(29)
which works but returns the default response for when an ID number was not provided.
It seems that the ID number is not being passed. Does anyone know how to pass parameters to Savon SOAP requests?
Many thanks,
Tristan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试
try
为了节省时间,我最终自己准备了请求 XML,这不太理想(并且几乎违背了使用 Savon 的目的),但这是我正确准备请求的唯一方法。 XML 由服务开发人员提供。
恶心,但我不会再花时间在上面了。
In the interests of time, I ended up preparing the request XML myself which is less than ideal (and almost defeats the purpose of using Savon) but it's the only way I could have the request prepared properly. The XML was provided by the developers of the service.
Yuck but I'm not going to spend anymore time on it.