question

supchainsolutions avatar image
0 Likes"
supchainsolutions asked ·

"Error processing POST request: First Element must contain the local name, Envelope , but found AddItemRequest"

By following the tutorial here: http://developer.ebay.com/DevZone/building-blocks/eBB_AddByProduct.pdf, I'm trying to list a simple item using Python 3.4 (code below). It keeps returning this HTTPError. **What would you do to make the code return the expected response?** **Details about the error:** ERROR: b'

Failed to process the request

Error processing POST request

First Element must contain the local name, Envelope , but found AddItemRequest

Unable to determine wsa:Action for outbound message

' ================================================= sample_xml=open('./sample.xml') data = sample_xml.read() binary_data = data.encode(encoding='ascii') apiCallHeader={} apiCallHeader["Content-Type"]="test/xml" apiCallHeader["X-EBAY-API-COMPATIBILITY-LEVEL"]='863' apiCallHeader["X-EBAY-API-CALL-NAME"]="AddItem" apiCallHeader["X-EBAY-API-SITEID"]= "15" r = urllib.request.Request(" https://api.sandbox.ebay.com/ws/api.dll";, binary_data, apiCallHeader) try: response = urllib.request.urlopen(r) response = response.read() print(response) except urllib.error.HTTPError as e: print("ERROR: ", e.read())
pythonadditem apixml responsepostxmldocumenthttper
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
shulmani_developer.support avatar image
0 Likes"
shulmani_developer.support answered ·
Hi, We suggest that you try the Python Code Sample present here: https://go.developer.ebay.com/developers/eBay/documentation-tools/code-sample/219177 and see if you get it to run. Cheers!!!
· 3 · Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

I followed your suggestion. The code sample works! I compared every line between the sample and my code, and still couldn't reckon what error I had.
0 Likes 0 · ·
Ahhh, I found the error. apiCallHeader["Content-Type"]="text/xml" Should be text/xml not test/xml lol
0 Likes 0 · ·
nice to know that the samples worked and resolved your issue. Cheers!!!
0 Likes 0 · ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.