Ruby Savon 绑定问题
我正在使用 Savon 来使用 Web 服务,并且 WSDL 带有 2 个绑定。如何指定在 Savon 中使用哪个绑定?其中之一是 http
,另一个是 https。
我正在尝试使用 https
服务。
有关 wsdl 的信息
<wsdl:service name="ExampleService">
<wsdl:port name="ES" binding="tns:ES">
<soap:address location="http://example.com/service.svc"/>
</wsdl:port>
<wsdl:port name="ES1" binding="tns:ES1">
<soap:address location="https://example.com/service.svc"/>
</wsdl:port>
</wsdl:service>
我如何使用 ES1?我现在使用 savon 的代码是
require 'savon'
require 'httpclient'
wsdl = "https://example.com/Messages.wsdl"
driver = Savon::Client.new(wsdl)
response = driver.request "someAction"
当我使用soap4r时,我可以使用以下代码选择绑定:
require 'httpclient'
require 'soap/wsdlDriver'
wsdl = "https://example.com/Messages.wsdl"
soap_client = SOAP::WSDLDriverFactory.new(wsdl)
driver = soap_client.create_rpc_driver('ExampleService','ES1')
I am consuming webservices with Savon and the WSDL comes with 2 bindings. How do I specify which binding to use in Savon? One of them is http
and the other one is https.
I am trying to use the https
service.
The information on wsdl
<wsdl:service name="ExampleService">
<wsdl:port name="ES" binding="tns:ES">
<soap:address location="http://example.com/service.svc"/>
</wsdl:port>
<wsdl:port name="ES1" binding="tns:ES1">
<soap:address location="https://example.com/service.svc"/>
</wsdl:port>
</wsdl:service>
How do i use ES1? The code I am using now with savon is
require 'savon'
require 'httpclient'
wsdl = "https://example.com/Messages.wsdl"
driver = Savon::Client.new(wsdl)
response = driver.request "someAction"
When I am using soap4r, I can choose the binding using the following code:
require 'httpclient'
require 'soap/wsdlDriver'
wsdl = "https://example.com/Messages.wsdl"
soap_client = SOAP::WSDLDriverFactory.new(wsdl)
driver = soap_client.create_rpc_driver('ExampleService','ES1')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建
Savon::Client
实例时,您应该能够覆盖端点:You should be able to overwrite the endpoint when creating a
Savon::Client
instance: