1 year ago
#370810
Harsh
SOAP API - Qname find fails with zeep and xmlsec on x509_data.find(QName(ns.DS, "X509Certificate")).text in centOS75 (python 3.8)
Versions I am using -
zeep==3.4.0
lxml==4.7.1
xmlsec==1.3.8
libxml2 = 2.9.2
Centos75
python 3.8.10
Error detail:
service_1 | Traceback (most recent call last):
service_1 | File "/app/wf_iccp/endpoints/home.py", line 59, in get_data_source_request
service_1 | return get_service(auth_cert=crt, auth_key=key).GetDataSource()
service_1 | File "/pyenv/versions/wf-iccp/lib/python3.8/site-packages/zeep/proxy.py", line 40, in __call__
service_1 | return self._proxy._binding.send(
service_1 | File "/pyenv/versions/wf-iccp/lib/python3.8/site-packages/zeep/wsdl/bindings/soap.py", line 118, in send
service_1 | envelope, http_headers = self._create(
service_1 | File "/pyenv/versions/wf-iccp/lib/python3.8/site-packages/zeep/wsdl/bindings/soap.py", line 95, in _create
service_1 | envelope, http_headers = client.wsse.apply(envelope, http_headers)
service_1 | File "/pyenv/versions/wf-iccp/lib/python3.8/site-packages/zeep/wsse/signature.py", line 104, in apply
service_1 | _sign_envelope_with_key_binary(
service_1 | File "/pyenv/versions/wf-iccp/lib/python3.8/site-packages/zeep/wsse/signature.py", line 287, in _sign_envelope_with_key_binary
service_1 | bintok.text = x509_data.find(QName(ns.DS, "X509Certificate")).text
service_1 | AttributeError: 'NoneType' object has no attribute 'text'
QName prints - and ns.DS below refers to constant
print(QName(ns.DS, "X509Certificate"))
{http://www.w3.org/2000/09/xmldsig#}X509Certificate
xml certificate(I dumped the x509_data) and seems to be there.
<X509Data xmlns="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser1="http://mastercard.com/sd/pc/service" xmlns:ser="http://mastercard.com/sd/pc2/service">
<X509Certificate>
CERTIFICATEVALUE
</X509Certificate>
<X509IssuerSerial>
<X509IssuerName>IUSSER_DETAILS</X509IssuerName>
<X509SerialNumber>SERIALNUMBER</X509SerialNumber>
</X509IssuerSerial>
</X509Data>
It was working before. Not sure what's going on . I tried using different versions of lxml but no luck. Any advice?
Thank you so much!!
lxml
python-3.8
libxml2
zeep
xmlsec
0 Answers
Your Answer