I have to consume data from a SOAP service, which is a new technology for me. I connected from the server using the following code:
from requests import Session
from requests.auth import HTTPBasicAuth
from zeep import Client
from zeep.transports import Transport
wsdl= 'my_service.com/MEX?wsdl'
username = 'john_doe'
password = 'password'
session = Session()
session.auth = HTTPBasicAuth(username, password)
transport = Transport(session=session)
client = Client(wsdl=wsdl, transport=transport)
Using SoapUi software and connecting with this server I realized that it has three bindings and each one has a lot of Webservices. But, with Python, I was able only to access the WebServices (via client.service) for the first binding. I want to know how can I access the Webservice methods from another two bindings.
OBS: client.wsdl.bindings return a dict mapping some urls containing the binding names seen on SoapUI to Soap11Binding instances.
By default,
Zeep
picks up the first binding in the WSDL. This binding is available viaclient.service
. To use a specific binding you can use thebind()
method on the client object sample code: