axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prad...@apache.org
Subject svn commit: r829832 - in /webservices/axis2/trunk/java/modules/addressing: src/org/apache/axis2/handlers/addressing/ test-resources/ test/org/apache/axis2/handlers/addressing/
Date Mon, 26 Oct 2009 15:43:43 GMT
Author: pradine
Date: Mon Oct 26 15:43:42 2009
New Revision: 829832

URL: http://svn.apache.org/viewvc?rev=829832&view=rev
Log:
Applying patch for jira issue AXIS2-4536.

Added:
    webservices/axis2/trunk/java/modules/addressing/test-resources/addressingDisabledTest.xml   (with props)
    webservices/axis2/trunk/java/modules/addressing/test-resources/addressingEnabledTest.xml   (with props)
    webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-IncludeOptionalHeadersFalse.xml   (with props)
    webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-IncludeOptionalHeadersTrue.xml   (with props)
    webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-disableAddressingForOutMessagesFalse.xml   (with props)
    webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-disableAddressingForOutMessagesTrue.xml   (with props)
    webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-noParameters.xml   (with props)
    webservices/axis2/trunk/java/modules/addressing/test-resources/withOptionalHeadersTest.xml   (with props)
Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
    webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java?rev=829832&r1=829831&r2=829832&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java Mon Oct 26 15:43:42 2009
@@ -41,6 +41,7 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisEndpoint;
 import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
 import org.apache.axis2.handlers.AbstractHandler;
 import org.apache.axis2.util.JavaUtils;
 import org.apache.axis2.util.LoggingControl;
@@ -64,11 +65,12 @@
     
     public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
         //determine whether outbound addressing has been disabled or not.
+        // Get default value from module.xml or axis2.xml files
+        Parameter param = msgContext.getModuleParameter(
+                DISABLE_ADDRESSING_FOR_OUT_MESSAGES, MODULE_NAME, handlerDesc);
         boolean disableAddressing =
-            msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES)
-             || JavaUtils.isTrueExplicitly(Utils.getParameterValue(
-                     msgContext.getModuleParameter(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
-                     MODULE_NAME, handlerDesc)));
+            msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
+                    JavaUtils.isTrueExplicitly(Utils.getParameterValue(param)));
 
         if (disableAddressing) {
             if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
@@ -88,11 +90,12 @@
                 Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt);
 
         // Determine whether to include optional addressing headers in the output.
+        // Get default value from module.xml or axis2.xml files
+        param = msgContext.getModuleParameter(
+                INCLUDE_OPTIONAL_HEADERS, MODULE_NAME, handlerDesc);
         boolean includeOptionalHeaders =
-            msgContext.isPropertyTrue(INCLUDE_OPTIONAL_HEADERS)
-             || JavaUtils.isTrueExplicitly(Utils.getParameterValue(
-                     msgContext.getModuleParameter(INCLUDE_OPTIONAL_HEADERS, MODULE_NAME,
-                     handlerDesc)));
+            msgContext.isPropertyTrue(INCLUDE_OPTIONAL_HEADERS,
+                    JavaUtils.isTrueExplicitly(Utils.getParameterValue(param)));
 
         if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
             log.debug("includeOptionalHeaders=" + includeOptionalHeaders);

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/addressingDisabledTest.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test-resources/addressingDisabledTest.xml?rev=829832&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/addressingDisabledTest.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/addressingDisabledTest.xml Mon Oct 26 15:43:42 2009
@@ -0,0 +1,25 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+	<soapenv:Header>
+		<test:testHeader xmlns:test="http://test.com" />
+	</soapenv:Header>
+	<soapenv:Body />
+</soapenv:Envelope>
\ No newline at end of file

Propchange: webservices/axis2/trunk/java/modules/addressing/test-resources/addressingDisabledTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/addressingEnabledTest.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test-resources/addressingEnabledTest.xml?rev=829832&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/addressingEnabledTest.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/addressingEnabledTest.xml Mon Oct 26 15:43:42 2009
@@ -0,0 +1,31 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+	<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
+		<wsa:To>http://www.to.org/service/</wsa:To>
+		<wsa:From><wsa:Address>http://www.from.org/service/</wsa:Address></wsa:From>
+		<wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/</wsa:Address></wsa:ReplyTo>
+		<wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/</wsa:Address></wsa:FaultTo>
+		<wsa:Action>http://www.actions.org/action</wsa:Action>
+		<wsa:MessageID>123456-7890</wsa:MessageID>
+		<wsa:RelatesTo>http://www.relatesTo.org/service/</wsa:RelatesTo>
+	</soapenv:Header>
+	<soapenv:Body />
+</soapenv:Envelope>
\ No newline at end of file

Propchange: webservices/axis2/trunk/java/modules/addressing/test-resources/addressingEnabledTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-IncludeOptionalHeadersFalse.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-IncludeOptionalHeadersFalse.xml?rev=829832&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-IncludeOptionalHeadersFalse.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-IncludeOptionalHeadersFalse.xml Mon Oct 26 15:43:42 2009
@@ -0,0 +1,132 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<axisconfig name="AxisJava2.0">
+    <!-- ================================================= -->
+    <!-- Global Modules  -->
+    <!-- ================================================= -->
+    <!-- Comment this to disable Addressing -->
+    <module ref="addressing"/>
+
+    <!--Configuring module , providing parameters for modules whether they refer or not-->
+    <moduleConfig name="addressing">
+        <parameter name="includeOptionalHeaders">false</parameter>
+    </moduleConfig>
+    
+    <!-- ================================================= -->
+    <!-- Phases  -->
+    <!-- ================================================= -->
+    <phaseOrder type="InFlow">
+        <!--  System predefined phases       -->
+        <phase name="Transport">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
+                <order phase="Transport"/>
+            </handler>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
+                <order phase="Transport"/>
+            </handler>
+        </phase>
+        <phase name="Addressing">
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                <order phase="Addressing"/>
+            </handler>
+        </phase>
+        <phase name="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+            <handler name="RequestURIOperationDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+            <handler name="HTTPLocationBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+            <handler name="GenericProviderDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
+            <handler name="MustUnderstandValidationDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
+        </phase>
+        <phase name="RMPhase"/>
+        <!--  System predefined phases       -->
+        <!--   After Postdispatch phase module author or service author can add any phase he want      -->
+        <phase name="OperationInPhase">
+            <handler name="MustUnderstandChecker"
+                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
+                <order phase="OperationInPhase"/>
+            </handler>
+        </phase>
+        <phase name="soapmonitorPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFlow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="soapmonitorPhase"/>
+        <phase name="OperationOutPhase"/>
+        <!--system predefined phase-->
+        <!--these phase will run irrespective of the service-->
+        <phase name="RMPhase"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+        <phase name="Security"/>
+    </phaseOrder>
+    <phaseOrder type="InFaultFlow">
+        <phase name="Addressing">
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                <order phase="Addressing"/>
+            </handler>
+        </phase>
+        <phase name="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+            <handler name="RequestURIOperationDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+            <handler name="HTTPLocationBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+            <handler name="GenericProviderDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
+            <handler name="MustUnderstandValidationDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
+        </phase>
+        <phase name="RMPhase"/>
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationInFaultPhase"/>
+        <phase name="soapmonitorPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFaultFlow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="soapmonitorPhase"/>
+        <phase name="OperationOutFaultPhase"/>
+        <phase name="RMPhase"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+        <phase name="Security"/>
+    </phaseOrder>
+</axisconfig>
\ No newline at end of file

Propchange: webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-IncludeOptionalHeadersFalse.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-IncludeOptionalHeadersTrue.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-IncludeOptionalHeadersTrue.xml?rev=829832&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-IncludeOptionalHeadersTrue.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-IncludeOptionalHeadersTrue.xml Mon Oct 26 15:43:42 2009
@@ -0,0 +1,132 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<axisconfig name="AxisJava2.0">
+    <!-- ================================================= -->
+    <!-- Global Modules  -->
+    <!-- ================================================= -->
+    <!-- Comment this to disable Addressing -->
+    <module ref="addressing"/>
+
+    <!--Configuring module , providing parameters for modules whether they refer or not-->
+    <moduleConfig name="addressing">
+        <parameter name="includeOptionalHeaders">true</parameter>
+    </moduleConfig>
+    
+    <!-- ================================================= -->
+    <!-- Phases  -->
+    <!-- ================================================= -->
+    <phaseOrder type="InFlow">
+        <!--  System predefined phases       -->
+        <phase name="Transport">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
+                <order phase="Transport"/>
+            </handler>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
+                <order phase="Transport"/>
+            </handler>
+        </phase>
+        <phase name="Addressing">
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                <order phase="Addressing"/>
+            </handler>
+        </phase>
+        <phase name="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+            <handler name="RequestURIOperationDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+            <handler name="HTTPLocationBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+            <handler name="GenericProviderDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
+            <handler name="MustUnderstandValidationDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
+        </phase>
+        <phase name="RMPhase"/>
+        <!--  System predefined phases       -->
+        <!--   After Postdispatch phase module author or service author can add any phase he want      -->
+        <phase name="OperationInPhase">
+            <handler name="MustUnderstandChecker"
+                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
+                <order phase="OperationInPhase"/>
+            </handler>
+        </phase>
+        <phase name="soapmonitorPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFlow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="soapmonitorPhase"/>
+        <phase name="OperationOutPhase"/>
+        <!--system predefined phase-->
+        <!--these phase will run irrespective of the service-->
+        <phase name="RMPhase"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+        <phase name="Security"/>
+    </phaseOrder>
+    <phaseOrder type="InFaultFlow">
+        <phase name="Addressing">
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                <order phase="Addressing"/>
+            </handler>
+        </phase>
+        <phase name="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+            <handler name="RequestURIOperationDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+            <handler name="HTTPLocationBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+            <handler name="GenericProviderDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
+            <handler name="MustUnderstandValidationDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
+        </phase>
+        <phase name="RMPhase"/>
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationInFaultPhase"/>
+        <phase name="soapmonitorPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFaultFlow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="soapmonitorPhase"/>
+        <phase name="OperationOutFaultPhase"/>
+        <phase name="RMPhase"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+        <phase name="Security"/>
+    </phaseOrder>
+</axisconfig>
\ No newline at end of file

Propchange: webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-IncludeOptionalHeadersTrue.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-disableAddressingForOutMessagesFalse.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-disableAddressingForOutMessagesFalse.xml?rev=829832&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-disableAddressingForOutMessagesFalse.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-disableAddressingForOutMessagesFalse.xml Mon Oct 26 15:43:42 2009
@@ -0,0 +1,132 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<axisconfig name="AxisJava2.0">
+    <!-- ================================================= -->
+    <!-- Global Modules  -->
+    <!-- ================================================= -->
+    <!-- Comment this to disable Addressing -->
+    <module ref="addressing"/>
+
+    <!--Configuring module , providing parameters for modules whether they refer or not-->
+    <moduleConfig name="addressing">
+        <parameter name="disableAddressingForOutMessages">false</parameter>
+    </moduleConfig>
+    
+    <!-- ================================================= -->
+    <!-- Phases  -->
+    <!-- ================================================= -->
+    <phaseOrder type="InFlow">
+        <!--  System predefined phases       -->
+        <phase name="Transport">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
+                <order phase="Transport"/>
+            </handler>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
+                <order phase="Transport"/>
+            </handler>
+        </phase>
+        <phase name="Addressing">
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                <order phase="Addressing"/>
+            </handler>
+        </phase>
+        <phase name="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+            <handler name="RequestURIOperationDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+            <handler name="HTTPLocationBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+            <handler name="GenericProviderDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
+            <handler name="MustUnderstandValidationDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
+        </phase>
+        <phase name="RMPhase"/>
+        <!--  System predefined phases       -->
+        <!--   After Postdispatch phase module author or service author can add any phase he want      -->
+        <phase name="OperationInPhase">
+            <handler name="MustUnderstandChecker"
+                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
+                <order phase="OperationInPhase"/>
+            </handler>
+        </phase>
+        <phase name="soapmonitorPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFlow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="soapmonitorPhase"/>
+        <phase name="OperationOutPhase"/>
+        <!--system predefined phase-->
+        <!--these phase will run irrespective of the service-->
+        <phase name="RMPhase"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+        <phase name="Security"/>
+    </phaseOrder>
+    <phaseOrder type="InFaultFlow">
+        <phase name="Addressing">
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                <order phase="Addressing"/>
+            </handler>
+        </phase>
+        <phase name="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+            <handler name="RequestURIOperationDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+            <handler name="HTTPLocationBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+            <handler name="GenericProviderDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
+            <handler name="MustUnderstandValidationDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
+        </phase>
+        <phase name="RMPhase"/>
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationInFaultPhase"/>
+        <phase name="soapmonitorPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFaultFlow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="soapmonitorPhase"/>
+        <phase name="OperationOutFaultPhase"/>
+        <phase name="RMPhase"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+        <phase name="Security"/>
+    </phaseOrder>
+</axisconfig>
\ No newline at end of file

Propchange: webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-disableAddressingForOutMessagesFalse.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-disableAddressingForOutMessagesTrue.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-disableAddressingForOutMessagesTrue.xml?rev=829832&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-disableAddressingForOutMessagesTrue.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-disableAddressingForOutMessagesTrue.xml Mon Oct 26 15:43:42 2009
@@ -0,0 +1,132 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<axisconfig name="AxisJava2.0">
+    <!-- ================================================= -->
+    <!-- Global Modules  -->
+    <!-- ================================================= -->
+    <!-- Comment this to disable Addressing -->
+    <module ref="addressing"/>
+
+    <!--Configuring module , providing parameters for modules whether they refer or not-->
+    <moduleConfig name="addressing">
+        <parameter name="disableAddressingForOutMessages">true</parameter>
+    </moduleConfig>
+    
+    <!-- ================================================= -->
+    <!-- Phases  -->
+    <!-- ================================================= -->
+    <phaseOrder type="InFlow">
+        <!--  System predefined phases       -->
+        <phase name="Transport">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
+                <order phase="Transport"/>
+            </handler>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
+                <order phase="Transport"/>
+            </handler>
+        </phase>
+        <phase name="Addressing">
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                <order phase="Addressing"/>
+            </handler>
+        </phase>
+        <phase name="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+            <handler name="RequestURIOperationDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+            <handler name="HTTPLocationBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+            <handler name="GenericProviderDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
+            <handler name="MustUnderstandValidationDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
+        </phase>
+        <phase name="RMPhase"/>
+        <!--  System predefined phases       -->
+        <!--   After Postdispatch phase module author or service author can add any phase he want      -->
+        <phase name="OperationInPhase">
+            <handler name="MustUnderstandChecker"
+                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
+                <order phase="OperationInPhase"/>
+            </handler>
+        </phase>
+        <phase name="soapmonitorPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFlow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="soapmonitorPhase"/>
+        <phase name="OperationOutPhase"/>
+        <!--system predefined phase-->
+        <!--these phase will run irrespective of the service-->
+        <phase name="RMPhase"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+        <phase name="Security"/>
+    </phaseOrder>
+    <phaseOrder type="InFaultFlow">
+        <phase name="Addressing">
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                <order phase="Addressing"/>
+            </handler>
+        </phase>
+        <phase name="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+            <handler name="RequestURIOperationDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+            <handler name="HTTPLocationBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+            <handler name="GenericProviderDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
+            <handler name="MustUnderstandValidationDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
+        </phase>
+        <phase name="RMPhase"/>
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationInFaultPhase"/>
+        <phase name="soapmonitorPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFaultFlow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="soapmonitorPhase"/>
+        <phase name="OperationOutFaultPhase"/>
+        <phase name="RMPhase"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+        <phase name="Security"/>
+    </phaseOrder>
+</axisconfig>
\ No newline at end of file

Propchange: webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-disableAddressingForOutMessagesTrue.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-noParameters.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-noParameters.xml?rev=829832&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-noParameters.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-noParameters.xml Mon Oct 26 15:43:42 2009
@@ -0,0 +1,121 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<axisconfig name="AxisJava2.0">
+    <!-- ================================================= -->
+    <!-- Phases  -->
+    <!-- ================================================= -->
+    <phaseOrder type="InFlow">
+        <!--  System predefined phases       -->
+        <phase name="Transport">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
+                <order phase="Transport"/>
+            </handler>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
+                <order phase="Transport"/>
+            </handler>
+        </phase>
+        <phase name="Addressing">
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                <order phase="Addressing"/>
+            </handler>
+        </phase>
+        <phase name="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+            <handler name="RequestURIOperationDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+            <handler name="HTTPLocationBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+            <handler name="GenericProviderDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
+            <handler name="MustUnderstandValidationDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
+        </phase>
+        <phase name="RMPhase"/>
+        <!--  System predefined phases       -->
+        <!--   After Postdispatch phase module author or service author can add any phase he want      -->
+        <phase name="OperationInPhase">
+            <handler name="MustUnderstandChecker"
+                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
+                <order phase="OperationInPhase"/>
+            </handler>
+        </phase>
+        <phase name="soapmonitorPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFlow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="soapmonitorPhase"/>
+        <phase name="OperationOutPhase"/>
+        <!--system predefined phase-->
+        <!--these phase will run irrespective of the service-->
+        <phase name="RMPhase"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+        <phase name="Security"/>
+    </phaseOrder>
+    <phaseOrder type="InFaultFlow">
+        <phase name="Addressing">
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                <order phase="Addressing"/>
+            </handler>
+        </phase>
+        <phase name="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+            <handler name="RequestURIOperationDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+            <handler name="HTTPLocationBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+            <handler name="GenericProviderDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
+            <handler name="MustUnderstandValidationDispatcher"
+                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
+        </phase>
+        <phase name="RMPhase"/>
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationInFaultPhase"/>
+        <phase name="soapmonitorPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFaultFlow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="soapmonitorPhase"/>
+        <phase name="OperationOutFaultPhase"/>
+        <phase name="RMPhase"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+        <phase name="Security"/>
+    </phaseOrder>
+</axisconfig>
\ No newline at end of file

Propchange: webservices/axis2/trunk/java/modules/addressing/test-resources/axis2-noParameters.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/withOptionalHeadersTest.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test-resources/withOptionalHeadersTest.xml?rev=829832&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/withOptionalHeadersTest.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/withOptionalHeadersTest.xml Mon Oct 26 15:43:42 2009
@@ -0,0 +1,31 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+	<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
+		<wsa:To>http://www.to.org/service/</wsa:To>
+		<wsa:From><wsa:Address>http://www.from.org/service/</wsa:Address></wsa:From>
+		<wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/</wsa:Address></wsa:ReplyTo>
+		<wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/</wsa:Address></wsa:FaultTo>
+		<wsa:Action>http://www.actions.org/action</wsa:Action>
+		<wsa:MessageID>123456-7890</wsa:MessageID>
+		<wsa:RelatesTo RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.relatesTo.org/service/</wsa:RelatesTo>
+	</soapenv:Header>
+	<soapenv:Body />
+</soapenv:Envelope>
\ No newline at end of file

Propchange: webservices/axis2/trunk/java/modules/addressing/test-resources/withOptionalHeadersTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java?rev=829832&r1=829831&r2=829832&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java Mon Oct 26 15:43:42 2009
@@ -23,6 +23,7 @@
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.impl.OMNamespaceImpl;
 import org.apache.axiom.om.impl.llom.util.XMLComparator;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.SOAPFactory;
@@ -34,11 +35,17 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisModule;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.handlers.util.TestUtil;
 
 import javax.xml.namespace.QName;
+
+import java.io.File;
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 
 public class AddressingOutHandlerTest extends TestCase implements AddressingConstants {
     private AddressingOutHandler outHandler;
@@ -399,4 +406,236 @@
         }
         assertEquals("Both reply and custom should be found.", 2, i);
     }
+    
+    public void testAxis2DisableAddressingForOutMessagesTrue() throws Exception {
+        File configFile = new File(System.getProperty("basedir",".") +
+                "/test-resources/axis2-disableAddressingForOutMessagesTrue.xml");
+        ConfigurationContext cfgCtx = ConfigurationContextFactory
+        .createConfigurationContextFromFileSystem("target/test-classes",
+                configFile.getAbsolutePath());
+        
+        msgCtxt = cfgCtx.createMessageContext();
+        
+        // Need to add a SOAP Header to stop this error from XMLComparator:
+        // "There is no Header element under Envelope"
+        SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
+        SOAPHeaderBlock soapHeaderBlock = envelope.getHeader().addHeaderBlock(
+                "testHeader", new OMNamespaceImpl("http://test.com", "test"));
+        msgCtxt.setEnvelope(envelope);
+        
+        outHandler.invoke(msgCtxt);
+
+        XMLComparator xmlComparator = new XMLComparator();
+        assertTrue(xmlComparator.compare(msgCtxt.getEnvelope(), testUtil
+                .getOMBuilder("addressingDisabledTest.xml")
+                .getDocumentElement()));   
+    }
+    
+    public void testAxis2DisableAddressingForOutMessagesFalse() throws Exception {
+        File configFile = new File(System.getProperty("basedir",".") +
+                "/test-resources/axis2-disableAddressingForOutMessagesFalse.xml");
+        ConfigurationContext cfgCtx = ConfigurationContextFactory
+        .createConfigurationContextFromFileSystem("target/test-classes",
+                configFile.getAbsolutePath());
+        
+        msgCtxt = cfgCtx.createMessageContext();
+        msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
+        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
+        msgCtxt.setFrom(new EndpointReference("http://www.from.org/service/"));
+        msgCtxt.setReplyTo(new EndpointReference("http://www.replyTo.org/service/"));
+        msgCtxt.setFaultTo(new EndpointReference("http://www.faultTo.org/service/"));
+        msgCtxt.setWSAAction("http://www.actions.org/action");
+        msgCtxt.setMessageID("123456-7890");
+        msgCtxt.addRelatesTo(new RelatesTo("http://www.relatesTo.org/service/"));
+        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);
+        
+        outHandler.invoke(msgCtxt);
+
+        XMLComparator xmlComparator = new XMLComparator();
+        assertTrue(xmlComparator.compare(msgCtxt.getEnvelope(), testUtil
+                .getOMBuilder("addressingEnabledTest.xml")
+                .getDocumentElement()));   
+    }
+    
+    public void testAxis2IncludeOptionalHeadersTrue() throws Exception {
+        File configFile = new File(System.getProperty("basedir",".") +
+                "/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
+        ConfigurationContext cfgCtx = ConfigurationContextFactory
+        .createConfigurationContextFromFileSystem("target/test-classes",
+                configFile.getAbsolutePath());
+        
+        msgCtxt = cfgCtx.createMessageContext();
+        msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
+        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
+        msgCtxt.setFrom(new EndpointReference("http://www.from.org/service/"));
+        msgCtxt.setReplyTo(new EndpointReference("http://www.replyTo.org/service/"));
+        msgCtxt.setFaultTo(new EndpointReference("http://www.faultTo.org/service/"));
+        msgCtxt.setWSAAction("http://www.actions.org/action");
+        msgCtxt.setMessageID("123456-7890");
+        msgCtxt.addRelatesTo(new RelatesTo("http://www.relatesTo.org/service/"));
+        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);
+        
+        outHandler.invoke(msgCtxt);
+
+        XMLComparator xmlComparator = new XMLComparator();
+        assertTrue(xmlComparator.compare(msgCtxt.getEnvelope(), testUtil
+                .getOMBuilder("withOptionalHeadersTest.xml")
+                .getDocumentElement()));   
+    }
+    
+    public void testAxis2IncludeOptionalHeadersFalse() throws Exception {
+        File configFile = new File(System.getProperty("basedir",".") +
+                "/test-resources/axis2-IncludeOptionalHeadersFalse.xml");
+        ConfigurationContext cfgCtx = ConfigurationContextFactory
+        .createConfigurationContextFromFileSystem("target/test-classes",
+                configFile.getAbsolutePath());
+        
+        msgCtxt = cfgCtx.createMessageContext();
+        msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
+        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
+        msgCtxt.setFrom(new EndpointReference("http://www.from.org/service/"));
+        msgCtxt.setReplyTo(new EndpointReference("http://www.replyTo.org/service/"));
+        msgCtxt.setFaultTo(new EndpointReference("http://www.faultTo.org/service/"));
+        msgCtxt.setWSAAction("http://www.actions.org/action");
+        msgCtxt.setMessageID("123456-7890");
+        msgCtxt.addRelatesTo(new RelatesTo("http://www.relatesTo.org/service/"));
+        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);
+        
+        outHandler.invoke(msgCtxt);
+
+        XMLComparator xmlComparator = new XMLComparator();
+        assertTrue(xmlComparator.compare(msgCtxt.getEnvelope(), testUtil
+                .getOMBuilder("addressingEnabledTest.xml")
+                .getDocumentElement()));   
+    }
+    
+    public void testModuleDisableAddressingForOutMessagesTrue() throws Exception {
+        File configFile = new File(System.getProperty("basedir",".") + 
+                "/test-resources/axis2-noParameters.xml");
+        ConfigurationContext cfgCtx = ConfigurationContextFactory
+        .createConfigurationContextFromFileSystem("target/test-classes",
+                configFile.getAbsolutePath());
+        AxisConfiguration config = cfgCtx.getAxisConfiguration();
+        
+        // Can't test with a module.xml file in test-resources because it gets
+        // overridden by target\classes\META-INF\module.xml, so create our own
+        // AxisModule with the required parameter value
+        AxisModule module = config.getModule("addressing");
+        module.addParameter(new Parameter("disableAddressingForOutMessages", "true"));
+        
+        msgCtxt = cfgCtx.createMessageContext();
+        
+        // Need to add a SOAP Header to stop this error from XMLComparator:
+        // "There is no Header element under Envelope"
+        SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
+        SOAPHeaderBlock soapHeaderBlock = envelope.getHeader().addHeaderBlock(
+                "testHeader", new OMNamespaceImpl("http://test.com", "test"));
+        msgCtxt.setEnvelope(envelope);
+        
+        outHandler.invoke(msgCtxt);
+
+        XMLComparator xmlComparator = new XMLComparator();
+        assertTrue(xmlComparator.compare(msgCtxt.getEnvelope(), testUtil
+                .getOMBuilder("addressingDisabledTest.xml")
+                .getDocumentElement()));
+    }
+    
+    public void testModuleDisableAddressingForOutMessagesFalse() throws Exception {
+        File configFile = new File(System.getProperty("basedir",".") + 
+                "/test-resources/axis2-noParameters.xml");
+        ConfigurationContext cfgCtx = ConfigurationContextFactory
+        .createConfigurationContextFromFileSystem("target/test-classes",
+                configFile.getAbsolutePath());
+        AxisConfiguration config = cfgCtx.getAxisConfiguration();
+
+        // Can't test with a module.xml file in test-resources because it gets
+        // overridden by target\classes\META-INF\module.xml, so create our own
+        // AxisModule with the required parameter value
+        AxisModule module = config.getModule("addressing");
+        module.addParameter(new Parameter("disableAddressingForOutMessages", "false"));
+        
+        msgCtxt = cfgCtx.createMessageContext();
+        msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
+        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
+        msgCtxt.setFrom(new EndpointReference("http://www.from.org/service/"));
+        msgCtxt.setReplyTo(new EndpointReference("http://www.replyTo.org/service/"));
+        msgCtxt.setFaultTo(new EndpointReference("http://www.faultTo.org/service/"));
+        msgCtxt.setWSAAction("http://www.actions.org/action");
+        msgCtxt.setMessageID("123456-7890");
+        msgCtxt.addRelatesTo(new RelatesTo("http://www.relatesTo.org/service/"));
+        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);
+        
+        outHandler.invoke(msgCtxt);
+
+        XMLComparator xmlComparator = new XMLComparator();
+        assertTrue(xmlComparator.compare(msgCtxt.getEnvelope(), testUtil
+                .getOMBuilder("addressingEnabledTest.xml")
+                .getDocumentElement()));   
+    }
+    
+    public void testModuleIncludeOptionalHeadersTrue() throws Exception {
+        File configFile = new File(System.getProperty("basedir",".") + 
+                "/test-resources/axis2-noParameters.xml");
+        ConfigurationContext cfgCtx = ConfigurationContextFactory
+        .createConfigurationContextFromFileSystem("target/test-classes",
+                configFile.getAbsolutePath());
+        AxisConfiguration config = cfgCtx.getAxisConfiguration();
+
+        // Can't test with a module.xml file in test-resources because it gets
+        // overridden by target\classes\META-INF\module.xml, so create our own
+        // AxisModule with the required parameter value
+        AxisModule module = config.getModule("addressing");
+        module.addParameter(new Parameter("includeOptionalHeaders", "true"));
+
+        msgCtxt = cfgCtx.createMessageContext();
+        msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
+        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
+        msgCtxt.setFrom(new EndpointReference("http://www.from.org/service/"));
+        msgCtxt.setReplyTo(new EndpointReference("http://www.replyTo.org/service/"));
+        msgCtxt.setFaultTo(new EndpointReference("http://www.faultTo.org/service/"));
+        msgCtxt.setWSAAction("http://www.actions.org/action");
+        msgCtxt.setMessageID("123456-7890");
+        msgCtxt.addRelatesTo(new RelatesTo("http://www.relatesTo.org/service/"));
+        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);
+        
+        outHandler.invoke(msgCtxt);
+
+        XMLComparator xmlComparator = new XMLComparator();
+        assertTrue(xmlComparator.compare(msgCtxt.getEnvelope(), testUtil
+                .getOMBuilder("withOptionalHeadersTest.xml")
+                .getDocumentElement()));   
+    }
+    
+    public void testModuleIncludeOptionalHeadersFalse() throws Exception {
+        File configFile = new File(System.getProperty("basedir",".") + 
+                "/test-resources/axis2-noParameters.xml");
+        ConfigurationContext cfgCtx = ConfigurationContextFactory
+        .createConfigurationContextFromFileSystem("target/test-classes",
+                configFile.getAbsolutePath());
+        AxisConfiguration config = cfgCtx.getAxisConfiguration();
+
+        // Can't test with a module.xml file in test-resources because it gets
+        // overridden by target\classes\META-INF\module.xml, so create our own
+        // AxisModule with the required parameter value
+        AxisModule module = config.getModule("addressing");
+        module.addParameter(new Parameter("includeOptionalHeaders", "false"));
+        
+        msgCtxt = cfgCtx.createMessageContext();
+        msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
+        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
+        msgCtxt.setFrom(new EndpointReference("http://www.from.org/service/"));
+        msgCtxt.setReplyTo(new EndpointReference("http://www.replyTo.org/service/"));
+        msgCtxt.setFaultTo(new EndpointReference("http://www.faultTo.org/service/"));
+        msgCtxt.setWSAAction("http://www.actions.org/action");
+        msgCtxt.setMessageID("123456-7890");
+        msgCtxt.addRelatesTo(new RelatesTo("http://www.relatesTo.org/service/"));
+        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);
+        
+        outHandler.invoke(msgCtxt);
+
+        XMLComparator xmlComparator = new XMLComparator();
+        assertTrue(xmlComparator.compare(msgCtxt.getEnvelope(), testUtil
+                .getOMBuilder("addressingEnabledTest.xml")
+                .getDocumentElement()));   
+    }
 }



Mime
View raw message