0

I am trying the below code but I get the zeep.exceptions.Fault: null error

from zeep import Client
from zeep.transports import Transport
from requests_ntlm import HttpNtlmAuth
from requests import Session
session = Session()
username = ""
password = ""
url = ""
session.auth = HttpNtlmAuth(username,password)
transport = Transport(session=session)
client = Client(url,transport=transport)
client.service.CI_Z_SP_PERS_DTL_CI_G(EMPLID="001670")
ganan
  • 1
  • 3
  • Welcome to SO. Please add the following to the question: (1) What are you trying to achieve? (2) The full Traceback error message. (3) What should be the expected output (4) Is `CI_Z_SP_PERS_DTL_CI_G` a valid SOAP service, (please consult the official docs for the SOAP API)? – amanb Mar 13 '19 at 11:20
  • Traceback (most recentcall):File "/usr/local/lib/python2.7/dist-packages/zeep/proxy.py", line 42, in __call__ self._op_name, args, kwargs) File "/usr/local/lib/python2.7/dist-packages/zeep/wsdl/bindings/soap.py", line 132, in send return self.process_reply(client, operation_obj, response) File "/usr/local/lib/python2.7/dist-packages/zeep/wsdl/bindings/soap.py", line 194, in process_reply return self.process_error(doc, operation) File "/usr/local/lib/python2.7/dist-packages/zeep/wsdl/bindings/soap.py", line 299, in process_error detail=fault_node.find('detail')) zeep.exceptions.Fault: null – ganan Mar 13 '19 at 11:27
  • i read official docs of zeep and i have applied all the http connection methods i am getting the same error in all methods – ganan Mar 13 '19 at 11:32
  • I've just added few steps to debug this error as an answer. Please post what you get from the `print` statements(when the exception is caught), in your question. – amanb Mar 13 '19 at 11:52
  • try: ... client = Client(url,transport=transport) ... client.service.CI_Z_SP_PERS_DTL_CI_G(EMPLID="001670") ... except Exception as e: ... print(e.message) exception message is null only – ganan Mar 13 '19 at 12:08
  • after try and except block i get exception message as null only – ganan Mar 13 '19 at 12:09
  • What is the output for the other `print` statements? You should consider upgrading to the latest version of zeep as some bugs are fixed with every version upgrade. I also noticed that your Python env is 2.7. Its best to use Python 3.x as Python 2.7 support has been phasing out for many libraries, although this may not be the sole reason for this issue. – amanb Mar 13 '19 at 12:21

1 Answers1

1

This is not an answer but the following way could help capture the source of the error in your code. To get the actual error causing line/snippet in your code, you can use a try/except block and catch the error:

#<---code--->
try:
    session.auth = HttpNtlmAuth(username,password)
    transport = Transport(session=session)
    client = Client(url,transport=transport)
    client.service.CI_Z_SP_PERS_DTL_CI_G(EMPLID="001670")
except zeep.exceptions.Fault as fault:
    print fault.message
    print fault.code
    print fault.actor

OR

except zeep.exceptions.Fault as fault:
    print fault.__dict__

This will help debug where exactly the error is occuring.

amanb
  • 5,276
  • 3
  • 19
  • 38
  • Please share exact output of all print statements. – amanb Mar 13 '19 at 12:28
  • It is the output of print fault.__dict__ {'message': 'null', 'code': 'SOAP-ENV:Server', 'subcodes': None, 'detail': , 'actor': None} – ganan Mar 13 '19 at 12:38