You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Willem Jiang (JIRA)" <ji...@apache.org> on 2014/12/26 03:23:13 UTC

[jira] [Commented] (CAMEL-8181) Default SOAPMessage to String Converter does not handle Multiparts as expected

    [ https://issues.apache.org/jira/browse/CAMEL-8181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14258896#comment-14258896 ] 

Willem Jiang commented on CAMEL-8181:
-------------------------------------

I don't we need to change the default behaviour of the CxfConverter.soapMessageToString(). If you just want to get the soap part message, you can just set the message body with  message.getSOAPPart(), and Camel convert can do the reset of work for you.
What if the use wants to write the whole soap message into a log file? 

> 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
>            Assignee: Willem Jiang
>            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)