python-3.xexceptionfaultfedexzeep

using Python uploadImages [LetterHead , Signature] on FEDEX got the error : zeep.exceptions.Fault: Fault


Hello I am working on Fedex Web services uaing python and and I want to upload some letterhead and signature on fedex for commercial invoice, I want to print both on invoice , so please help me I am trying but something issue I don't know what I missed.

ERROR:

     File "/.local/lib/python3.8/site-packages/zeep/proxy.py", line 40, in __call__
    return self._proxy._binding.send(
  File "/.local/lib/python3.8/site-packages/zeep/wsdl/bindings/soap.py", line 132, in send
    return self.process_reply(client, operation_obj, response)
  File "/.local/lib/python3.8/site-packages/zeep/wsdl/bindings/soap.py", line 194, in process_reply
    return self.process_error(doc, operation)
  File "/.local/lib/python3.8/site-packages/zeep/wsdl/bindings/soap.py", line 295, in process_error
    raise Fault(
zeep.exceptions.Fault: Fault

    fileContent = open('/src/img/logomin.png', "rb").read()

    fileBase64 = base64.b64encode(fileContent)
    UploadImageDetail = self.factory.UploadImageDetail()
    UploadImageDetail.Id = "IMAGE_1"
    UploadImageDetail.Image = fileBase64
    self.Images.append(UploadImageDetail) 
    self.client.service.uploadImages(
                WebAuthenticationDetail=self.WebAuthenticationDetail,
                ClientDetail=self.ClientDetail,
                TransactionDetail=self.TransactionDetail,
                Version=self.VersionId,
                Images=self.Images,
            )

I used this WSDL


Solution

  •     fileContent = open('/src/img/logomin.png', "rb").read()
    
        #fileBase64 = base64.b64encode(fileContent) not needed
        UploadImageDetail = self.factory.UploadImageDetail()
        UploadImageDetail.Id = "IMAGE_1"
        # fedex is doing encode in base64 so not needed to do
        UploadImageDetail.Image = fileContent 
        self.Images.append(UploadImageDetail) 
        self.client.service.uploadImages(
                    WebAuthenticationDetail=self.WebAuthenticationDetail,
                    ClientDetail=self.ClientDetail,
                    TransactionDetail=self.TransactionDetail,
                    Version=self.VersionId,
                    Images=self.Images,
                )