Author: ningjiang
Date: Thu Jun 14 08:05:14 2012
New Revision: 1350118
URL: http://svn.apache.org/viewvc?rev=1350118&view=rev
Log:
Clean up the code of CxfConverter
Modified:
camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java
Modified:
camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java?rev=1350118&r1=1350117&r2=1350118&view=diff
==============================================================================
---
camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java
(original)
+++
camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java
Thu Jun 14 08:05:14 2012
@@ -17,12 +17,14 @@
package org.apache.camel.component.cxf.converter;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.ws.rs.core.Response;
import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import org.apache.camel.Converter;
@@ -31,6 +33,7 @@ import org.apache.camel.FallbackConverte
import org.apache.camel.TypeConverter;
import org.apache.camel.component.cxf.DataFormat;
import org.apache.camel.spi.TypeConverterRegistry;
+import org.apache.camel.util.IOHelper;
import org.apache.cxf.common.classloader.ClassLoaderUtils;
import org.apache.cxf.message.MessageContentsList;
import org.slf4j.Logger;
@@ -96,14 +99,10 @@ public final class CxfConverter {
}
@Converter
- public static String soapMessageToString(final SOAPMessage soapMessage) {
+ public static String soapMessageToString(final SOAPMessage soapMessage,
Exchange exchange) throws SOAPException, IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try {
- soapMessage.writeTo(baos);
- } catch (Exception e) {
- LOG.error("Get the exception when converting the SOAPMessage into
String, the exception is " + e);
- }
- return baos.toString();
+ soapMessage.writeTo(baos);
+ return baos.toString(IOHelper.getCharsetName(exchange));
}
@Converter