3

I'm developing an integration between 2 applications. Application 1 uses HttpClient GetMethod to request from Application 2. Application 2 will return a multipart response with files embedded. I thought this was a simple exercise, but cannot seem to find common support for parsing a multipart response from HTTP GET. How can Application 1 parse the multipart response from Application 2?

Vince
  • 31
  • 1
  • 3
  • 2
    Are you using REST or SOAP? – Tim Biegeleisen Apr 23 '15 at 05:42
  • It's a REST service. I issue a GET, and response returned is multi-part. I did come across this class below, although it looks intended for SOAP, it may work for plain REST. https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html-single/API_Documentation/files/javadoc/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.html – Vince Apr 24 '15 at 05:47
  • There doesn't seem to be a lot of support for this pattern, so I was concerned that this was not the right design. This is a corporate application-to-application integration (EIA), so maybe it's just a matter of not so many people in that domain. – Vince Apr 24 '15 at 05:56
  • I am also stuck with same problem. Have you found any solution for it? – kleash Mar 02 '17 at 06:13

3 Answers3

0

As you are using multi part encode to send the request to the server(Servlet). As multi part encode encrypt all the data in that form you have to decrypt them first and then you can use those values.

Please follow this link.

What does enctype='multipart/form-data' mean?.

Convenient way to parse incoming multipart/form-data parameters in a Servlet.

Community
  • 1
  • 1
Sagar Rout
  • 651
  • 1
  • 12
  • 29
  • 1
    This is a server to server interaction. I am using a HTTP GET where the response comes back in multi-part/form-data. I understand how to parse a multi-part when someone posts that type of request to a servlet as there are many implementations for that. However, receiving multi-part as a response to a GET is a different matter. – Vince Apr 24 '15 at 05:42
0

I was also stuck with same problem. I solved it using javax mail MimeMultiPart. you can see my solution here:- https://stackoverflow.com/a/42548549/5236494

Community
  • 1
  • 1
kleash
  • 1,211
  • 1
  • 12
  • 31
0

For posterity, there is nothing wrong with this pattern even if it is badly supported by HTTP libraries:

https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html

Notice, though that Content-Type isn't multipart/form-data but multipart/mixed but encoding with boundaries between parts is nearly identical.

Bojan Markovic
  • 510
  • 7
  • 22