I'm working on a Python project to use a SOAP API that requires authorization using HTTP Headers with WS Security Basic Authentication. The documentation says that username and password must be "included in the WS-Security Username Token portion of the SOAP header". I'm using zeep and zeep.wsse.username and trying to create a username token to use in the request.
I'm getting this error message:
Traceback (most recent call last): File "/Users/username/Desktop/zeeptesting.py", line 14, in print(client.service.CardListing(body)) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/zeep/proxy.py", line 46, in call return self._proxy._binding.send( File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/zeep/wsdl/bindings/soap.py", line 135, in send return self.process_reply(client, operation_obj, response) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/zeep/wsdl/bindings/soap.py", line 229, in process_reply return self.process_error(doc, operation) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/zeep/wsdl/bindings/soap.py", line 329, in process_error raise Fault( zeep.exceptions.Fault: com.ibm.wsspi.wssecurity.SoapSecurityException: WSEC6521E: Login failed. The exception is : com.ibm.websphere.security.auth.WSLoginFailedException: com.ibm.wsspi.security.auth.callback.WSServletRequestCallback not supported by CallbackHandler to gather authentication information from the usernull
I have gotten this far and I want to get data from the "CardListing", but I keep getting an authentication error and I can't figure out what else to try. It appears that it's not accepting the authentication, but I'm not sure I don't have multiple issues since this is all new to me.
from zeep import Client
from zeep.wsse.username import UsernameToken
body = {'account':'someAccountNum',
'custID':'somCustomerId',
}
username='myUsername'
password= 'myPassword'
wsdl = 'someWSDLuri.wsdl'
endpoint = 'soapEndpointURI'
client = Client(wsdl,wsse=UsernameToken(username,password))
print(client.service.CardListing(body))