Rest2Soap with multipart/related message

54 views
Skip to first unread message

ach...@gmail.com

unread,
Apr 4, 2016, 12:27:33 PM4/4/16
to membrane-monitor
Hello,

I am running the rest2soap interceptor from the example folder with a different webservice and I get a SaxParseException with "Content is not allowed in prolog." error.

The point is that I receive a multipart/related message and the body does not get decoded.Thus the xslt engine cannot parse it.

How can I solve the issue? I read that there was a bug related to this issue and that It was solved. But I still get the exception.

I am using version 4.2.0 of membrane service proxy.

Thanks in advance.

Agostino 

Thomas Bayer

unread,
Apr 4, 2016, 1:00:52 PM4/4/16
to membrane...@googlegroups.com
Hi,
what is the use case for a multipart message?

Cheers,
Thomas

Am 04.04.16 um 18:24 schrieb ach...@gmail.com:
--
You received this message because you are subscribed to the Google Groups "membrane-monitor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to membrane-monit...@googlegroups.com.
To post to this group, send email to membrane...@googlegroups.com.
Visit this group at https://groups.google.com/group/membrane-monitor.
For more options, visit https://groups.google.com/d/optout.

Agostino Chiosi

unread,
Apr 4, 2016, 1:59:51 PM4/4/16
to membrane...@googlegroups.com
Hi Thomas,

actually there is no specific use case for the multipart message, the message contains only text/xml but I cannot modify the content-type received from the server (which is exactly the following: multipart/related; boundary=MIME_Boundary;  start="<0.urn:uuid:B75BFC6627C480A...@apache.org>";  type="text/xml" leading to the exception)  

Thanks
Agostino


--
You received this message because you are subscribed to a topic in the Google Groups "membrane-monitor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/membrane-monitor/NmRbwq14EuM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to membrane-monit...@googlegroups.com.

Thomas Bayer

unread,
Apr 4, 2016, 3:07:43 PM4/4/16
to membrane...@googlegroups.com
Hi Agostino,
you get the multipart message back from the SOAP server? Looks like Apache Axis 1. If there is no binary content inside the SOAP messages you can deactivate multipart messages on the server using a config opion. But I do not know if you have access to the server.

Cheers,
Thomas

Am 04.04.16 um 19:13 schrieb Agostino Chiosi:

Agostino Chiosi

unread,
Apr 5, 2016, 8:18:42 AM4/5/16
to membrane...@googlegroups.com
Hi Thomas,

that's correct, I get the multipart message back from the SOAP server and I do not have access to it. The server is a Jetty(version 6.1.26).

Is there a way to decode the message using the rest2soap interceptor?

Many thanks
Agostino

Tobias Polley

unread,
Apr 5, 2016, 8:26:19 AM4/5/16
to membrane-monitor
Hi Agostino,

Membrane 4.2 should be able to parse the multipart/related (XOP) body format you described. If it does not, it is a bug.

The rest2soap Feature does the correct thing by calling getBodyAsStreamDecoded() (see https://github.com/membrane/service-proxy/blob/3b2035ef0bb5676cc4509b274649d877b85f45c8/core/src/main/java/com/predic8/membrane/core/interceptor/rest/REST2SOAPInterceptor.java#L219 ). So it does look like a bug, probably in the multipart detection.

Could you please add a <log headerOnly="false"/> after your <rest2Soap> and send us the log output of a failed response?

<rest2Soap>...</rest2Soap>
<log headerOnly="false" />

Best
Tobias

Agostino Chiosi

unread,
Apr 5, 2016, 9:42:41 AM4/5/16
to membrane...@googlegroups.com
Hi,

please find the log here attached.

Let me know if you need more information.

Thank you
Agostino

--
output.log

Agostino Chiosi

unread,
Apr 5, 2016, 10:13:47 AM4/5/16
to membrane...@googlegroups.com
Hi,
the attached log looks better.
Thank you.
Agostino
output2.log

Tobias Polley

unread,
Apr 7, 2016, 3:29:16 AM4/7/16
to membrane-monitor
Hi Agostino,

awesome, thank you very much for the log!

As expected, Membrane does not recognize the response as XOP. For this, partially your message and partially Membrane bugs are to blame.

For the time being, appending the following section seems to solve the issue for your message:

<rest2Soap>
...
</rest2Soap>

<response>
<!-- Message from backend does not conform to https://www.w3.org/TR/xop10/#identifying_xop_documents (media type parameter "type" is required, see also RFC 2392 Section 2) -->
<groovy>exc.response.header.setValue('Content-type', exc.response.header.getFirstValue('Content-type') + 'type="application/xop+xml";')</groovy>
<!-- Message from backend does not conform to https://www.w3.org/TR/xop10/#mime_xop_packages -->
<regExReplacer regex="Content-Type: text/xml" replace="Content-Type: application/xop+xml" />
<!-- Membrane bug in Header.getMediaTypeParameters() -->
<regExReplacer regex="\r\n" replace="" target="header" />
<!-- probably a Membrane bug: does Membrane implement the specification correctly when comparing Content-IDs? Membrane does string comparison, probably URL comparison is reqired. See RFC 2392. -->
<regExReplacer regex="urn: uuid" replace="urn:uuid" target="header" />
</response>

Please let me know whether this works.

Best,
Tobias

Agostino Chiosi

unread,
Apr 11, 2016, 10:39:22 AM4/11/16
to membrane...@googlegroups.com
Hi Tobias,

thank you very much for your analysis and feedback.

Unfortunately it seems that the regExReplacer lines targeting the header do not work.
I could solve the issue with the following configuration:

<rest2Soap>
...
</rest2Soap>
<response>
<groovy>
exc.response.header.setValue('Content-type', exc.response.header.getFirstValue('Content-type') + ' type="application/xop+xml";' + '&#x9;start=&quot;&lt;0.urn:' + exc.response.header.getFirstValue('&#x9;start=&quot;&lt;0.urn'))

exc.response.header.removeFields('&#x9;start="&lt;0.urn') 

</groovy>

<regExReplacer regex="Content-Type: text/xml" replace="Content-Type: application/xop+xml" />

</response>


The parameter start="<0.urn:uuid:B75BFC6627C480A...@apache.org>" has a tab in front of it and gets recognized as a different header.
I also tried with adding <regExReplacer regex="\t" replace="" target="header" /> to what you proposed but was not working.

Can you please suggest how can I apply the groovy script and the regExReplacer only to a specific soapURI so that they do not get applied to other mappings I can have for the same rest2Soap interceptor/service proxy?

Thank you!
Agostino



--
Reply all
Reply to author
Forward
0 new messages