I am integration Endicia SOAP and I got this error:
"Missing element %s" % (self.name), path=render_path)
zeep.exceptions.ValidationError: Missing element
Value (GetPostageLabel.LabelRequest.Value)
And here are my code:
import xml.etree.ElementTree as ET
from zeep import Client, Settings, xsd
from zeep.exceptions import Fault, TransportError, XMLSyntaxError
# Set Connection
settings = Settings(strict=False, xml_huge_tree=True)
client = Client(
'https://elstestserver.endicia.com/LabelService/EwsLabelService.asmx?wsdl',
settings=settings)
# Set label request dictionary
requestDictionary = {
"MailClass": 'Priority',
"WeightOz": 16,
"RequesterID": '',
"AccountID": '',
"PassPhrase": '',
"PartnerCustomerID": '100',
"PartnerTransactionID": '200',
"ToName": 'Margaret D Norris',
"ToAddress1": '2461 Romano Street',
"ToCity": 'Cambridge',
"ToState": 'MA',
"ToPostalCode": '02141',
"FromCompany": 'Camilla R Goforth',
"FromName": 'Camilla R Goforth',
"ReturnAddress1": '1670 Oliverio Drive',
"FromCity": 'Satanta',
"FromState": 'KS',
"FromPostalCode": '67870',
"CostCenter":'0'
}
# Try operation
try:
response = client.service.GetPostageLabel(LabelRequest=requestDictionary)
print(response)
except Fault as error:
print(ET.tostring(error.detail))
Can anyone help?
I've tried to change the input data structure but it won't help I expect the output of response = client.service.GetPostageLabel(LabelRequest=requestDictionary)
and print(response)
to be something like it shows on this page .
The documentation you linked says:
RequesterID is required to specify who is making the request.
Your requestDictionary
has an item for RequesterID:
...
"RequesterID": '',
...
Your error is saying
Missing element Value (GetPostageLabel.LabelRequest.Value)
I think you are missing a value for RequesterID.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.