You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2007/11/02 18:02:27 UTC

svn commit: r591402 - in /webservices/axis2/trunk/java/modules: addressing/src/org/apache/axis2/handlers/addressing/ addressing/test-resources/valid-messages/final/ addressing/test-resources/valid-messages/submission/ addressing/test/org/apache/axis2/h...

Author: davidillsley
Date: Fri Nov  2 10:02:24 2007
New Revision: 591402

URL: http://svn.apache.org/viewvc?rev=591402&view=rev
Log:
SOAP 1.1 Actor/SOAP 1.2 Role Support
	- Allows roles to be configued per AxisConfiguration object
	- Roles can be configured through axis2.xml
	- MustUnderstand checking modified to use this role configuration
	  (Defaults to existing behaviour if not explicitly turned on)
	- AddressingInHandler modified to use this role configuration if it exists.

Apologies if I'm jumping the gun. If anyone objects I'm happy to withdraw it.
(I got it done more quickly than I expected :-)

Added:
    webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/final/soapmessage.customrole.soap12.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/final/soapmessage.customrole.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/submission/soapmessage.customrole.xml
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/soaproleconfiguration/
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/soaproleconfiguration/axis2.xml
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/SOAPRoleConfigurationTest.java
Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
    webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingFinalInHandlerTest.java
    webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java
    webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTestBase.java
    webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandlerTest.java
    webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingValidationHandlerTest.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.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/axis2_default.xml
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java?rev=591402&r1=591401&r2=591402&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java Fri Nov  2 10:02:24 2007
@@ -21,14 +21,19 @@
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 
 import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.soap.RolePlayer;
 import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAP12Version;
 import org.apache.axiom.soap.SOAPHeader;
 import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.soap.SOAPVersion;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.AddressingFaultsHelper;
 import org.apache.axis2.addressing.EndpointReference;
@@ -54,7 +59,7 @@
     private static final Log log = LogFactory.getLog(AddressingInHandler.class);
 
     private boolean disableRefparamExtract = false;
-    	  	 
+        	  	 
     public void init(HandlerDescription handlerdesc) {
     	super.init(handlerdesc);
     	disableRefparamExtract = JavaUtils.isTrueExplicitly(Utils.getParameterValue(handlerdesc.getParameter(DISABLE_REF_PARAMETER_EXTRACT)));
@@ -129,6 +134,7 @@
                                                    ArrayList addressingHeaders, String namespace)
             throws AxisFault {
 
+    	RolePlayer rolePlayer = (RolePlayer)messageContext.getConfigurationContext().getAxisConfiguration().getParameterValue(Constants.SOAP_ROLE_PLAYER_PARAMETER);
         Options messageContextOptions = messageContext.getOptions();
       
         ArrayList duplicateHeaderNames = new ArrayList(1); // Normally will not be used for more than 1 header
@@ -144,7 +150,7 @@
         // First pass just check for duplicates
         for(int i=0;i<addressingHeaders.size();i++){
         	SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) addressingHeaders.get(i);
-        	if (messageContext.isSOAP11() || !SOAP12Constants.SOAP_ROLE_NONE.equals(soapHeaderBlock.getRole())) {
+        	if (isInRole(soapHeaderBlock, rolePlayer, messageContext.isSOAP11())) {
         		String localName = soapHeaderBlock.getLocalName();
         		if (WSA_ACTION.equals(localName)) {
         			actionBlock = soapHeaderBlock;
@@ -186,7 +192,7 @@
         if (actionBlock == null && toBlock == null && messageIDBlock == null
 				&& replyToBlock == null && faultToBlock == null
 				&& fromBlock == null && relatesToHeaders == null) {
-			// All of the headers must have had the none role so further
+			// All of the headers must have had the non local roles so further
 			// processing should be skipped.
 			return false;
 		}
@@ -235,6 +241,37 @@
         return true;
     }
 
+    // Copied from SOAPHeaderImpl.java - some reconciliation probably a good idea....
+    protected boolean isInRole(SOAPHeaderBlock soapHeaderBlock, RolePlayer rolePlayer, boolean isSOAP11){
+    	String role = soapHeaderBlock.getRole();
+
+    	// 1. If role is ultimatedest, go by what the rolePlayer says
+    	if (role == null || role.equals("") ||
+    			(!isSOAP11 &&
+    					role.equals(SOAP12Constants.SOAP_ROLE_ULTIMATE_RECEIVER))) {
+    		return (rolePlayer == null || rolePlayer.isUltimateDestination());
+    	}
+
+    	// 2. If role is next, always return true
+    	if (role.equals(soapHeaderBlock.getVersion().getNextRoleURI())) return true;
+
+    	// 3. If role is none, always return false
+    	if (!isSOAP11 && role.equals(SOAP12Constants.SOAP_ROLE_NONE)) {
+    		return false;
+    	}
+
+    	// 4. Return t/f depending on match
+    	List roles = (rolePlayer == null) ? null : rolePlayer.getRoles();
+    	if (roles != null) {
+    		for (int i=0;i<roles.size();i++) {
+    			String thisRole = (String) roles.get(i);
+    			if (thisRole.equals(role)) return true;
+    		}
+    	}
+
+    	return false;
+    }
+    
     protected abstract void checkForMandatoryHeaders(boolean[] alreadyFoundAddrHeader,
     		MessageContext messageContext)
     throws AxisFault;

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/final/soapmessage.customrole.soap12.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/final/soapmessage.customrole.soap12.xml?rev=591402&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/final/soapmessage.customrole.soap12.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/final/soapmessage.customrole.soap12.xml Fri Nov  2 10:02:24 2007
@@ -0,0 +1,89 @@
+<!--
+  ~ 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://www.w3.org/2003/05/soap-envelope"
+        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xmlns:wsa="http://www.w3.org/2005/08/addressing">
+    <soapenv:Header xmlns:fabrikam="http://example.com/fabrikam" xmlns:axis2="http://ws.apache.org/namespaces/axis2">
+        <wsa:MessageID>invalid-notinrole</wsa:MessageID>
+        <wsa:To>soapenv:mustUnderstand="0">invalid-notinrole</wsa:To>
+        <wsa:From>
+            <wsa:Address>invalid-notinrole</wsa:Address>
+        </wsa:From>
+        <wsa:Action>invalid-notinrole</wsa:Action>
+        <wsa:ReplyTo>
+            <wsa:Address>invalid-notinrole</wsa:Address>
+        </wsa:ReplyTo>
+        <wsa:FaultTo>
+            <wsa:Address>invalid-notinrole</wsa:Address>
+        </wsa:FaultTo>
+        <wsa:RelatesTo>invalid-notinrole</wsa:RelatesTo>
+        <wsa:RelatesTo RelationshipType="http://some.custom.relationship">invalid-notinrole</wsa:RelatesTo>
+        
+        <wsa:MessageID axis2:AttrExt="123456789" soapenv:role="http://my/custom/role">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:To axis2:AttrExt="123456789" soapenv:role="http://my/custom/role">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From soapenv:mustUnderstand="0" axis2:AttrExt="123456789" soapenv:role="http://my/custom/role">
+            <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+            <wsa:Metadata>
+                <axis2:MetaExt axis2:AttrExt="123456789">123456789</axis2:MetaExt>
+            </wsa:Metadata>
+            <axis2:EPRExt axis2:AttrExt="123456789">123456789</axis2:EPRExt>
+        </wsa:From>
+        <wsa:Action axis2:AttrExt="123456789" soapenv:role="http://my/custom/role">http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:ReplyTo axis2:AttrExt="123456789" soapenv:role="http://my/custom/role">
+            <wsa:Address>http://example.com/fabrikam/acct</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+            <wsa:Metadata>
+                <axis2:MetaExt axis2:AttrExt="123456789">123456789</axis2:MetaExt>
+            </wsa:Metadata>
+            <axis2:EPRExt axis2:AttrExt="123456789">123456789</axis2:EPRExt>
+        </wsa:ReplyTo>
+        <wsa:FaultTo axis2:AttrExt="123456789" soapenv:role="http://my/custom/role">
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+            <wsa:Metadata>
+                <axis2:MetaExt axis2:AttrExt="123456789">123456789</axis2:MetaExt>
+            </wsa:Metadata>
+            <axis2:EPRExt axis2:AttrExt="123456789">123456789</axis2:EPRExt>
+        </wsa:FaultTo>
+        <wsa:RelatesTo axis2:AttrExt="123456789" soapenv:role="http://my/custom/role">http://some.previous.message</wsa:RelatesTo>
+        <wsa:RelatesTo RelationshipType="http://some.custom.relationship" soapenv:role="http://my/custom/role">http://identifier.of.other.message/</wsa:RelatesTo>
+    </soapenv:Header>
+    <soapenv:Body>
+        <ns1:getBalance soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+                xmlns:ns1="http://localhost:8081/axis/services/BankPort">
+            <accountNo href="#id0"/>
+        </ns1:getBalance>
+        <multiRef id="id0" soapenc:root="0"
+                soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+                xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
+            1001</multiRef>
+    </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/final/soapmessage.customrole.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/final/soapmessage.customrole.xml?rev=591402&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/final/soapmessage.customrole.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/final/soapmessage.customrole.xml Fri Nov  2 10:02:24 2007
@@ -0,0 +1,89 @@
+<!--
+  ~ 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/"
+        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xmlns:wsa="http://www.w3.org/2005/08/addressing">
+    <soapenv:Header xmlns:fabrikam="http://example.com/fabrikam" xmlns:axis2="http://ws.apache.org/namespaces/axis2">
+        <wsa:MessageID>invalid-notinrole</wsa:MessageID>
+        <wsa:To>soapenv:mustUnderstand="0">invalid-notinrole</wsa:To>
+        <wsa:From>
+            <wsa:Address>invalid-notinrole</wsa:Address>
+        </wsa:From>
+        <wsa:Action>invalid-notinrole</wsa:Action>
+        <wsa:ReplyTo>
+            <wsa:Address>invalid-notinrole</wsa:Address>
+        </wsa:ReplyTo>
+        <wsa:FaultTo>
+            <wsa:Address>invalid-notinrole</wsa:Address>
+        </wsa:FaultTo>
+        <wsa:RelatesTo>invalid-notinrole</wsa:RelatesTo>
+        <wsa:RelatesTo RelationshipType="http://some.custom.relationship">invalid-notinrole</wsa:RelatesTo>
+        
+        <wsa:MessageID axis2:AttrExt="123456789" soapenv:mustUnderstand="0" soapenv:actor="http://my/custom/role">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:To axis2:AttrExt="123456789" soapenv:mustUnderstand="0" soapenv:actor="http://my/custom/role">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From soapenv:mustUnderstand="0" axis2:AttrExt="123456789" soapenv:actor="http://my/custom/role">
+            <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+            <wsa:Metadata>
+                <axis2:MetaExt axis2:AttrExt="123456789">123456789</axis2:MetaExt>
+            </wsa:Metadata>
+            <axis2:EPRExt axis2:AttrExt="123456789">123456789</axis2:EPRExt>
+        </wsa:From>
+        <wsa:Action axis2:AttrExt="123456789" soapenv:actor="http://my/custom/role">http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:ReplyTo axis2:AttrExt="123456789" soapenv:actor="http://my/custom/role">
+            <wsa:Address>http://example.com/fabrikam/acct</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+            <wsa:Metadata>
+                <axis2:MetaExt axis2:AttrExt="123456789">123456789</axis2:MetaExt>
+            </wsa:Metadata>
+            <axis2:EPRExt axis2:AttrExt="123456789">123456789</axis2:EPRExt>
+        </wsa:ReplyTo>
+        <wsa:FaultTo axis2:AttrExt="123456789" soapenv:actor="http://my/custom/role">
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+            <wsa:Metadata>
+                <axis2:MetaExt axis2:AttrExt="123456789">123456789</axis2:MetaExt>
+            </wsa:Metadata>
+            <axis2:EPRExt axis2:AttrExt="123456789">123456789</axis2:EPRExt>
+        </wsa:FaultTo>
+        <wsa:RelatesTo axis2:AttrExt="123456789" soapenv:actor="http://my/custom/role">http://some.previous.message</wsa:RelatesTo>
+        <wsa:RelatesTo RelationshipType="http://some.custom.relationship" soapenv:actor="http://my/custom/role">http://identifier.of.other.message/</wsa:RelatesTo>
+    </soapenv:Header>
+    <soapenv:Body>
+        <ns1:getBalance soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+                xmlns:ns1="http://localhost:8081/axis/services/BankPort">
+            <accountNo href="#id0"/>
+        </ns1:getBalance>
+        <multiRef id="id0" soapenc:root="0"
+                soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+                xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
+            1001</multiRef>
+    </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/submission/soapmessage.customrole.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/submission/soapmessage.customrole.xml?rev=591402&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/submission/soapmessage.customrole.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/submission/soapmessage.customrole.xml Fri Nov  2 10:02:24 2007
@@ -0,0 +1,90 @@
+<!--
+  ~ 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/"
+        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
+        xmlns:axis2="http://ws.apache.org/namespaces/axis2">
+    <soapenv:Header xmlns:fabrikam="http://example.com/fabrikam">
+        <wsa:MessageID>invalid-notinrole</wsa:MessageID>
+        <wsa:To>soapenv:mustUnderstand="0">invalid-notinrole</wsa:To>
+        <wsa:From>
+            <wsa:Address>invalid-notinrole</wsa:Address>
+        </wsa:From>
+        <wsa:Action>invalid-notinrole</wsa:Action>
+        <wsa:ReplyTo>
+            <wsa:Address>invalid-notinrole</wsa:Address>
+        </wsa:ReplyTo>
+        <wsa:FaultTo>
+            <wsa:Address>invalid-notinrole</wsa:Address>
+        </wsa:FaultTo>
+        <wsa:RelatesTo>invalid-notinrole</wsa:RelatesTo>
+        <wsa:RelatesTo RelationshipType="http://some.custom.relationship">invalid-notinrole</wsa:RelatesTo>
+    
+        <wsa:MessageID axis2:AttrExt="123456789" soapenv:mustUnderstand="0" soapenv:actor="http://my/custom/role">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:To axis2:AttrExt="123456789" soapenv:mustUnderstand="0" soapenv:actor="http://my/custom/role">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From axis2:AttrExt="123456789" soapenv:mustUnderstand="0" soapenv:actor="http://my/custom/role">
+            <wsa:Address>
+                http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+            </wsa:ReferenceParameters>
+            <wsa:ReferenceProperties>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceProperties>
+            <axis2:EPRExt axis2:AttrExt="123456789">123456789</axis2:EPRExt>
+        </wsa:From>
+        <wsa:Action axis2:AttrExt="123456789" soapenv:actor="http://my/custom/role">http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:ReplyTo axis2:AttrExt="123456789" soapenv:actor="http://my/custom/role">
+            <wsa:Address>http://example.com/fabrikam/acct</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+            </wsa:ReferenceParameters>
+            <wsa:ReferenceProperties>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceProperties>
+            <axis2:EPRExt axis2:AttrExt="123456789">123456789</axis2:EPRExt>
+        </wsa:ReplyTo>
+
+        <wsa:FaultTo axis2:AttrExt="123456789" soapenv:actor="http://my/custom/role">
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+            </wsa:ReferenceParameters>
+            <wsa:ReferenceProperties>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceProperties>
+            <axis2:EPRExt axis2:AttrExt="123456789">123456789</axis2:EPRExt>
+        </wsa:FaultTo>
+        <wsa:RelatesTo axis2:AttrExt="123456789" soapenv:actor="http://my/custom/role">http://some.previous.message</wsa:RelatesTo>
+        <wsa:RelatesTo RelationshipType="axis2:some.custom.relationship" soapenv:actor="http://my/custom/role">http://identifier.of.other.message/</wsa:RelatesTo>
+
+    </soapenv:Header>
+    <soapenv:Body>
+        <ns1:getBalance soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+                xmlns:ns1="http://localhost:8081/axis/services/BankPort">
+            <accountNo href="#id0"/>
+        </ns1:getBalance>
+        <multiRef id="id0" soapenc:root="0"
+                soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+                xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
+            1001</multiRef>
+    </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingFinalInHandlerTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingFinalInHandlerTest.java?rev=591402&r1=591401&r2=591402&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingFinalInHandlerTest.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingFinalInHandlerTest.java Fri Nov  2 10:02:24 2007
@@ -20,16 +20,19 @@
 package org.apache.axis2.handlers.addressing;
 
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.RolePlayer;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
+import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContext;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 
 public class AddressingFinalInHandlerTest extends AddressingInHandlerTestBase {
@@ -52,7 +55,7 @@
 
     public void testExtractAddressingInformationFromHeaders() {
         try {
-            Options options = extractAddressingInformationFromHeaders();
+            Options options = extractAddressingInformationFromHeaders(null);
 
             assertNotNull(options);
             assertNotNull(options.getTo());
@@ -72,6 +75,48 @@
             fail(" An Exception has occured " + e.getMessage());
         }
     }
+    
+    public void testExtractAddressingInformationFromHeadersCustomRole() throws Exception{
+    	testFileName = "soapmessage.customrole.xml";
+    	Options options = extractAddressingInformationFromHeaders(new RolePlayer(){
+			public List getRoles() {
+				ArrayList al = new ArrayList();
+				al.add("http://my/custom/role");
+				return al;
+			}
+			public boolean isUltimateDestination() {
+				return false;
+			}
+    	});
+
+        assertNotNull(options);
+        assertNotNull(options.getTo());
+        assertEPRHasCorrectMetadata(options.getFrom());
+        assertEPRHasCorrectMetadata(options.getFaultTo());
+        assertEPRHasCorrectMetadata(options.getReplyTo());
+
+    }
+    
+    public void testExtractAddressingInformationFromHeadersCustomRoleSOAP12() throws Exception{
+    	testFileName = "soapmessage.customrole.soap12.xml";
+    	Options options = extractAddressingInformationFromHeaders(new RolePlayer(){
+			public List getRoles() {
+				ArrayList al = new ArrayList();
+				al.add("http://my/custom/role");
+				return al;
+			}
+			public boolean isUltimateDestination() {
+				return false;
+			}
+    	});
+
+        assertNotNull(options);
+        assertNotNull(options.getTo());
+        assertEPRHasCorrectMetadata(options.getFrom());
+        assertEPRHasCorrectMetadata(options.getFaultTo());
+        assertEPRHasCorrectMetadata(options.getReplyTo());
+
+    }
 
     public void testMessageWithOmittedAction() {
         try {
@@ -187,9 +232,10 @@
         }
     }
 
-    public void testDifferentSoapActionProcessing() {
+    public void testDifferentSoapActionProcessing() throws Exception{
         String testfile = "valid-messages/" + versionDirectory + "/soapmessage.xml";
         MessageContext mc = new MessageContext();
+        mc.setConfigurationContext(ConfigurationContextFactory.createDefaultConfigurationContext());
         mc.setServerSide(true);
         try {
             mc.setSoapAction("http://ws.apache.org/tests/differentAction");
@@ -199,16 +245,12 @@
         catch (AxisFault af) {
             //Test passed.
         }
-        catch (Exception e) {
-            e.printStackTrace();
-            log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());
-        }
     }
 
-    public void testSameSoapAction() {
+    public void testSameSoapAction() throws Exception{
         String testfile = "valid-messages/" + versionDirectory + "/soapmessage.xml";
         MessageContext mc = new MessageContext();
+        mc.setConfigurationContext(ConfigurationContextFactory.createDefaultConfigurationContext());
         mc.setServerSide(true);
         try {
             mc.setSoapAction("http://ws.apache.org/tests/action");
@@ -219,17 +261,12 @@
             log.error(af.getMessage());
             fail("An unexpected AxisFault was thrown while testing with a soapaction and ws-a action that are the same.");
         }
-        catch (Exception e) {
-            e.printStackTrace();
-            log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());
-        }
     }
 
-    public void testEmptySoapAction() {
+    public void testEmptySoapAction() throws Exception{
         String testfile = "valid-messages/" + versionDirectory + "/soapmessage.xml";
         MessageContext mc = new MessageContext();
-
+        mc.setConfigurationContext(ConfigurationContextFactory.createDefaultConfigurationContext());
         try {
             mc.setSoapAction("");
             basicExtractAddressingInformationFromHeaders(testfile, mc);
@@ -239,17 +276,12 @@
             log.error(af.getMessage());
             fail("An unexpected AxisFault was thrown while testing with an empty soapaction.");
         }
-        catch (Exception e) {
-            e.printStackTrace();
-            log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());
-        }
     }
 
-    public void testNullSoapAction() {
+    public void testNullSoapAction() throws Exception{
         String testfile = "valid-messages/" + versionDirectory + "/soapmessage.xml";
         MessageContext mc = new MessageContext();
-
+        mc.setConfigurationContext(ConfigurationContextFactory.createDefaultConfigurationContext());
         try {
             mc.setSoapAction(null);
             basicExtractAddressingInformationFromHeaders(testfile, mc);
@@ -258,11 +290,6 @@
             af.printStackTrace();
             log.error(af.getMessage());
             fail("An unexpected AxisFault was thrown while testing with a null soapaction.");
-        }
-        catch (Exception e) {
-            e.printStackTrace();
-            log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());
         }
     }
 

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java?rev=591402&r1=591401&r2=591402&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java Fri Nov  2 10:02:24 2007
@@ -27,6 +27,7 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.handlers.util.TestUtil;
 
@@ -84,6 +85,7 @@
         StAXSOAPModelBuilder omBuilder = testUtil.getOMBuilder(testfile);
         SOAPEnvelope envelope = ((SOAPEnvelope)omBuilder.getDocumentElement());
         MessageContext msgContext = new MessageContext();
+        msgContext.setConfigurationContext(ConfigurationContextFactory.createDefaultConfigurationContext());
         msgContext.setEnvelope(envelope);
         AddressingFinalInHandler afih = new AddressingFinalInHandler();
         afih.invoke(msgContext);

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTestBase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTestBase.java?rev=591402&r1=591401&r2=591402&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTestBase.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTestBase.java Fri Nov  2 10:02:24 2007
@@ -22,15 +22,20 @@
 import junit.framework.TestCase;
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.RolePlayer;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.SOAPHeader;
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.RelatesTo;
 import org.apache.axis2.client.Options;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.handlers.util.TestUtil;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -45,7 +50,7 @@
     AddressingInHandler inHandler;
     String addressingNamespace;
     TestUtil testUtil = new TestUtil();
-    private String testFileName = "soapmessage.xml";
+    String testFileName = "soapmessage.xml";
 
     String versionDirectory;
 
@@ -72,12 +77,14 @@
                                                addressingNamespace);
     }
 
-    protected Options extractAddressingInformationFromHeaders() {
-        try {
+    protected Options extractAddressingInformationFromHeaders(RolePlayer rolePlayer) throws Exception{
             String testfile = "valid-messages/" + versionDirectory + "/" + testFileName;
 
             MessageContext mc = new MessageContext();
-
+            mc.setConfigurationContext(ConfigurationContextFactory.createDefaultConfigurationContext());
+            if(rolePlayer != null){
+            	mc.getConfigurationContext().getAxisConfiguration().addParameter(Constants.SOAP_ROLE_PLAYER_PARAMETER, rolePlayer);
+            }
             basicExtractAddressingInformationFromHeaders(testfile, mc);
 
             Options options = mc.getOptions();
@@ -101,14 +108,6 @@
             assertRelationships(options);
 
             return options;
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.info(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());
-        }
-
-        return null;
     }
 
     private void testExtractAddressingInformationFromHeadersInvalidCardinality(String headerName) {
@@ -116,6 +115,7 @@
                 "/invalidCardinality" + headerName + "Message.xml";
         try {
             MessageContext mc = new MessageContext();
+            mc.setConfigurationContext(ConfigurationContextFactory.createDefaultConfigurationContext());
             try {
                 basicExtractAddressingInformationFromHeaders(testfile, mc);
                 fail("An AxisFault should have been thrown due to 2 wsa:" + headerName +
@@ -171,6 +171,8 @@
                 "omitted-header-messages/" + versionDirectory + "/" + testName + "Message.xml";
 
         MessageContext mc = new MessageContext();
+        ConfigurationContext cc = ConfigurationContextFactory.createDefaultConfigurationContext();
+        mc.setConfigurationContext(cc);
         basicExtractAddressingInformationFromHeaders(testfile, mc);
 
         return mc.getOptions();

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandlerTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandlerTest.java?rev=591402&r1=591401&r2=591402&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandlerTest.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandlerTest.java Fri Nov  2 10:02:24 2007
@@ -19,6 +19,10 @@
 
 package org.apache.axis2.handlers.addressing;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.axiom.soap.RolePlayer;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
@@ -44,15 +48,23 @@
         secondRelationshipType = "axis2:some.custom.relationship";
     }
 
-    public void testExtractAddressingInformationFromHeaders() {
-        try {
-            Options options = extractAddressingInformationFromHeaders();
-            // Cannot check refparams in 2004/08 case as they can't be extracted until later
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());
-        }
+    public void testExtractAddressingInformationFromHeaders() throws Exception{
+    	extractAddressingInformationFromHeaders(null);
+    	// Cannot check refparams in 2004/08 case as they can't be extracted until later
+    }
+    
+    public void testExtractAddressingInformationFromHeadersCustomRole() throws Exception{
+    	testFileName = "soapmessage.customrole.xml";
+    	extractAddressingInformationFromHeaders(new RolePlayer(){
+			public List getRoles() {
+				ArrayList al = new ArrayList();
+				al.add("http://my/custom/role");
+				return al;
+			}
+			public boolean isUltimateDestination() {
+				return false;
+			}
+    	});
     }
 
     public void testMessageWithOmittedAction() {

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingValidationHandlerTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingValidationHandlerTest.java?rev=591402&r1=591401&r2=591402&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingValidationHandlerTest.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingValidationHandlerTest.java Fri Nov  2 10:02:24 2007
@@ -23,6 +23,7 @@
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
@@ -48,7 +49,7 @@
         String testfile = directory + "/" + versionDirectory + "/" + testName;
 
         MessageContext mc = new MessageContext();
-
+        mc.setConfigurationContext(ConfigurationContextFactory.createDefaultConfigurationContext());
         StAXSOAPModelBuilder omBuilder = testUtil.getOMBuilder(testfile);
         mc.setEnvelope(omBuilder.getSOAPEnvelope());
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java?rev=591402&r1=591401&r2=591402&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java Fri Nov  2 10:02:24 2007
@@ -250,6 +250,12 @@
      */
     public static final String INBOUND_FAULT_OVERRIDE = "inboundFaultOverride";
 
+    /** SOAP Role Configuration */
+    public static final String SOAP_ROLE_CONFIGURATION_ELEMENT = "SOAPRoleConfiguration";
+    public static final String SOAP_ROLE_IS_ULTIMATE_RECEIVER_ATTRIBUTE = "isUltimateReceiver";
+    public static final String SOAP_ROLE_ELEMENT = "role";
+    public static final String SOAP_ROLE_PLAYER_PARAMETER = "rolePlayer";
+    
     public static interface Configuration {
         public static final String ENABLE_REST = "enableREST";
         public static final String ENABLE_REST_THROUGH_GET = "restThroughGet";

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?rev=591402&r1=591401&r2=591402&view=diff
==============================================================================
--- 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 Fri Nov  2 10:02:24 2007
@@ -22,7 +22,9 @@
 
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.RolePlayer;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
 import org.apache.axis2.builder.ApplicationXMLBuilder;
 import org.apache.axis2.builder.Builder;
 import org.apache.axis2.builder.MIMEBuilder;
@@ -47,11 +49,14 @@
 import org.apache.axis2.transport.MessageFormatter;
 import org.apache.axis2.transport.TransportListener;
 import org.apache.axis2.transport.TransportSender;
+import org.apache.axis2.util.JavaUtils;
 import org.apache.axis2.util.Loader;
 import org.apache.axis2.util.TargetResolver;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import edu.emory.mathcs.backport.java.util.Collections;
+
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import java.io.InputStream;
@@ -200,6 +205,15 @@
             if (dataLocatorElement != null) {
                 processDataLocatorConfig(dataLocatorElement);
             }
+            
+            // process roleplayer configuration
+            OMElement rolePlayerElement =
+                    config_element
+                            .getFirstChildWithName(new QName(Constants.SOAP_ROLE_CONFIGURATION_ELEMENT));
+
+            if (rolePlayerElement != null) {
+                processSOAPRoleConfig(axisConfig, rolePlayerElement);
+            }
 
             // process MessageFormatters
             OMElement messageFormattersElement =
@@ -246,6 +260,36 @@
         }
     }
 
+    private void processSOAPRoleConfig(AxisConfiguration axisConfig, OMElement soaproleconfigElement) {
+    	if (soaproleconfigElement != null) {
+    		final boolean isUltimateReceiever = JavaUtils.isTrue(soaproleconfigElement.getAttributeValue(new QName(Constants.SOAP_ROLE_IS_ULTIMATE_RECEIVER_ATTRIBUTE)), true);
+    		ArrayList roles = new ArrayList();
+    		Iterator iterator = soaproleconfigElement.getChildrenWithName(new QName(Constants.SOAP_ROLE_ELEMENT));
+    		while (iterator.hasNext()) {
+    			OMElement roleElement = (OMElement) iterator.next();
+    			roles.add(roleElement.getText());
+    		}
+    		final List unmodifiableRoles = Collections.unmodifiableList(roles);
+    		try{
+    			RolePlayer rolePlayer = new RolePlayer(){
+    				public List getRoles() {
+    					return unmodifiableRoles;
+    				}
+    				public boolean isUltimateDestination() {
+    					return isUltimateReceiever;
+    				}
+    			};
+    			axisConfig.addParameter("rolePlayer", rolePlayer);
+    		} catch (AxisFault e) {
+    			if (log.isTraceEnabled()) {
+    				log.trace(
+    						"processTargetResolvers: Exception thrown initialising TargetResolver: " +
+    						e.getMessage());
+    			}
+    		}
+    	}
+    }
+    
     private void processDeployers(Iterator deployerItr) {
         HashMap directoryToExtensionMappingMap = new HashMap();
         HashMap extensionToDeployerMappingMap = new HashMap();

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?rev=591402&r1=591401&r2=591402&view=diff
==============================================================================
--- 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 Fri Nov  2 10:02:24 2007
@@ -168,6 +168,20 @@
     <!--<transportSender name="java"-->
                      <!--class="org.apache.axis2.transport.java.JavaTransportSender"/>-->
 
+
+    <!-- ================================================= -->
+    <!--  SOAP Role Configuration                          -->
+    <!-- ================================================= -->
+    <!-- Use the following pattern to configure this axis2
+         instance to act in particular roles. Note that in
+         the absence of any configuration, Axis2 will act 
+         only in the ultimate receiver role -->
+    <!--
+    <SOAPRoleConfiguration isUltimateReceiver="true">
+    	<role>http://my/custom/role</role>
+    </SOAPRoleConfiguration>
+	-->
+
     <!-- ================================================= -->
     <!-- Phases  -->
     <!-- ================================================= -->

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?rev=591402&r1=591401&r2=591402&view=diff
==============================================================================
--- 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 Fri Nov  2 10:02:24 2007
@@ -20,6 +20,7 @@
 
 package org.apache.axis2.engine;
 
+import org.apache.axiom.soap.RolePlayer;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.SOAPHeaderBlock;
 import org.apache.axis2.AxisFault;
@@ -72,7 +73,7 @@
         }
 
         // Get all the headers targeted to us
-        Iterator headerBlocks = envelope.getHeader().getHeadersToProcess(null);
+        Iterator headerBlocks = envelope.getHeader().getHeadersToProcess((RolePlayer)msgContext.getConfigurationContext().getAxisConfiguration().getParameterValue("rolePlayer"));
 
         while (headerBlocks.hasNext()) {
             SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) headerBlocks.next();

Added: webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/soaproleconfiguration/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/soaproleconfiguration/axis2.xml?rev=591402&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/soaproleconfiguration/axis2.xml (added)
+++ webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/soaproleconfiguration/axis2.xml Fri Nov  2 10:02:24 2007
@@ -0,0 +1,268 @@
+<!--
+  ~ 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>-->
+
+
+    <!-- ================================================= -->
+    <!-- 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>
+
+    <!--Uncomment if you want to have TCP transport support-->
+    <!--<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>
+    <!--<transportSender name="java"-->
+                     <!--class="org.apache.axis2.transport.java.JavaTransportSender"/>-->
+
+
+    <!-- ================================================= -->
+    <!--  SOAP Role Configuration                          -->
+    <!-- ================================================= -->
+    <!-- Use the following pattern to configure this axis2
+         instance to act in particular roles. Note that in
+         the absence of any configuration, Axis2 will act 
+         only in the ultimate receiver role -->
+    <SOAPRoleConfiguration isUltimateReceiver="false">
+    	<role>http://my/custom/role</role>
+    </SOAPRoleConfiguration>
+	
+
+    <!-- ================================================= -->
+    <!-- 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="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"/>
+        </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="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"/>
+        </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

Added: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/SOAPRoleConfigurationTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/SOAPRoleConfigurationTest.java?rev=591402&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/SOAPRoleConfigurationTest.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/SOAPRoleConfigurationTest.java Fri Nov  2 10:02:24 2007
@@ -0,0 +1,43 @@
+/*
+ * 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.deployment;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.soap.RolePlayer;
+import org.apache.axis2.AbstractTestCase;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.engine.AxisConfiguration;
+
+public class SOAPRoleConfigurationTest extends TestCase{
+
+	public void testCustomSOAPRoleConfiguration() throws Exception{
+		String filename =
+            AbstractTestCase.basedir + "/test-resources/deployment/soaproleconfiguration";
+		AxisConfiguration axisConfig = ConfigurationContextFactory
+            .createConfigurationContextFromFileSystem(filename)
+            .getAxisConfiguration();
+		RolePlayer rolePlayer = (RolePlayer)axisConfig.getParameterValue(Constants.SOAP_ROLE_PLAYER_PARAMETER);
+		assertNotNull(rolePlayer);
+		assertFalse(rolePlayer.isUltimateDestination());
+		assertEquals(1, rolePlayer.getRoles().size());
+		assertEquals("http://my/custom/role", rolePlayer.getRoles().get(0));
+	}
+}



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