mvantellingen / python-zeep

A Python SOAP client
http://docs.python-zeep.org
Other
1.88k stars 586 forks source link

Accept-encoding & Content Encoding #1235

Closed myla-castro closed 3 years ago

myla-castro commented 3 years ago
  1. The version of zeep : 4.0.0
  2. The WSDL you are using : Private WSDL (internal to my organization)

There are times that i need to send large XML attachement and would like to add compression


headers = { "Content-Encoding": "gzip",
            "Accept-Encoding": "gzip,deflate"}

session = requests.Session()
session.headers.update(headers)
transport = Transport(session=session, timeout=10)

client = Client(wsdl, 
                wsse=user_name_token,transport=transport )

resp = client.service.<method>(**requestPayload)

But i am getting this result:

or(self, doc, operation)
    389         # TODO: We should use the fault message as defined in the wsdl.
    390         detail_node = fault_node.find("soap-env:Detail", namespaces=self.nsmap)
--> 391         raise Fault(
    392             message=message,
    393             code=code,

Fault: Not in GZIP format

when i test in SOAPUI it works but not sure how can i zip the soapbody in zeep

myla-castro commented 3 years ago

I managed to implement a workaround by using client.create_message and then send request using requests modules then process result using the code here https://docs.python-zeep.org/en/master/reporting_bugs.html.