I replaced suds SOAP client with zeep's SOAP client, and I'm struggling to figure out several things. 1st: I had this code of suds client initialization:
client.Client(
wsdl_path,
transport=suds_requests.RequestsTransport(session),
plugins=[LogSOAPMessages()],
cache=NoCache(),
location="https://<serverIP>/MYWS/MYWSDispatch.pl"
)
I'm struggling to understand how should I replace the 'location' kwarg in the zeep's client init function.
2nd: currently the new zeep's Client initialization is as described here:
Client(
wsdl_path,
transport=Transport(session=session),
plugins=[LogSOAPMessages(), WsAddressingPlugin()]
)
and the first API call to login looks like this:
client.service.authenticate(
username=self.user,
password=self.password,
)
In suds it worked, but after replaced with zeep it raises this error:
zeep.exceptions.ValidationError: Missing element MYWSHeader (authenticate.MYWSHeader)
,
but I can seem to find a solution or the reason to this new error.
why is it happening and how can I fix it?
EDIT: seems like adding MYWSHeader to the request solved the issue, for some reason it wasn't necessary in suds request, even though after inspecting the XML I saw it was required. this new request worked:
client.service.authenticate(
MYWSHeader={'key1':'','key2':''}
username=self.user,
password=self.password,
)