axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From barre...@apache.org
Subject svn commit: r556761 - in /webservices/axis2/trunk/java/modules: jaxws/ jaxws/test-resources/ jaxws/test/org/apache/axis2/jaxws/framework/ jaxws/test/org/apache/axis2/jaxws/provider/ jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/ jaxws/test/org/a...
Date Mon, 16 Jul 2007 23:01:36 GMT
Author: barrettj
Date: Mon Jul 16 16:01:34 2007
New Revision: 556761

URL: http://svn.apache.org/viewvc?view=rev&rev=556761
Log:
AXIS2-2853
Add pluggable mustUnderstand checker support and associated testcase.

Added:
    webservices/axis2/trunk/java/modules/jaxws/test-resources/axis2.xml
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/SoapMessageMUProviderChecker.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/META-INF/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/META-INF/MANIFEST.MF
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/META-INF/ProviderSOAPMessage.wsdl
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/META-INF/services.xml
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/SoapMessageMUProvider.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/SOAPMustUnderstandHeaderChecker.java
Modified:
    webservices/axis2/trunk/java/modules/jaxws/pom.xml
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/AttachmentUtil.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java

Modified: webservices/axis2/trunk/java/modules/jaxws/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/pom.xml?view=diff&rev=556761&r1=556760&r2=556761
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/jaxws/pom.xml Mon Jul 16 16:01:34 2007
@@ -465,6 +465,17 @@
 										<include name="org/apache/axis2/jaxws/server/**"/>
 									</fileset>
 								</copy>
+                                <copy toDir="target/test-classes/services/SoapMessageMUProviderService/">
+                                    <fileset dir="target/test-classes">
+                                        <include name="org/apache/axis2/jaxws/provider/soapmsgmu/**"/>
+                                    </fileset>
+                                    <fileset dir="test/org/apache/axis2/jaxws/provider/soapmsgmu">
+                                        <include name="META-INF/**"/>
+                                    </fileset>
+                                    <fileset dir="target/classes">
+                                        <include name="org/apache/axis2/jaxws/server/**"/>
+                                    </fileset>
+                                </copy>
 								<copy toDir="target/test-classes/services/JAXBProviderService/">
 									<fileset dir="target/test-classes">
 										<include name="org/apache/axis2/jaxws/provider/jaxb/**"/>
@@ -806,6 +817,7 @@
 								<copy toDir="target/test-classes/">
 									<fileset dir="test-resources/">
 										<include name="**/*.properties"/>
+										<include name="**/axis2.xml"/>
 									</fileset>
 								</copy>
 							</tasks>
@@ -850,6 +862,11 @@
 						<property>
 							<name>build.repository</name>
 							<value>./target/test-classes</value>
+						</property>
+						<!-- Need this for the client side to pickup an axis2.xml to configure SoapMessageMUProviderChecker -->
+						<property>
+						    <name>org.apache.axis2.jaxws.config.path</name>
+						    <value>./target/test-classes/axis2.xml</value>
 						</property>
 					</systemProperties>
 				</configuration>

Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/axis2.xml?view=auto&rev=556761
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/axis2.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/axis2.xml Mon Jul 16 16:01:34 2007
@@ -0,0 +1,284 @@
+<!--
+  ~ 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">
+    <!-- ================================================= -->
+    <!-- Parameters -->
+    <!-- ================================================= -->
+    <parameter name="hotdeployment">true</parameter>
+    <parameter name="hotupdate">false</parameter>
+    <parameter name="enableMTOM">false</parameter>
+
+    <!--During a fault, stacktrace can be sent with the fault message. The following flag will control -->
+    <!--that behaviour.-->
+    <parameter name="sendStacktraceDetailsWithFaults">true</parameter>
+
+    <!--If there aren't any information available to find out the fault reason, we set the message of the exception-->
+    <!--as the faultreason/Reason. But when a fault is thrown from a service or some where, it will be -->
+    <!--wrapped by different levels. Due to this the initial exception message can be lost. If this flag-->
+    <!--is set then, Axis2 tries to get the first exception and set its message as the faultreason/Reason.-->
+    <parameter name="DrillDownToRootCauseForFaultReason">false</parameter>
+
+    <!--This is the user name and password of admin console-->
+    <parameter name="userName">admin</parameter>
+    <parameter name="password">axis2</parameter>
+
+    <!--To override repository/services you need to uncomment following parameter and value SHOULD be absolute file path.-->
+    <!--ServicesDirectory only works on the following cases-->
+    <!---File based configurator and in that case the value should be a file URL (http:// not allowed)-->
+    <!---When creating URL Based configurator with URL “file://”  -->
+    <!--- War based configurator with expanded case , -->
+
+    <!--All the other scenarios it will be ignored.-->
+    <!--<parameter name="ServicesDirectory">service</parameter>-->
+    <!--To override repository/modules you need to uncomment following parameter and value SHOULD be absolute file path-->
+    <!--<parameter name="ModulesDirectory">modules</parameter>-->
+
+    <!--Following params will set the proper context paths for invocations. All the endpoints will have a commons context-->
+    <!--root which can configured using the following contextRoot parameter-->
+    <!--<parameter name="contextRoot">axis2</parameter>-->
+
+    <!--Our HTTP endpoints can handle both REST and SOAP. Following parameters can be used to distinguish those endpoints-->
+    <!--<parameter name="servicePath">services</parameter>-->
+    <!--<parameter name="restPath">rest</parameter>-->
+
+    <!-- Following parameter will completely disable REST handling in Axis2-->
+    <parameter name="disableREST" locked="true">false</parameter>
+
+    <!--POJO deployer , this will alow users to drop .class file and make that into a service-->
+    <deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>
+
+    <!-- Following parameter will set the host name for the epr-->
+    <!--<parameter name="hostname" locked="true">myhost.com</parameter>-->
+
+    <!-- ================================================= -->
+    <!-- Message Receivers -->
+    <!-- ================================================= -->
+    <!--This is the Default Message Receiver for the system , if you want to have MessageReceivers for -->
+    <!--all the other MEP implement it and add the correct entry to here , so that you can refer from-->
+    <!--any operation -->
+    <!--Note : You can override this for particular service by adding the same element with your requirement-->
+    <messageReceivers>
+        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+                         class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+                         class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
+                         class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
+                         class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+    </messageReceivers>
+
+    <!-- ================================================= -->
+    <!-- Message Formatter -->
+    <!-- ================================================= -->
+    <!--Following content type to message formatter mapping can be used to implement support for different message -->
+    <!--format  serialization in Axis2. These message formats are expected to be resolved based on the content type. -->
+    <messageFormatters>
+        <messageFormatter contentType="application/x-www-form-urlencoded"
+                         class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
+        <messageFormatter contentType="multipart/form-data"
+                         class="org.apache.axis2.transport.http.MultipartFormDataFormatter"/>
+        <messageFormatter contentType="application/xml"
+                         class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
+    </messageFormatters>
+
+    <!-- ================================================= -->
+    <!-- Message Builders -->
+    <!-- ================================================= -->
+    <!--Following content type to builder mapping can be used to implement support for different message -->
+    <!--formats in Axis2. These message formats are expected to be resolved based on the content type. -->
+    <messageBuilders>
+        <messageBuilder contentType="application/xml"
+                         class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
+        <messageBuilder contentType="application/x-www-form-urlencoded"
+                         class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
+        <!--Left commented because it adds the depandancy of servlet-api to other modules.
+        Please uncomment to Receive messages in multipart/form-data format-->
+        <!--<messageBuilder contentType="multipart/form-data"-->
+                         <!--class="org.apache.axis2.builder.MultipartFormDataBuilder"/>-->
+    </messageBuilders>
+
+    <!-- ================================================= -->
+    <!-- Target Resolvers -->
+    <!-- ================================================= -->
+    <!-- Uncomment the following and specify the class name for your TargetResolver to add -->
+    <!-- a TargetResolver. TargetResolvers are used to process the To EPR for example to -->
+    <!-- choose a server in a cluster -->
+    <!--<targetResolvers>-->
+    <!--<targetResolver class="" />-->
+    <!--</targetResolvers>-->
+
+    <!-- ================================================= -->
+    <!-- SOAP Must Understand Header Checkers -->
+    <!-- ================================================= -->
+    <!-- Uncomment the following and specify the class name for your SOAPMustUnderstandHeaderChecker -->
+    <!-- implementation to add a header checker.  Header checkers are used to identify SOAP Header -->
+    <!-- QNames that will be processed by components (such as a MessageReceiver) after the point -->
+    <!-- the Axis2 engine checks that all mustUnderstand headers are understood. -->
+    <soapMustUnderstandCheckers>
+        <soapMustUnderstandChecker class="org.apache.axis2.jaxws.provider.SoapMessageMUProviderChecker" />
+    </soapMustUnderstandCheckers>
+
+
+    <!-- ================================================= -->
+    <!-- Transport Ins -->
+    <!-- ================================================= -->
+    <transportReceiver name="http"
+                       class="org.apache.axis2.transport.http.SimpleHTTPServer">
+        <parameter name="port">6060</parameter>
+        <!--If you want to give your own host address for EPR generation-->
+        <!--uncomment following parameter , and set as you required.-->
+        <!--<parameter name="hostname">http://myApp.com/ws</parameter>-->
+    </transportReceiver>
+
+    <transportReceiver name="tcp"
+                       class="org.apache.axis2.transport.tcp.TCPServer">
+        <parameter name="port">6061</parameter>
+        <!--If you want to give your own host address for EPR generation-->
+        <!--uncomment following parameter , and set as you required.-->
+        <!--<parameter name="hostname">tcp://myApp.com/ws</parameter>-->
+    </transportReceiver>
+
+    <!-- ================================================= -->
+    <!-- Transport Outs -->
+    <!-- ================================================= -->
+
+    <!--<transportSender name="jms"-->
+                     <!--class="org.apache.axis2.transport.jms.JMSSender"/>-->
+    <transportSender name="tcp"
+                     class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
+    <transportSender name="local"
+                     class="org.apache.axis2.transport.local.LocalTransportSender"/>
+    <transportSender name="http"
+                     class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+        <parameter name="PROTOCOL">HTTP/1.1</parameter>
+        <parameter name="Transfer-Encoding">chunked</parameter>
+    </transportSender>
+    <transportSender name="https"
+                     class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+        <parameter name="PROTOCOL">HTTP/1.1</parameter>
+        <parameter name="Transfer-Encoding">chunked</parameter>
+    </transportSender>
+
+    <!-- ================================================= -->
+    <!-- Phases  -->
+    <!-- ================================================= -->
+    <phaseOrder type="InFlow">
+        <!--  System pre-defined 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="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+            <handler name="RequestURIOperationDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+
+            <handler name="HTTPLocationBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+        </phase>
+        <phase name="RMPhase"/>
+        <!--  System pre defined phases       -->
+        <!--   After Postdispatch phase module author or or service author can add any phase he want      -->
+        <phase name="OperationInPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFlow">
+        <!--      user can add his own phases to this area  -->
+        <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="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+            <handler name="RequestURIOperationDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+
+            <handler name="HTTPLocationBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+        </phase>
+        <phase name="RMPhase"/>
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationInFaultPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFaultFlow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationOutFaultPhase"/>
+        <phase name="RMPhase"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+    </phaseOrder>
+</axisconfig>
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java?view=diff&rev=556761&r1=556760&r2=556761
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java Mon Jul 16 16:01:34 2007
@@ -58,6 +58,7 @@
 import org.apache.axis2.jaxws.provider.JAXBProviderTests;
 import org.apache.axis2.jaxws.provider.SOAPFaultProviderTests;
 import org.apache.axis2.jaxws.provider.SoapMessageProviderTests;
+import org.apache.axis2.jaxws.provider.SoapMessageMUProviderTests;
 import org.apache.axis2.jaxws.provider.SourceMessageProviderTests;
 import org.apache.axis2.jaxws.provider.SourceProviderTests;
 import org.apache.axis2.jaxws.provider.StringMessageProviderTests;
@@ -152,6 +153,7 @@
         suite.addTestSuite(SourceMessageProviderTests.class);
         // TODO FIXME: Test fails
         //suite.addTestSuite(SoapMessageProviderTests.class);
+        suite.addTestSuite(SoapMessageMUProviderTests.class);
         suite.addTestSuite(JAXBProviderTests.class);
         suite.addTestSuite(ProxyTests.class);
         //TODO: FIXME - Was working, now doesn't

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/AttachmentUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/AttachmentUtil.java?view=diff&rev=556761&r1=556760&r2=556761
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/AttachmentUtil.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/AttachmentUtil.java Mon Jul 16 16:01:34 2007
@@ -21,11 +21,23 @@
 import java.awt.*;
 import java.awt.image.BufferedImage;
 import java.io.OutputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
 import java.util.Iterator;
 
 import javax.imageio.IIOImage;
 import javax.imageio.ImageWriter;
 import javax.imageio.stream.ImageOutputStream;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
 
 /**
  * This will serve as a helper class for attachments utility methods. All methods
@@ -33,7 +45,81 @@
  *
  */
 public class AttachmentUtil {
- 
+    public static final String SOAP11_NAMESPACE = "http://schemas.xmlsoap.org/soap/envelope";
+    public static final String SOAP12_NAMESPACE = "http://www.w3.org/2003/05/soap-envelope";
+
+    public static final String MU_TEXT = "soap message mustUnderstand header request";
+    public static final String UNDERSTOOD_MU_TEXT = "understood headers soap message mustUnderstand header request";
+    public static final String TEXT = "soap message request";
+    public static final String VALUE = "value";
+    public static final String VALUE_NODE = "<"+VALUE+">";
+    public static final String VALUE_NODE_SLASH = "</"+VALUE+">";
+    public static final String XML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
+    public static final String MUHEADER_CLIENT = "ns1:muclient";
+    public static final String MUHEADER_SERVER = "ns1:muserver";
+    public static final String MUHEADER_CLIENT_UNDERSTOOD = "ns1:muclientunderstood";
+    public static final String MUHEADER_SERVER_UNDERSTOOD = "ns1:muserverunderstood";
+    public static final String msgEnvMU = 
+        "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+            "<soapenv:Header>" +
+                "<"+MUHEADER_CLIENT+" xmlns:ns1=\"http://ws.apache.org/axis2\" soapenv:mustUnderstand=\"1\">MUinfo</"+MUHEADER_CLIENT+">" +
+            "</soapenv:Header>" +
+            "<soapenv:Body>" +
+                "<ns1:invoke xmlns:ns1=\"http://ws.apache.org/axis2\">" +
+                    VALUE_NODE +
+                    MU_TEXT +
+                    VALUE_NODE_SLASH +
+                "</ns1:invoke>" +
+            "</soapenv:Body>" +
+        "</soapenv:Envelope>";
+    
+    public static final String msgEnv = 
+        "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+            "<soapenv:Body>" +
+                "<ns1:invoke xmlns:ns1=\"http://ws.apache.org/axis2\">" +
+                    VALUE_NODE +
+                    MU_TEXT +
+                    VALUE_NODE_SLASH +
+                "</ns1:invoke>" +
+            "</soapenv:Body>" +
+        "</soapenv:Envelope>";
+    
+    public static final String msgEnvPlain = 
+        "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+            "<soapenv:Body>" +
+                "<ns1:invoke xmlns:ns1=\"http://ws.apache.org/axis2\">" +
+                    VALUE_NODE +
+                    TEXT +
+                    VALUE_NODE_SLASH +
+                "</ns1:invoke>" +
+            "</soapenv:Body>" +
+        "</soapenv:Envelope>";
+
+    public static final String msgEnvMU_understood = 
+        "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+            "<soapenv:Header>" +
+                "<"+MUHEADER_CLIENT_UNDERSTOOD+" xmlns:ns1=\"http://ws.apache.org/axis2\" soapenv:mustUnderstand=\"1\">MUinfo</"+MUHEADER_CLIENT_UNDERSTOOD+">" +
+            "</soapenv:Header>" +
+            "<soapenv:Body>" +
+                "<ns1:invoke xmlns:ns1=\"http://ws.apache.org/axis2\">" +
+                    VALUE_NODE +
+                    UNDERSTOOD_MU_TEXT +
+                    VALUE_NODE_SLASH +
+                "</ns1:invoke>" +
+            "</soapenv:Body>" +
+        "</soapenv:Envelope>";
+    
+    public static final String msgEnv_understood = 
+        "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+            "<soapenv:Body>" +
+                "<ns1:invoke xmlns:ns1=\"http://ws.apache.org/axis2\">" +
+                    VALUE_NODE +
+                    UNDERSTOOD_MU_TEXT +
+                    VALUE_NODE_SLASH +
+                "</ns1:invoke>" +
+            "</soapenv:Body>" +
+        "</soapenv:Envelope>";
+    
     /**
      * Store a given image to an Image output stream
      * @param mimeType
@@ -56,5 +142,81 @@
         ios.flush();
         imageWriter.dispose();
     }
+    
+	/**
+	 * Adapter method used to convert any type of Source to a String
+	 * 
+	 * @param input
+	 * @return
+	 */
+	public static String toString(Source input) {
+
+		if (input == null)
+			return null;
+
+		StringWriter writer = new StringWriter();
+		Transformer trasformer;
+		try {
+			trasformer = TransformerFactory.newInstance().newTransformer();
+			Result result = new StreamResult(writer);
+			trasformer.transform(input, result);
+		} catch (Exception e) {
+			return null;
+		}
+
+		return writer.getBuffer().toString();
+	}
+
+	/**
+	 * Adapter method used to convert any type of SOAPMessage to a String
+	 * 
+	 * @param input
+	 * @return
+	 */
+	public static String toString(SOAPMessage input) {
+
+		if (input == null)
+			return null;
+
+		Source result = null;
+		try {
+			result = input.getSOAPPart().getContent();
+		} catch (SOAPException e) {
+			e.printStackTrace();
+		}
+
+		return toString(result);
+	}
+	
+	/**
+	 * Method used to convert Strings to SOAPMessages
+	 * 
+	 * @param msgString
+	 * @return
+	 */
+        public static SOAPMessage toSOAPMessage(String msgString) {
+
+         if (msgString == null) return null;
+
+         SOAPMessage message = null;
+         try {
+                 MessageFactory factory = null;
+
+                 // Force the usage of specific MesasgeFactories
+                 if (msgString.indexOf(SOAP11_NAMESPACE) >= 0) {
+                         factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
+                 } else {
+                         factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
+                 }
+                 message = factory.createMessage();
+                 message.getSOAPPart().setContent((Source) new StreamSource(new StringReader(msgString)));
+                 message.saveChanges();
+         } catch (SOAPException e) {
+                 System.out.println("toSOAPMessage Exception encountered: " + e);
+                 e.printStackTrace();
+         }
+         return message;     
+    }
+    
 }
 

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/SoapMessageMUProviderChecker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/SoapMessageMUProviderChecker.java?view=auto&rev=556761
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/SoapMessageMUProviderChecker.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/SoapMessageMUProviderChecker.java Mon Jul 16 16:01:34 2007
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.provider;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.util.SOAPMustUnderstandHeaderChecker;
+
+import javax.xml.namespace.QName;
+
+import java.util.HashMap;
+
+/**
+ * Plugin to remove "understood" headers for the SoapMessageMUProviderTests.  This class must
+ * be configured in the axis2.xml file on both the client and the server. 
+ */
+public class SoapMessageMUProviderChecker implements SOAPMustUnderstandHeaderChecker {
+    public HashMap removeUnderstoodHeaders(MessageContext msgContext, HashMap headers) {
+        headers = testDriver(headers);
+        return headers;
+    }
+
+    private HashMap testDriver(HashMap notUnderstoodHeaders) {
+        String ns1 = "http://ws.apache.org/axis2";
+        String clientLocalName = "muclientunderstood";
+        String serverLocalName = "muserverunderstood";
+
+        // Remove the two headers the test expects us to understand
+        QName clientQN = new QName(ns1, clientLocalName);
+        QName serverQN = new QName(ns1, serverLocalName);
+
+        if (notUnderstoodHeaders.containsKey(clientQN)) {
+            notUnderstoodHeaders.remove(clientQN);
+        }
+        if (notUnderstoodHeaders.containsKey(serverQN)) {
+            notUnderstoodHeaders.remove(serverQN);
+
+        }
+        return notUnderstoodHeaders;
+    }
+}
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java?view=auto&rev=556761
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java Mon Jul 16 16:01:34 2007
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2007 International Business Machines Corp.
+ *
+ * Licensed 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.
+ */
+package org.apache.axis2.jaxws.provider;
+
+
+import javax.xml.ws.Service;
+import javax.xml.namespace.QName;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.BindingProvider;
+import javax.xml.soap.SOAPMessage;
+import junit.framework.TestCase;
+
+/**
+ * Tests Dispatch<SOAPMessage> client and a Provider<SOAPMessage> service
+ * with mustUnderstand attribute header.
+ */
+public class SoapMessageMUProviderTests extends TestCase {
+    public static final QName serviceName =
+            new QName("http://ws.apache.org/axis2", "SoapMessageMUProviderService");
+    public static final QName portName =
+            new QName("http://ws.apache.org/axis2", "SimpleProviderServiceSOAP11port0");
+    public static final String endpointUrl =
+            "http://localhost:8080/axis2/services/SoapMessageMUProviderService";
+
+    public static final String bindingID = SOAPBinding.SOAP11HTTP_BINDING;
+    public static final Service.Mode mode = Service.Mode.MESSAGE;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public SoapMessageMUProviderTests(String name) {
+        super(name);
+    }
+
+    /**
+     * Test soap message with no MU headers
+     */
+    public void testNoMustUnderstandHeaders() {
+        System.out.println("testNoMustUnderstandHeaders");
+        // create a service
+        Service svc = Service.create(serviceName);
+        svc.addPort(portName, bindingID, endpointUrl);
+
+        javax.xml.ws.Dispatch<SOAPMessage> dispatch = null;
+        dispatch = svc.createDispatch(portName, SOAPMessage.class, mode);
+
+        ((BindingProvider) dispatch).getRequestContext()
+                                    .put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
+        ((BindingProvider) dispatch).getRequestContext()
+                                    .put(BindingProvider.SOAPACTION_URI_PROPERTY, "echoString");
+
+        SOAPMessage message = AttachmentUtil.toSOAPMessage(AttachmentUtil.msgEnvPlain);
+
+        try {
+            SOAPMessage response = dispatch.invoke(message);
+
+            String string = AttachmentUtil.toString(response);
+            assertTrue(string.equalsIgnoreCase(AttachmentUtil.XML_HEADER
+                    + AttachmentUtil.msgEnvPlain));
+        } catch (Exception e) {
+            fail("Unexpected Exception: " + e.getMessage());
+        }
+    }
+
+    /**
+     * Test the mustUnderstand soap header attribute on the client's
+     * outbound soap message for headers that are not understood.  Should cause an 
+     * exception.
+     */
+    public void testClientRequestNotUnderstoodHeaders() {
+        System.out.println("testClientRequestNotUnderstoodHeaders");
+        // create a service
+        Service svc = Service.create(serviceName);
+        svc.addPort(portName, bindingID, endpointUrl);
+
+        javax.xml.ws.Dispatch<SOAPMessage> dispatch = null;
+        dispatch = svc.createDispatch(portName, SOAPMessage.class, mode);
+
+        //force SOAPAction to match with wsdl action                        
+        ((BindingProvider) dispatch).getRequestContext()
+                                    .put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
+        ((BindingProvider) dispatch).getRequestContext()
+                                    .put(BindingProvider.SOAPACTION_URI_PROPERTY, "echoString");
+
+        SOAPMessage message = AttachmentUtil.toSOAPMessage(AttachmentUtil.msgEnvMU);
+
+        try {
+            dispatch.invoke(message);
+            fail("Should have received fault for not understood headers on request");
+        } catch (Exception e) {
+            // Expected path
+        }
+    }
+
+    /**
+     * Test the mustUnderstand soap header attribute on the server's
+     * outbound soap message (i.e. the inbound response to the client) for headers that
+     * are not understood.  Should cause an exception.
+     */
+    public void testClientResponseNotUnderstoodHeaders() {
+        System.out.println("testClientResponseNotUnderstoodHeaders");
+        // create a service
+        Service svc = Service.create(serviceName);
+        svc.addPort(portName, bindingID, endpointUrl);
+
+        javax.xml.ws.Dispatch<SOAPMessage> dispatch = null;
+        dispatch = svc.createDispatch(portName, SOAPMessage.class, mode);
+
+        //force SOAPAction to match with wsdl action                        
+        ((BindingProvider) dispatch).getRequestContext()
+                                    .put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
+        ((BindingProvider) dispatch).getRequestContext()
+                                    .put(BindingProvider.SOAPACTION_URI_PROPERTY, "echoString");
+
+        SOAPMessage message = AttachmentUtil.toSOAPMessage(AttachmentUtil.msgEnv);
+
+        try {
+            dispatch.invoke(message);
+            fail("Should have received fault for not understood headers on response");
+        } catch (Exception e) {
+            // Expected path
+        }
+    }
+
+    /**
+     * Test the mustUnderstand soap header attribute on the client's
+     * outbound soap message for headers that should be understood.  Should not cause an 
+     * exception.
+     */
+    public void testClientRequestUnderstoodHeaders() {
+        System.out.println("testClientRequestUnderstoodHeaders");
+        // create a service
+        Service svc = Service.create(serviceName);
+        svc.addPort(portName, bindingID, endpointUrl);
+
+        javax.xml.ws.Dispatch<SOAPMessage> dispatch = null;
+        dispatch = svc.createDispatch(portName, SOAPMessage.class, mode);
+
+        //force SOAPAction to match with wsdl action                        
+        ((BindingProvider) dispatch).getRequestContext()
+                                    .put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
+        ((BindingProvider) dispatch).getRequestContext()
+                                    .put(BindingProvider.SOAPACTION_URI_PROPERTY, "echoString");
+
+        SOAPMessage message = AttachmentUtil.toSOAPMessage(AttachmentUtil.msgEnvMU_understood);
+
+        try {
+            dispatch.invoke(message);
+        } catch (Exception e) {
+            fail("Should not have received fault for headers that were understood.  " + e.getMessage());
+        }
+    }
+
+    /**
+     * Test the mustUnderstand soap header attribute on the server's
+     * outbound soap message (i.e. the inbound response to the client) for headers that
+     * are understood.  Should not cause an exception.
+     */
+    public void testClientResponseUnderstoodHeaders() {
+        System.out.println("testClientResponseUnderstoodHeaders");
+        // create a service
+        Service svc = Service.create(serviceName);
+        svc.addPort(portName, bindingID, endpointUrl);
+
+        javax.xml.ws.Dispatch<SOAPMessage> dispatch = null;
+        dispatch = svc.createDispatch(portName, SOAPMessage.class, mode);
+
+        //force SOAPAction to match with wsdl action                        
+        ((BindingProvider) dispatch).getRequestContext()
+                                    .put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
+        ((BindingProvider) dispatch).getRequestContext()
+                                    .put(BindingProvider.SOAPACTION_URI_PROPERTY, "echoString");
+
+        SOAPMessage message = AttachmentUtil.toSOAPMessage(AttachmentUtil.msgEnv_understood);
+
+        try {
+            dispatch.invoke(message);
+        } catch (Exception e) {
+            fail("Should not have received fault for headers that were understood.  " + e.getMessage());
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/META-INF/MANIFEST.MF?view=auto&rev=556761
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/META-INF/MANIFEST.MF (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/META-INF/MANIFEST.MF Mon Jul 16 16:01:34 2007
@@ -0,0 +1 @@
+Manifest-Version: 1.0

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/META-INF/ProviderSOAPMessage.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/META-INF/ProviderSOAPMessage.wsdl?view=auto&rev=556761
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/META-INF/ProviderSOAPMessage.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/META-INF/ProviderSOAPMessage.wsdl Mon Jul 16 16:01:34 2007
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+-->
+
+<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:s="http://www.w3.org/2001/XMLSchema" 
+    xmlns:tns="http://ws.apache.org/axis2"
+    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
+    xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
+    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
+    targetNamespace="http://ws.apache.org/axis2" 
+    xmlns="http://schemas.xmlsoap.org/wsdl/">
+  <types>
+     	<xsd:schema
+			targetNamespace="http://ws.apache.org/axis2"
+			xmlns:tns="http://ws.apache.org/axis2"
+			xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+			<xsd:complexType name="StringArray">
+				<xsd:sequence>
+					<xsd:element name="value" type="xsd:string"
+						minOccurs="0" maxOccurs="unbounded" />
+
+				</xsd:sequence>
+			</xsd:complexType>
+
+			<xsd:element name="inMessage" type="tns:StringArray" />
+			<xsd:element name="outMessage" type="tns:StringArray" />
+		        <xsd:element name="twoWayExceptionFault" type="xsd:string" />
+	</xsd:schema>
+    
+
+  </types>
+   
+  <message name="emptyMessage"/>
+  <message name="inMessage">
+    <part name="parameters" element="tns:inMessage" />
+  </message>
+  <message name="outMessage">
+    <part name="parameters" element="tns:outMessage" />
+  </message>
+
+  <portType name="EchoServiceInterface">
+    <operation name="invoke">
+      <input message="tns:inMessage" />
+      <output message="tns:outMessage" />
+    </operation>  
+  </portType>
+
+  <binding name="EchoServiceSoap" type="tns:EchoServiceInterface">
+    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
+    <operation name="invoke">
+      <soap:operation soapAction="echoString" style="document" />
+      <input>
+        <soap:body use="literal" />
+      </input>
+      <output>
+        <soap:body use="literal" />
+      </output>
+    </operation>
+  </binding>
+
+  <service name="SoapMessageMUProviderService">
+    <port name="SimpleProviderServiceSOAP11port0" binding="tns:EchoServiceSoap">
+      <soap:address location="http://localhost:8080/axis2/services/SoapMessageMUProviderService" />
+    </port>
+  </service>
+
+</definitions>

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/META-INF/services.xml?view=auto&rev=556761
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/META-INF/services.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/META-INF/services.xml Mon Jul 16 16:01:34 2007
@@ -0,0 +1,15 @@
+<serviceGroup>
+ <service name="SoapMessageMUProviderService">
+  <messageReceivers>
+   <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver"/>
+  </messageReceivers>
+  <parameter locked="false" name="ServiceClass">org.apache.axis2.jaxws.provider.soapmsgmu.SoapMessageMUProvider</parameter>
+  <excludeOperations>
+     <operation>invoke</operation>
+  </excludeOperations>
+  <operation name="invoke" mep="http://www.w3.org/2004/08/wsdl/in-out">
+    <actionMapping/>
+  </operation>
+ </service>
+</serviceGroup>
+

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/SoapMessageMUProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/SoapMessageMUProvider.java?view=auto&rev=556761
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/SoapMessageMUProvider.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/soapmsgmu/SoapMessageMUProvider.java Mon Jul 16 16:01:34 2007
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2007 International Business Machines Corp.
+ *
+ * Licensed 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.
+ */
+package org.apache.axis2.jaxws.provider.soapmsgmu;
+
+import javax.xml.ws.Provider;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.soap.SOAPMessage;
+
+import org.apache.axis2.jaxws.provider.AttachmentUtil;
+
+/**
+ * This class provides the server side implementation for JAX-WS Provider<MESSAGE>
+ * for SOAP11 Binding with Mode = MESSAGE.
+ *
+ * The receiving message and the sending back message
+ * must have the headers defined in wsdl.
+ */
+
+@WebServiceProvider()
+@ServiceMode(value = Service.Mode.MESSAGE)
+@BindingType(SOAPBinding.SOAP11HTTP_BINDING)
+public class SoapMessageMUProvider implements Provider<SOAPMessage> {
+    /**
+     * This service receives soap message and return it back to client as is
+     * or add a soap mustUnderstand attribute header and then return it back to client
+     *
+     * @param SOAPMessage object sent by the client
+     * @return the SOAPMessage
+     */
+    public SOAPMessage invoke(SOAPMessage request) {
+        System.out.println("----------------------------------------------");
+        System.out.println("SoapMessageMUProvider:Invoke: Request received");
+        SOAPMessage response = null;
+
+        try {
+            String string = AttachmentUtil.toString(request);
+            if (string != null) {
+                System.out.println("invoke: ---Received message= " + string);
+                if (string.contains(new StringBuffer(AttachmentUtil.UNDERSTOOD_MU_TEXT))) {
+                    String responseStr =
+                            AttachmentUtil.msgEnvMU_understood.replaceAll(AttachmentUtil.MUHEADER_CLIENT_UNDERSTOOD,
+                                                                          AttachmentUtil.MUHEADER_SERVER_UNDERSTOOD);
+                    response = AttachmentUtil.toSOAPMessage(responseStr);
+                    System.out.println("invoke: ---Response message= "
+                            + AttachmentUtil.toString(response));
+                } else if (string.contains(new StringBuffer(AttachmentUtil.MU_TEXT))) {
+                    String responseStr =
+                            AttachmentUtil.msgEnvMU.replaceAll(AttachmentUtil.MUHEADER_CLIENT,
+                                                               AttachmentUtil.MUHEADER_SERVER);
+                    response = AttachmentUtil.toSOAPMessage(responseStr);
+                    System.out.println("invoke: ---Response message= "
+                            + AttachmentUtil.toString(response));
+                } else {
+                    response = request;
+                }
+            } else {
+                String badResult = "***ERROR at Service Endpoint: Received message is NULL.";
+                throw new NullPointerException(badResult);
+            }
+        } catch (Exception e) {
+            System.out.println("SoapMessageMUProviderService: Failed with exception.");
+            e.printStackTrace();
+        }
+        return response;
+    }
+}

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java?view=diff&rev=556761&r1=556760&r2=556761
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java Mon Jul 16 16:01:34 2007
@@ -48,6 +48,7 @@
 import org.apache.axis2.transport.TransportListener;
 import org.apache.axis2.transport.TransportSender;
 import org.apache.axis2.util.Loader;
+import org.apache.axis2.util.SOAPMustUnderstandHeaderChecker;
 import org.apache.axis2.util.TargetResolver;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -122,6 +123,12 @@
                     config_element.getFirstChildWithName(new QName(TAG_TARGET_RESOLVERS));
             processTargetResolvers(axisConfig, targetResolvers);
 
+            // Process SOAPMustUnderstandHeaderCheckers
+            OMElement headerCheckers =
+                config_element.getFirstChildWithName(new QName(TAG_MUSTUNDERSTAND_CHECKERS));
+            processMustUnderstandCheckers(axisConfig, headerCheckers);
+            
+            
             // Process Observers
             Iterator obs_ittr = config_element.getChildrenWithName(new QName(TAG_LISTENER));
 
@@ -239,6 +246,30 @@
                     if (log.isTraceEnabled()) {
                         log.trace(
                                 "processTargetResolvers: Exception thrown initialising TargetResolver: " +
+                                        e.getMessage());
+                    }
+                }
+            }
+        }
+    }
+
+    private void processMustUnderstandCheckers(AxisConfiguration axisConfig, OMElement headerCheckers) {
+        if (headerCheckers != null) {
+            Iterator iterator = headerCheckers.getChildrenWithName(new QName(TAG_MUSTUNDERSTAND_CHECKER));
+            while (iterator.hasNext()) {
+                OMElement headerChecker = (OMElement) iterator.next();
+                OMAttribute classNameAttribute =
+                        headerChecker.getAttribute(new QName(TAG_CLASS_NAME));
+                String className = classNameAttribute.getAttributeValue();
+                try {
+                    Class classInstance = Loader.loadClass(className);
+                    SOAPMustUnderstandHeaderChecker checkerClass = 
+                        (SOAPMustUnderstandHeaderChecker) classInstance.newInstance();
+                    axisConfig.addMustUnderstandHeaderChecker(checkerClass);
+                } catch (Exception e) {
+                    if (log.isTraceEnabled()) {
+                        log.trace(
+                                "processHeaderCheckers: Exception thrown initialising SOAPMustUnderstandHeaderChecker: " +
                                         e.getMessage());
                     }
                 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java?view=diff&rev=556761&r1=556760&r2=556761
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java Mon Jul 16 16:01:34 2007
@@ -51,6 +51,8 @@
     String TAG_TYPE = "type";
     String TAG_TARGET_RESOLVERS = "targetResolvers";
     String TAG_TARGET_RESOLVER = "targetResolver";
+    String TAG_MUSTUNDERSTAND_CHECKERS = "soapMustUnderstandCheckers";
+    String TAG_MUSTUNDERSTAND_CHECKER = "soapMustUnderstandChecker";
     String TAG_TRANSPORT_SENDER = "transportSender";
     String TAG_TRANSPORT_RECEIVER = "transportReceiver";
     String TAG_SERVICE_GROUP = "serviceGroup";

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml?view=diff&rev=556761&r1=556760&r2=556761
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml Mon Jul 16 16:01:34 2007
@@ -124,6 +124,17 @@
     <!--<targetResolver class="" />-->
     <!--</targetResolvers>-->
 
+    <!-- ================================================= -->
+    <!-- SOAP Must Understand Header Checkers -->
+    <!-- ================================================= -->
+    <!-- Uncomment the following and specify the class name for your SOAPMustUnderstandHeaderChecker -->
+    <!-- implementation to add a header checker.  Header checkers are used to identify SOAP Header -->
+    <!-- QNames that will be processed by components (such as a MessageReceiver) after the point -->
+    <!-- the Axis2 engine checks that all mustUnderstand headers are understood. -->
+    <!-- <soapMustUnderstandCheckers> -->
+    <!--    <soapMustUnderstandChecker class="" /> -->
+    <!-- </soapMustUnderstandCheckers> -->
+
 
     <!-- ================================================= -->
     <!-- Transport Ins -->

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java?view=diff&rev=556761&r1=556760&r2=556761
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java Mon Jul 16 16:01:34 2007
@@ -33,6 +33,7 @@
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.phaseresolver.PhaseResolver;
 import org.apache.axis2.transport.MessageFormatter;
+import org.apache.axis2.util.SOAPMustUnderstandHeaderChecker;
 import org.apache.axis2.util.TargetResolver;
 import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
@@ -124,6 +125,8 @@
     private boolean start;
 
     private ArrayList targetResolvers;
+    
+    private ArrayList mustUnderstandHeaderCheckers;
 
     private ClusterManager clusterManager;
 
@@ -156,6 +159,7 @@
 
         this.phasesinfo = new PhasesInfo();
         targetResolvers = new ArrayList();
+        mustUnderstandHeaderCheckers = new ArrayList();
     }
 
     public void addMessageReceiver(String mepURL,
@@ -1011,6 +1015,29 @@
     public void addTargetResolver(TargetResolver tr) {
         targetResolvers.add(tr);
     }
+    
+    /**
+     * Return an iterator over implentations of SOAPMustUnderstandHeaderChecker.  These 
+     * implentations are called during mustUnderstand validation with a HashMap of headers
+     * for the actor/role the engine is currently acting in.  They can remove headers they 
+     * understand from the map so those headers, if marked mustUnderstand and not yet processed, 
+     * do not cause a mustUnderstand fault to be thrown.
+     * 
+     * @return an iterator over SOAPMustUnderstandHeaderChecker implementations.  It may be
+     *  empty if none are configured.
+     */
+    public Iterator getMustUnderstandHeaderCheckers() {
+        return mustUnderstandHeaderCheckers.iterator();
+    }
+
+    /**
+     * Add an implementation of SOAPMustUnderstandHeaderChecker to the list of checkers. 
+     * 
+     * @param checker The implementation to be added.
+     */
+    public void addMustUnderstandHeaderChecker(SOAPMustUnderstandHeaderChecker checker) {
+        mustUnderstandHeaderCheckers.add(checker);
+    }
 
     public void addLocalPolicyAssertion(QName name) {
         this.localPolicyAssertions.add(name);
@@ -1096,3 +1123,4 @@
         }
     }
 }
+

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java?view=diff&rev=556761&r1=556760&r2=556761
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java Mon Jul 16 16:01:34 2007
@@ -36,11 +36,13 @@
 import org.apache.axis2.util.CallbackReceiver;
 import org.apache.axis2.util.LoggingControl;
 import org.apache.axis2.util.MessageContextBuilder;
+import org.apache.axis2.util.SOAPMustUnderstandHeaderChecker;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
 
 /**
@@ -63,7 +65,10 @@
     public AxisEngine(ConfigurationContext engineContext) {
     }
 
-    private static void checkMustUnderstand(MessageContext msgContext) throws AxisFault {
+    public static void checkMustUnderstand(MessageContext msgContext) throws AxisFault {
+        if (msgContext == null) {
+            return;
+        }
         SOAPEnvelope envelope = msgContext.getEnvelope();
         if (envelope.getHeader() == null) {
             return;
@@ -72,9 +77,12 @@
         // Get all the headers targeted to us
         Iterator headerBlocks = envelope.getHeader().getHeadersToProcess(null);
 
-        while (headerBlocks.hasNext()) {
-            SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) headerBlocks.next();
-
+        // Have the mustUnderstand Header checkers remove any headers from the list they understand
+        Iterator notUnderstoodHeaders = removeUnderstoodHeaders(msgContext, headerBlocks);
+        
+        while (notUnderstoodHeaders.hasNext()) {
+            SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) notUnderstoodHeaders.next();
+            
             // if this header block has been processed or mustUnderstand isn't
             // turned on then its cool
             if (headerBlock.isProcessed() || !headerBlock.getMustUnderstand()) {
@@ -89,6 +97,51 @@
         }
     }
 
+    private static Iterator removeUnderstoodHeaders(MessageContext msgContext, Iterator headerBlocks) {
+        Iterator mustUnderstandCheckers = msgContext.getConfigurationContext()
+            .getAxisConfiguration().getMustUnderstandHeaderCheckers();
+        Iterator notUnderstoodHeaders = null;
+        
+        if (mustUnderstandCheckers != null && mustUnderstandCheckers.hasNext()) {
+            // Create a map of the headers that need to be understood keyed by the header QName 
+            // to make it easy for the checkers to find the headers they understand, then let 
+            // each of the checkers remove any headers from the map that they will understand.
+            // REVIEW: Can there be duplicate SOAP header QNames?  If so, the vaules of the map 
+            // need to be a linked list or the collection needs to support duplicate keys.
+            HashMap notYetUnderstoodHeaders = new HashMap();
+            while (headerBlocks.hasNext()) {
+                SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) headerBlocks.next();
+                notYetUnderstoodHeaders.put(headerBlock.getQName(), headerBlock);
+            }
+            
+            while (mustUnderstandCheckers.hasNext()) {
+                SOAPMustUnderstandHeaderChecker checker = 
+                    (SOAPMustUnderstandHeaderChecker) mustUnderstandCheckers.next();
+                if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+                    log.debug("Before calling mustUnderstandChecker " 
+                              + checker
+                              + " list of not-yet-understood headers is: " 
+                              + notYetUnderstoodHeaders);
+                }
+
+                notYetUnderstoodHeaders = 
+                    checker.removeUnderstoodHeaders(msgContext, notYetUnderstoodHeaders);
+
+                if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+                    log.debug("After calling mustUnderstandChecker " 
+                              + checker
+                              + " list of not-yet-understood headers is: " 
+                              + notYetUnderstoodHeaders);
+                }
+            }
+            notUnderstoodHeaders = notYetUnderstoodHeaders.values().iterator();
+        } else {
+            // There are no validators, so just return the Iterator paramster unchanged
+            notUnderstoodHeaders = headerBlocks;
+        }
+        return notUnderstoodHeaders;
+    }
+    
     /**
      * This method is called to handle any error that occurs at inflow or outflow. But if the
      * method is called twice, it implies that sending the error handling has failed, in which case
@@ -132,9 +185,9 @@
             InvocationResponse pi = invoke(msgContext, NOT_RESUMING_EXECUTION);
 
             if (pi.equals(InvocationResponse.CONTINUE)) {
+                checkMustUnderstand(msgContext);
                 if (msgContext.isServerSide()) {
                     // invoke the Message Receivers
-                    checkMustUnderstand(msgContext);
 
                     MessageReceiver receiver = msgContext.getAxisOperation().getMessageReceiver();
                     if (receiver == null) {
@@ -277,9 +330,9 @@
         //invoking the MR
 
         if (pi.equals(InvocationResponse.CONTINUE)) {
+            checkMustUnderstand(msgContext);
             if (msgContext.isServerSide()) {
                 // invoke the Message Receivers
-                checkMustUnderstand(msgContext);
                 MessageReceiver receiver = msgContext.getAxisOperation().getMessageReceiver();
                 if (receiver == null) {
                     throw new AxisFault(Messages.getMessage(

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/SOAPMustUnderstandHeaderChecker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/SOAPMustUnderstandHeaderChecker.java?view=auto&rev=556761
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/SOAPMustUnderstandHeaderChecker.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/SOAPMustUnderstandHeaderChecker.java Mon Jul 16 16:01:34 2007
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.util;
+
+import org.apache.axis2.context.MessageContext;
+
+import java.util.HashMap;
+
+/**
+ * Interface to allow participation in the engine's validation of SOAP headers marked as 
+ * mustUnderstand.  This allows components such as MessageReceivers to indicate that they WILL
+ * process specific headers later, even though those headers have not yet been marked as
+ * processed.  
+ * 
+ * Implementations of this interface are specified in the axis2.xml configuration
+ * file using the following elements:
+ *     <soapMustUnderstandCheckers>
+ *         <soapMustUnderstandChecker class="class" />
+ *     </soapMustUnderstandCheckers>
+ *     
+ * Implementations are called during the engine's mustUnderstand validation with a collection of 
+ * headers that are not yet understood.  Note that only headers for the roles/actors in which this
+ * engine is acting will be in the collection.  The implementation should remove any headers 
+ * which it understands.  Note that headers which have already been processed will be include in
+ * the collection, but do not need to be removed (although they can be; it doesn't matter either
+ * way).  The checker returns the collection with the headers it understands removed.  That
+ * collection is passed to the next checker.
+ * 
+ * After all the checkers have been called by the engine, it will examine the collection for any
+ * headers that are marked mustUndertand which are not marked as processed.  If any exist, it will
+ * throw a SOAP mustUnderstand fault. 
+ */
+public interface SOAPMustUnderstandHeaderChecker {
+    /**
+     * Remove any headers which this checkers understands from the collection. 
+     * 
+     * @param msgContext The Message Context for the current message
+     * @param headers A collection of headers for this actor/role
+     * @return The collection with any headers understood by this checker removed.
+     */
+    HashMap removeUnderstoodHeaders(MessageContext msgContext, HashMap headers);
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message