Reputation: 2405
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')
Upvotes: 4
Views: 1457
Reputation: 6983
You should be able to overwrite the endpoint when creating a Savon::Client
instance:
client = Savon::Client.new do
wsdl.document = "https://example.com/Messages.wsdl"
wsdl.endpoint = "https://example.com/service.svc"
end
response = client.request "someAction"
Upvotes: 4