0

Is there a way to print out or store a wsdl file that requires an authentication using python zeep? I need to download and edit the wsdl file in order to replace some URLs with a proxy. Therefore, I would like to store the wsdl file locally for editing.

A direct download, e.g. wget https:///example.com/my.wsdl is not possible.

Using the terminal command for inspecting a wsdl file does not provide any authentication methods: python -mzeep wsdl_link

Accessing a web service works well, but the XML structure of the complete wsdl is not accessible. At least I don't know how search the API and documentation for this.

from zeep import Client
from requests import Session
from requests.auth import HTTPBasicAuth
from zeep.transports import Transport
session = Session()
session.auth = HTTPBasicAuth('my_user', 'my_password')
wsdl = 'https:///example.com/my.wsdl' 
client = Client(wsdl=wsdl, transport=Transport(session=session))
for service in client.wsdl.services.values():
    print("service:", service.name)

user3072843
  • 308
  • 3
  • 13
  • instead of changing the wsdl, you may create proxy using `zeep` – Tarique Nov 27 '20 at 11:14
  • Do you mean a session.proxy like [this](https://stackoverflow.com/questions/47195778/unable-to-connect-to-soap-api-with-proxy-setting)? How do I access the WSDL afterwards? – user3072843 Dec 10 '20 at 14:21
  • No. I meant to use `Client.create_service()` method. Full details: https://docs.python-zeep.org/en/master/client.html#the-serviceproxy-object – Tarique Dec 10 '20 at 17:07
  • 1
    Oh, this is interesting. In the meantime I managed to get the WSDL-file using `wget --user=... --password=... ` – user3072843 Dec 10 '20 at 20:52

0 Answers0