[
https://issues.apache.org/jira/browse/CAMEL-8181?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
David Atkins updated CAMEL-8181:
--------------------------------
Description:
The default SOAPMessage to String converter in
org.apache.camel.component.cxf.converter.CxfConverter uses the
SoapMessage#writeTo method to convert it to a String. But when receiving a
multipart (e.g. when using MTOM) this provides all of the message parts,
instead of just the message body as expected, resulting in something like the
following appearing on the Exchange Body:
{code}
------=_Part_0_715152323.1390739632718
Content-Type: text/xml; charset=utf-8
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:rep="http://reportincident.example.camel.apache.org">
<soapenv:Header>
</soapenv:Header>
<soapenv:Body>
<rep:inputReportIncident>
<incidentId>?</incidentId>
<incidentDate>?</incidentDate>
<givenName>?</givenName>
<familyName>?</familyName>
<summary>?</summary>
<details>?</details>
<email>?</email>
<phone>?</phone>
</rep:inputReportIncident>
</soapenv:Body>
</soapenv:Envelope>
------=_Part_0_715152323.1390739632718
Content-Type: application/octet-stream; name=error.log
Content-Disposition: attachment; name="error.log"; filename="error.log"
Content-Transfer-Encoding: binary
Content-ID: <error.log>
file content here
{code}
I can't think of a useful use case for having the message in this format,
especially as the attachments are correctly added to the Exchange's Attachment
Map
I believe the converter should only convert the initial Part to a String,
rather than the whole message. Something like this:
{code}
return XMLUtils.toString(new DOMSource(message.getSOAPPart()));
{code}
I'll try and find some time to create a patch next week
Note that this is documented in the following Redhat support case :
https://access.redhat.com/solutions/740703 from a customer support issue I
raised a while back
was:
The default SOAPMessage to String converter in
org.apache.camel.component.cxf.converter.CxfConverter uses the
SoapMessage#writeTo method to convert it to a String. But when receiving a
multipart (e.g. when using MTOM) this provides all of the message parts,
instead of just the message body as expected, resulting in something like the
following appearing on the Exchange Body:
{code}
------=_Part_0_715152323.1390739632718
Content-Type: text/xml; charset=utf-8
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:rep="http://reportincident.example.camel.apache.org">
<soapenv:Header>
</soapenv:Header>
<soapenv:Body>
<rep:inputReportIncident>
<incidentId>?</incidentId>
<incidentDate>?</incidentDate>
<givenName>?</givenName>
<familyName>?</familyName>
<summary>?</summary>
<details>?</details>
<email>?</email>
<phone>?</phone>
</rep:inputReportIncident>
</soapenv:Body>
</soapenv:Envelope>
------=_Part_0_715152323.1390739632718
Content-Type: application/octet-stream; name=error.log
Content-Disposition: attachment; name="error.log"; filename="error.log"
Content-Transfer-Encoding: binary
Content-ID: <error.log>
file content here
{code}
I can't think of a useful use case for having the message in this format,
especially as the attachments are correctly added to the Exchange's Attachment
Map
I believe the converter should only convert the initial Part to a String,
rather than the whole message. Something like this:
{code}
return XMLUtils.toString(new DOMSource(message.getSOAPPart()));
{code}
I'll look at creating a unit test/patch to resolve.
Note that this is documented in the following Redhat support case :
https://access.redhat.com/solutions/740703 from a customer support issue I
raised a while back
> Default SOAPMessage to String Converter does not handle Multiparts as expected
> ------------------------------------------------------------------------------
>
> Key: CAMEL-8181
> URL: https://issues.apache.org/jira/browse/CAMEL-8181
> Project: Camel
> Issue Type: Bug
> Components: camel-cxf
> Affects Versions: 2.14.1
> Reporter: David Atkins
> Priority: Minor
>
> The default SOAPMessage to String converter in
> org.apache.camel.component.cxf.converter.CxfConverter uses the
> SoapMessage#writeTo method to convert it to a String. But when receiving a
> multipart (e.g. when using MTOM) this provides all of the message parts,
> instead of just the message body as expected, resulting in something like the
> following appearing on the Exchange Body:
> {code}
> ------=_Part_0_715152323.1390739632718
> Content-Type: text/xml; charset=utf-8
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:rep="http://reportincident.example.camel.apache.org">
> <soapenv:Header>
> </soapenv:Header>
> <soapenv:Body>
> <rep:inputReportIncident>
> <incidentId>?</incidentId>
> <incidentDate>?</incidentDate>
> <givenName>?</givenName>
> <familyName>?</familyName>
> <summary>?</summary>
> <details>?</details>
> <email>?</email>
> <phone>?</phone>
> </rep:inputReportIncident>
> </soapenv:Body>
> </soapenv:Envelope>
> ------=_Part_0_715152323.1390739632718
> Content-Type: application/octet-stream; name=error.log
> Content-Disposition: attachment; name="error.log"; filename="error.log"
> Content-Transfer-Encoding: binary
> Content-ID: <error.log>
> file content here
> {code}
> I can't think of a useful use case for having the message in this format,
> especially as the attachments are correctly added to the Exchange's
> Attachment Map
> I believe the converter should only convert the initial Part to a String,
> rather than the whole message. Something like this:
> {code}
> return XMLUtils.toString(new DOMSource(message.getSOAPPart()));
> {code}
> I'll try and find some time to create a patch next week
> Note that this is documented in the following Redhat support case :
> https://access.redhat.com/solutions/740703 from a customer support issue I
> raised a while back
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)