You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2012/09/14 17:20:25 UTC

svn commit: r1384817 - in /camel/branches/camel-2.10.x: ./ components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap11DataFormatAdapter.java components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap12DataFormatAdapter.java

Author: davsclaus
Date: Fri Sep 14 15:20:25 2012
New Revision: 1384817

URL: http://svn.apache.org/viewvc?rev=1384817&view=rev
Log:
Polished

Modified:
    camel/branches/camel-2.10.x/   (props changed)
    camel/branches/camel-2.10.x/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap11DataFormatAdapter.java
    camel/branches/camel-2.10.x/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap12DataFormatAdapter.java

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1384799

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.10.x/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap11DataFormatAdapter.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap11DataFormatAdapter.java?rev=1384817&r1=1384816&r2=1384817&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap11DataFormatAdapter.java (original)
+++ camel/branches/camel-2.10.x/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap11DataFormatAdapter.java Fri Sep 14 15:20:25 2012
@@ -49,9 +49,11 @@ public class Soap11DataFormatAdapter imp
     private static final QName FAULT_CODE_SERVER = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Receiver");
 
     private final SoapJaxbDataFormat dataFormat;
+    private final ObjectFactory objectFactory;
 
     public Soap11DataFormatAdapter(SoapJaxbDataFormat dataFormat) {
         this.dataFormat = dataFormat;
+        this.objectFactory = new ObjectFactory();
     }
 
     public SoapJaxbDataFormat getDataFormat() {
@@ -60,8 +62,8 @@ public class Soap11DataFormatAdapter imp
 
     @Override
     public Object doMarshal(Exchange exchange, Object inputObject, OutputStream stream, String soapAction) throws IOException {
-        Body body = new Body();
-        Header header = new Header();
+        Body body = objectFactory.createBody();
+        Header header = objectFactory.createHeader();
 
         Throwable exception = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
         if (exception == null) {
@@ -88,7 +90,7 @@ public class Soap11DataFormatAdapter imp
             envelope.setHeader(header);
         }
         envelope.setBody(body);
-        JAXBElement<Envelope> envelopeEl = new ObjectFactory().createEnvelope(envelope);
+        JAXBElement<Envelope> envelopeEl = objectFactory.createEnvelope(envelope);
         return envelopeEl;
     }
 
@@ -174,8 +176,7 @@ public class Soap11DataFormatAdapter imp
      * WebFault annotation of the Exception class. If no fault detail is set the
      * a RuntimeCamelException is created.
      * 
-     * @param fault
-     *            Soap fault
+     * @param fault Soap fault
      * @return created Exception
      */
     private Exception createExceptionFromFault(Fault fault) {

Modified: camel/branches/camel-2.10.x/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap12DataFormatAdapter.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap12DataFormatAdapter.java?rev=1384817&r1=1384816&r2=1384817&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap12DataFormatAdapter.java (original)
+++ camel/branches/camel-2.10.x/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap12DataFormatAdapter.java Fri Sep 14 15:20:25 2012
@@ -52,9 +52,11 @@ public class Soap12DataFormatAdapter imp
     private static final QName FAULT_CODE_SERVER = new QName("http://www.w3.org/2003/05/soap-envelope", "Receiver");
 
     private final SoapJaxbDataFormat dataFormat;
+    private final ObjectFactory objectFactory;
 
     public Soap12DataFormatAdapter(SoapJaxbDataFormat dataFormat) {
         this.dataFormat = dataFormat;
+        this.objectFactory = new ObjectFactory();
     }
 
     public SoapJaxbDataFormat getDataFormat() {
@@ -63,8 +65,8 @@ public class Soap12DataFormatAdapter imp
 
     @Override
     public Object doMarshal(Exchange exchange, Object inputObject, OutputStream stream, String soapAction) throws IOException {
-        Body body = new Body();
-        Header header = new Header();
+        Body body = objectFactory.createBody();
+        Header header = objectFactory.createHeader();
 
         Throwable exception = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
         if (exception == null) {
@@ -91,7 +93,7 @@ public class Soap12DataFormatAdapter imp
             envelope.setHeader(header);
         }
         envelope.setBody(body);
-        JAXBElement<Envelope> envelopeEl = new ObjectFactory().createEnvelope(envelope);
+        JAXBElement<Envelope> envelopeEl = objectFactory.createEnvelope(envelope);
         return envelopeEl;
     }
 
@@ -185,8 +187,7 @@ public class Soap12DataFormatAdapter imp
      * WebFault annotation of the Exception class. If no fault detail is set the
      * a RuntimeCamelException is created.
      * 
-     * @param fault
-     *            Soap fault
+     * @param fault Soap fault
      * @return created Exception
      */
     private Exception createExceptionFromFault(Fault fault) {