question

aebike avatar image
0 Likes"
aebike asked ·

Large Merchant Services uploadFile file format

I am trying to work through the (very confusing) LMS documentation to make an uploadFile call. I've adopted [this][1] StackOverflow answer to create my call, but I can't get anything other than a "Please specify a File with Valid Format" error 11. I am building the AddFixedPriceItem XML in memory, gzipping, base 64 encoding, and attaching to the uploadFile request. Full request is below. Does this error only indicate problems in the encoding/attachment, or could it mean errors in the BulkDataExchangeRequests gzipped XML itself? -----------START----------- POST https://storage.sandbox.ebay.com/FileTransferService Accept-Encoding: gzip, deflate X-EBAY-SOA-OPERATION-NAME: uploadFile Accept: */* X-EBAY-SOA-SERVICE-VERSION: 1.1.0 X-EBAY-SOA-SERVICE-NAME: FileTransferService Content-Length: 3936 Connection: keep-alive Content-Type: multipart/related; boundary=MIME_boundary; type="application/xop+xml"; start="<0.urn:uuid:b2e95d5c-54ed-46ad-b479-fed744f2b8ca>"; start-info="text/xml" User-Agent: python-requests/2.5.1 CPython/3.3.4 Darwin/14.0.0 X-EBAY-SOA-SECURITY-TOKEN: **MYSANDBOXTOKEN** --MIME_boundary Content-Type: application/xop+xml; charset=UTF-8; type="text/xml; charset=UTF-8" Content-Transfer_Encoding: binary Content-ID: <0.urn:uuid:b2e95d5c-54ed-46ad-b479-fed744f2b8ca> 50008909051 50009059491 gzip 3121 --MIME_boundary Content-Type: application/octet-stream Content-Transfer-Encoding: base64 Content-ID: H4sIALnxy1QC/60YaXPixvL7/go9f8l7S9biFmxpVU9c5gZzm1QqNWgGaUAH1owA+denR+IQttkkVdkqLzN9X9 **... MORE ENCODED DATA ....** PZ/vc0wdv/LK3Rj3bRphsdvlxJT+c58l0olS58V7G1JiQXaioJin7Iu/frHXwTk+//fvgnOnxkwFsUAAA= --MIME_boundary-- [1]: http://stackoverflow.com/questions/8482135/http-post-request-and-headers-with-mime-attachments-multipart-related-and-xop
lmslms-uploadfile-error
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.

piedmont_red_clothing avatar image
0 Likes"
piedmont_red_clothing answered ·
Super frustrating! Somehow I am messing up with zipped XML file.. It keeps telling me its in the wrong format.. Just crazy.. Oh well, thanks for the help! Wish me luck
· 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.

aebike avatar image
0 Likes"
aebike answered ·
*Converting to an answer because comment was too long @piedmont_red_clothing Unfortunately I have no worked with this API since I solved my problem almost a year ago. Well, fortunately for me, since it is the most frustrating API I've ever encountered. As I recall, there are two XML files, there's the uploadFile XML, which includes an encoded version of a bulk file XML (for me full of addFixedPricedItem calls). The uploadFile XML shown at the top of the thread should be pretty darn close to my final version. Are you just looking for confirmation of that? Or do you also need the bulk XML that is then encoded? Also, did you check the blog post? [ https://medium.com/on-coding/dont-write-your-api-this-way-a1b745078b94#.muov601ym]. That was super helpful to me.
· 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.

piedmont_red_clothing avatar image
0 Likes"
piedmont_red_clothing answered ·
@aebike Would you mind posting your finished XML for the rest of us schlubs?? The uploadFile XML.. I can't get past the invalid format error.. This API is crazy.. My big question is where in the world did you or the Stackoverflow poster figure out that 3 UUID's were needed?? Wow.. But if you could post it, it would be a huge help! Thanks Todd
· 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.

davidtsadler avatar image
0 Likes"
davidtsadler answered ·
Have to admit to never having used python before so it's a bit new to me. I've had [success]( http://cgi.sandbox.ebay.com/ws/eBayISAPI.dll?ViewItem⁢em=110155915068&ssPageName=STRK:MESE:IT#ht_500wt_1156) using the [library]( https://github.com/wrhansen/eBay-LMS-API/blob/master/lmslib.py) that you have previously tried and this [example code]( https://github.com/wrhansen/eBay-LMS-API/blob/master/examples/api_test.py). I've attached the files that I used and the very small changes that I made to the original code are below. - [Changed ReviseItem to AddFixedPriceItem]( https://github.com/wrhansen/eBay-LMS-API/blob/master/examples/api_test.py#L28) - The Version element on Line 9 of your [XML]( http://pastebin.com/BukrR04x) has been swapped with line 8. You will need to edit *sb_credentials.json* with your sandbox API credentials before running * api_test.py*

lms.zip (8.6 KiB)
· 2 · 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.

Thanks for bringing this to my attention. I assumed that since my version of his code (modified to work in Django and for Python 3) worked with his example XML, that there would be no difference in how they handle my own XML. Very perplexing, but at least it gives me a new lead to track down.
0 Likes 0 · ·
Turns out the culprit was the binary data vs. base64 encoding after all. The github repo is based on python2 which does not differentiate between strings and binary data. Once I was able to convert my code to send the raw binary (work shown in more detail on Stackoverflow linked above), my version worked the same as his. I consider this to be something of a bug in the API, but at least I am past it now. Thanks for your help.
0 Likes 0 · ·
aebike avatar image
0 Likes"
aebike answered ·
Well I solved it, kind of. I did need to end up using the base64 encoding, and a different method of gzipping the file, but I am able to get a Success on both a test file and my own AddFixedPriceItems file. **However** I can only get it to work if I leave out large blocks of the call that otherwise work when sent outside of LMS, and it's inconsistent. My data file can be seen [here][1]. If I attach this file, it fails. However, if I delete lines 41-61, it succeeds. If I put those lines back in and delete lines 65-82, it also succeeds. I don't know what to think about this and it makes LMS seem almost unusable. Is there rhyme or reason to why this might be? [1]: http://pastebin.com/BukrR04x
· 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.

aebike avatar image
0 Likes"
aebike answered ·
Still no luck on this. I posted the question along with my most recent changes to the call at [StackOverflow][1] in the hopes of getting some more eyeballs on it. [1]: http://stackoverflow.com/questions/28444150/ebay-lms-uploadfile-cannot-specify-file-with-valid-format
· 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.

davidtsadler avatar image
0 Likes"
davidtsadler answered ·
You don't need the attachment to be base64 encoded. Just include the gzipped XML as binary. Make sure that you also change `Content-Transfer-Encoding: base64` to `Content-Transfer-Encoding: binary` . If anyone is interested the upload file format is [XML-binary Optimized Packaging]( http://www.w3.org/TR/xop10/), or simply [XOP]( http://en.wikipedia.org/wiki/XML-binary_Optimized_Packaging), which allows you to mix binary with XML without the need to base64 encode the binary. *(Base64 encoding adds an approximately 33% overhead to the request size)*
· 2 · 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.

Thanks for the info. I tried what you suggested (replaced the encoded gzipped XML with just gzipped XML binary stream, and changed the Content-Transfer-Encoding header) and I am getting the same error as before.
0 Likes 0 · ·
@davidtsadler Pinging you in hopes that you will see my most recent addition with a new iteration of the problem (not the comment above, the answer I posted a moment ago on the main thread)
0 Likes 0 · ·
shulmani_developer.support avatar image
0 Likes"
shulmani_developer.support answered ·
Hi, Can you please give us the JobID? cheers!!
· 4 · 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.

Sure thing, the job ID is 50008909051
0 Likes 0 · ·
Looks like this job is in the aborted state. I don't see any issues with what you are doing. But there maybe something that I may have missed. Just check this knowledge base article: https://ebaydts.com/eBayKBDetails?KBid=2029 Cheers!!!!
0 Likes 0 · ·
aebike avatar image aebike shulmani_developer.support ♦♦ ·
Yeah, I've looked at that KB article and it seems to only apply to one specific problem (mis-matching UUIDs). I'm kind of at a loss.
0 Likes 0 · ·
Could you check out my most recent answer on the main thread? I've passed the main hurdle, but hit another (hopefully more minor) one
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.