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

[jira] [Updated] (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: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 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

  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, looking something like this:

{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 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


> 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 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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)