在 RoR 中使用 SOAP Web 服务
我们正在尝试在 RoR 中使用 SOAP Web 服务。使用 SOAP::WSDLDriverFactory 和以下代码:
wsdl = SOAP::WSDLDriverFactory.new("http://<domain>/WSDL/v4.0/iLON100.WSDL")
proxy = wsdl.create_rpc_driver
proxy.get({:iLonItem => [{:Item => {:UCPTname => "Net/LON/Motion406"}}]})
获取服务上的参数通过以下 XML 表示:
<Get xmlns="http://wsdl.echelon.com/web_services_ns/ilon100/v4.0/message/">
<iLonItem>
<Item xsi:type="LON_Network_Cfg">
<UCPTname>MyNetwork</UCPTname>
</Item>
</iLonItem>
</Get>
但我不断收到此错误:nil not allowed: UCPTname
We are trying to consume a SOAP Web service in RoR. using SOAP::WSDLDriverFactory with the following code:
wsdl = SOAP::WSDLDriverFactory.new("http://<domain>/WSDL/v4.0/iLON100.WSDL")
proxy = wsdl.create_rpc_driver
proxy.get({:iLonItem => [{:Item => {:UCPTname => "Net/LON/Motion406"}}]})
The parameter on the get service is represented through the following XML:
<Get xmlns="http://wsdl.echelon.com/web_services_ns/ilon100/v4.0/message/">
<iLonItem>
<Item xsi:type="LON_Network_Cfg">
<UCPTname>MyNetwork</UCPTname>
</Item>
</iLonItem>
</Get>
But I keep getting this error: nil not allowed: UCPTname
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
终于解决了这个问题,感谢 proxy.wiredump_dev = $stdout,我能够嗅探 SOAP 响应/请求。
上面 xml 上的哈希值相当于
I am such a noob in Ruby!
Finally solved it, thanks to
proxy.wiredump_dev = $stdout
, I was able to sniff around the SOAP response/request.The hash equivalent on the xml above is
I am such a noob in Ruby!
未使用 SOAP::WSDLDriverFactory - 但我使用过 Savon。
您是否有另一种/有效的方式来调用该方法,例如 soapUI ?
然后我使用 Charles 之类的东西来比较通过 Savon 和 SoapUI 发送的消息,看看有什么区别......
HTH,克里斯
Not used SOAP::WSDLDriverFactory - but I have used Savon.
Do you have another/working way to call the method, eg soapUI ?
I then use something like Charles to compare the message sent via Savon and soapUI to see what the difference is...
HTH, Chris