Douglas Plumley
Douglas Plumley

Reputation: 565

Python Zeep - Multiple WSDL Files

I have two separate WSDL files that are provided to me to interact with a service, one WSDL file just provides a method to login and generate an access token. The other WSDL file provides the methods to actually interact with the system.

If I instantiate the zeep SOAP client with the first WSDL file to login do I need to reinstantiate the client for the next WSDL file or can I simply tell it to go look at the next WSDL file?

from zeep import Client

client = Client("https://url.service.com/Session?wsdl")
token = client.service.login(username, password)

client = Client("https://url.service.com/Object?wsdl")
client.service.find(token, 'filter')

I attempted to use create_service but I don't think I'm using it correctly.

Thank you!

Upvotes: 3

Views: 1299

Answers (1)

Jostein L
Jostein L

Reputation: 344

You need to reinstantiate the second Client.

I expect that you also need to extend your code to use the same requests Session and Zeeps Transport.

from requests import Session
from zeep import Client
from zeep.transports import Transport

transport = Transport(session=Session())

client = Client("https://url.service.com/Session?wsdl", transport=transport)
token = client.service.login(username, password)

client = Client("https://url.service.com/Object?wsdl", transport=transport)
client.service.find(token, 'filter')

Upvotes: 2

Related Questions