• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How do i handle a response with SOAP MTOM encoding?

Explorer ,
Feb 20, 2013 Feb 20, 2013

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.

Views

892

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Feb 21, 2013 Feb 21, 2013

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,

...

Votes

Translate

Translate
Explorer ,
Feb 21, 2013 Feb 21, 2013

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation