Copy link to clipboard
Copied
I'm trying to build a module to utilize the eBay large merchant services API and I've hit a major road block.
I decided to start out by implementing a request for active listings. I've got the basic functions working
to start the export job and get a file ID to download. I can make the download request just fine but the
filecontent comes back as an object of java.io.ByteArrayOutputStream and I'm not exactly sure what to do with it.
It's supposed to be XML content with a zip file attached.
The toString result shows that it's Content-Type: application/xop+xml. and it looks like it's delimited by
a mime boundary. This encoding is a little new to me but I gather it's a more optimized way of packaging the
binary data with an XML response.
The problem is separating out the binary attachment from the XML part.
I found this Blog Post
where he ended up suggesting using the underlying java getByteArray function but that still doesn't seperate the
XML from the attachment and after that i don't know what to do with the byte array.
This is running on IIS7 / CF8 fully patched.
In case anybody else has this issue i figgured out a way to get it working for a zip file at least. Just gotta take the
getByteArray result from the returned filecontent and write that out with cffile. This writes out a file with the soap header
still inside along with the actual binary file contents. So now you have a somewhat correct file with extra junk in the headers.
Fortunitly i found that winrar will still open this file and let me get the contents out of it just fine.
So there you have it,
...Copy link to clipboard
Copied
In case anybody else has this issue i figgured out a way to get it working for a zip file at least. Just gotta take the
getByteArray result from the returned filecontent and write that out with cffile. This writes out a file with the soap header
still inside along with the actual binary file contents. So now you have a somewhat correct file with extra junk in the headers.
Fortunitly i found that winrar will still open this file and let me get the contents out of it just fine.
So there you have it, pretty funky workaround but it will have to do.