Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 548
Douglas Plumley Avatar asked Nov 06 '25 23:11

Douglas Plumley


1 Answers

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')
like image 165
Jostein L Avatar answered Nov 08 '25 15:11

Jostein L



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!