You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2011/08/04 12:19:53 UTC

svn commit: r1153829 - in /camel/trunk/components/camel-soap/src: main/java/org/apache/camel/dataformat/soap/SoapJaxbDataFormat.java test/resources/org/apache/camel/dataformat/soap/SoapSpringRoundtripTest-context.xml

Author: ningjiang
Date: Thu Aug  4 10:19:52 2011
New Revision: 1153829

URL: http://svn.apache.org/viewvc?rev=1153829&view=rev
Log:
CAMEL-4254 Fixed the issue of Missing setter or constructor-argument for elementNameStrategyRef in SoapJaxbDataFormat

Modified:
    camel/trunk/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/SoapJaxbDataFormat.java
    camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/dataformat/soap/SoapSpringRoundtripTest-context.xml

Modified: camel/trunk/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/SoapJaxbDataFormat.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/SoapJaxbDataFormat.java?rev=1153829&r1=1153828&r2=1153829&view=diff
==============================================================================
--- camel/trunk/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/SoapJaxbDataFormat.java (original)
+++ camel/trunk/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/SoapJaxbDataFormat.java Thu Aug  4 10:19:52 2011
@@ -93,9 +93,9 @@ public class SoapJaxbDataFormat extends 
     /**
      * Initialize the data format. The serviceInterface is necessary to
      * determine the element name and namespace of the element inside the soap
-     * body when marshaling
+     * body when marshalling
      * 
-     * @param jaxbPackage
+     * @param contextPath
      *            package for JAXB context
      * @param serviceInterface
      *            webservice interface
@@ -104,6 +104,21 @@ public class SoapJaxbDataFormat extends 
         this(contextPath);
         this.elementNameStrategy = elementNameStrategy;
     }
+    
+    /**
+     * Initialize the data format. The serviceInterface is necessary to
+     * determine the element name and namespace of the element inside the soap
+     * body when marshalling
+     * 
+     * @param contextPath
+     *            package for JAXB context
+     * @param elementNameStrategyRef
+     *            webservice interface referenced bean name
+     */
+    public SoapJaxbDataFormat(String contextPath, String elementNameStrategyRef) {
+        this(contextPath);
+        this.elementNameStrategyRef = elementNameStrategyRef;
+    }
 
     public void setElementNameStrategy(Object nameStrategy) {
         if (nameStrategy instanceof ElementNameStrategy) {
@@ -346,6 +361,7 @@ public class SoapJaxbDataFormat extends 
      * Unmarshal a given SOAP xml stream and return the content of the SOAP body
      */
     public Object unmarshal(Exchange exchange, InputStream stream) throws IOException {
+        checkElementNameStrategy(exchange);
         
         String soapAction = getSoapActionFromExchange(exchange);
         
@@ -471,5 +487,10 @@ public class SoapJaxbDataFormat extends 
     public void setElementNameStrategy(ElementNameStrategy elementNameStrategy) {
         this.elementNameStrategy = elementNameStrategy;
     }
+    
+    public void setElementNameStrategyRef(String nameStrategyRef) {
+        this.elementNameStrategyRef = nameStrategyRef;
+    }
 
 }
+

Modified: camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/dataformat/soap/SoapSpringRoundtripTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/dataformat/soap/SoapSpringRoundtripTest-context.xml?rev=1153829&r1=1153828&r2=1153829&view=diff
==============================================================================
--- camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/dataformat/soap/SoapSpringRoundtripTest-context.xml (original)
+++ camel/trunk/components/camel-soap/src/test/resources/org/apache/camel/dataformat/soap/SoapSpringRoundtripTest-context.xml Thu Aug  4 10:19:52 2011
@@ -21,6 +21,12 @@
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
+    
+    <!-- Defining a ServiceInterfaceStrategy for retrieving the element name when marshalling -->
+    <bean id="myNameStrategy" class="org.apache.camel.dataformat.soap.name.ServiceInterfaceStrategy">
+    	<constructor-arg value="com.example.customerservice.CustomerService"/>
+		<constructor-arg value="true"/>
+    </bean>
 
     <!-- START SNIPPET: e1 -->
     <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
@@ -41,3 +47,4 @@
     <!-- END SNIPPET: e1 -->
 
 </beans>
+