You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2006/05/05 05:19:57 UTC

svn commit: r399923 - in /webservices/axis2/trunk/java/modules/addressing: src/org/apache/axis2/handlers/addressing/ test-resources/ test-resources/invalid-cardinality-messages/ test-resources/invalid-cardinality-messages/final/ test-resources/invalid-...

Author: dims
Date: Thu May  4 20:19:55 2006
New Revision: 399923

URL: http://svn.apache.org/viewcvs?rev=399923&view=rev
Log:
Fix for AXIS2-666 : WS-Addressing - AddressingSubmissionInHandler does not deserialise EPR extensibility attributes and elements 

Added:
    webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/
    webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/
    webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityActionMessage.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityFaultToMessage.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityFromMessage.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityMessageIDMessage.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityReplyToMessage.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityToMessage.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/
    webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityActionMessage.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityFaultToMessage.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityFromMessage.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityMessageIDMessage.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityReplyToMessage.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityToMessage.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/
    webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/final/
    webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/final/soapmessage.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/submission/
    webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/submission/soapmessage.xml
    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/AddressingInHandlerTestBase.java
    webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandlerTest.java
Removed:
    webservices/axis2/trunk/java/modules/addressing/test-resources/invalidCardinalityReplyToMessage.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/soapWithWSAFinalInfo.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/soapmessage.xml
    webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTest.java
Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java?rev=399923&r1=399922&r2=399923&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java Thu May  4 20:19:55 2006
@@ -1,79 +1,88 @@
-package org.apache.axis2.handlers.addressing;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.soap.SOAPHeader;
-import org.apache.axiom.soap.SOAPHeaderBlock;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.EndpointReference;
-
-import javax.xml.namespace.QName;
-import java.util.Iterator;
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * 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.
- *
- */
-
-public class AddressingSubmissionInHandler extends AddressingInHandler {
-
-    private static final long serialVersionUID = 365417374773955107L;
-
-    public AddressingSubmissionInHandler() {
-        addressingNamespace = Submission.WSA_NAMESPACE;
-        addressingVersion = "WS-Addressing Submission";
-    }
-
-
-    protected void extractToEprReferenceParameters(EndpointReference toEPR, SOAPHeader header, String namespace) {
-        // there is no exact way to identify ref parameters for Submission version. So let's have a handler
-        // at the end of the flow, which puts all the handlers (which are of course mustUnderstand=false)
-        // as reference parameters
-
-        // TODO : Chinthaka
-    }
-
-    protected void extractEPRInformation(SOAPHeaderBlock headerBlock, EndpointReference epr, String addressingNamespace) {
-
-        Iterator childElements = headerBlock.getChildElements();
-        while (childElements.hasNext()) {
-            OMElement eprChildElement = (OMElement) childElements.next();
-            if (checkElement(new QName(addressingNamespace, AddressingConstants.EPR_ADDRESS),
-                    eprChildElement.getQName())) {
-                epr.setAddress(eprChildElement.getText());
-            } else
-            if (checkElement(new QName(addressingNamespace, AddressingConstants.EPR_REFERENCE_PARAMETERS)
-                    , eprChildElement.getQName())) {
-
-                Iterator referenceParameters = eprChildElement.getChildElements();
-                while (referenceParameters.hasNext()) {
-                    OMElement element = (OMElement) referenceParameters.next();
-                    epr.addReferenceParameter(element);
-                }
-            } else
-            if (checkElement(new QName(addressingNamespace, AddressingConstants.Submission.EPR_REFERENCE_PROPERTIES)
-                    , eprChildElement.getQName())) {
-
-                // since we have the model for WS-Final, we don't have a place to keep this reference properties.
-                // The only compatible place is reference properties
-
-                Iterator referenceParameters = eprChildElement.getChildElements();
-                while (referenceParameters.hasNext()) {
-                    OMElement element = (OMElement) referenceParameters.next();
-                    epr.addReferenceParameter(element);
-                }
-            }
-        }
-    }
-}
+package org.apache.axis2.handlers.addressing;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * 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.
+ *
+ */
+
+public class AddressingSubmissionInHandler extends AddressingInHandler {
+
+    private static final long serialVersionUID = 365417374773955107L;
+
+    public AddressingSubmissionInHandler() {
+        addressingNamespace = Submission.WSA_NAMESPACE;
+        addressingVersion = "WS-Addressing Submission";
+    }
+
+
+    protected void extractToEprReferenceParameters(EndpointReference toEPR, SOAPHeader header, String namespace) {
+        // there is no exact way to identify ref parameters for Submission version. So let's have a handler
+        // at the end of the flow, which puts all the handlers (which are of course mustUnderstand=false)
+        // as reference parameters
+
+        // TODO : Chinthaka
+    }
+
+    protected void extractEPRInformation(SOAPHeaderBlock headerBlock, EndpointReference epr, String addressingNamespace) {
+
+        Iterator childElements = headerBlock.getChildElements();
+        while (childElements.hasNext()) {
+            OMElement eprChildElement = (OMElement) childElements.next();
+            if (checkElement(new QName(addressingNamespace, AddressingConstants.EPR_ADDRESS),
+                    eprChildElement.getQName())) {
+                epr.setAddress(eprChildElement.getText());
+            } else
+            if (checkElement(new QName(addressingNamespace, AddressingConstants.EPR_REFERENCE_PARAMETERS)
+                    , eprChildElement.getQName())) {
+
+                Iterator referenceParameters = eprChildElement.getChildElements();
+                while (referenceParameters.hasNext()) {
+                    OMElement element = (OMElement) referenceParameters.next();
+                    epr.addReferenceParameter(element);
+                }
+            } else
+            if (checkElement(new QName(addressingNamespace, AddressingConstants.Submission.EPR_REFERENCE_PROPERTIES)
+                    , eprChildElement.getQName())) {
+
+                // since we have the model for WS-Final, we don't have a place to keep this reference properties.
+                // The only compatible place is reference properties
+
+                Iterator referenceParameters = eprChildElement.getChildElements();
+                while (referenceParameters.hasNext()) {
+                    OMElement element = (OMElement) referenceParameters.next();
+                    epr.addReferenceParameter(element);
+                }
+            }else {
+                epr.addExtensibleElement(eprChildElement);
+            }
+        }
+        
+        Iterator allAttributes = headerBlock.getAllAttributes();
+        while (allAttributes.hasNext()) {
+            OMAttribute attribute = (OMAttribute) allAttributes.next();
+            epr.addAttribute(attribute);
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityActionMessage.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityActionMessage.xml?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityActionMessage.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityActionMessage.xml Thu May  4 20:19:55 2006
@@ -0,0 +1,54 @@
+<!--
+ Copyright 2004,2005 The Apache Software Foundation.
+ Copyright 2006 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.
+ -->
+<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 soapenv:mustUnderstand="0">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From soapenv:mustUnderstand="0">
+            <wsa:Address>
+                http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
+        </wsa:From>
+        <axis2:ParamOne wsa:IsReferenceParameter='true'>123456789</axis2:ParamOne>
+        <axis2:ParamTwo wsa:IsReferenceParameter='true'>ABCDEFG</axis2:ParamTwo>
+        <wsa:ReplyTo>
+            <wsa:Address>http://example.com/fabrikam/acct</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+        </wsa:ReplyTo>
+        <wsa:Action>http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:Action>http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:FaultTo>
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+        </wsa:FaultTo>
+    </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>

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityFaultToMessage.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityFaultToMessage.xml?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityFaultToMessage.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityFaultToMessage.xml Thu May  4 20:19:55 2006
@@ -0,0 +1,56 @@
+<!--
+ Copyright 2004,2005 The Apache Software Foundation.
+ Copyright 2006 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.
+ -->
+<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 soapenv:mustUnderstand="0">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From soapenv:mustUnderstand="0">
+            <wsa:Address>
+                http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
+        </wsa:From>
+        <axis2:ParamOne wsa:IsReferenceParameter='true'>123456789</axis2:ParamOne>
+        <axis2:ParamTwo wsa:IsReferenceParameter='true'>ABCDEFG</axis2:ParamTwo>
+        <wsa:ReplyTo>
+            <wsa:Address>http://example.com/fabrikam/acct</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+        </wsa:ReplyTo>
+        <wsa:Action>http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:FaultTo>
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+        </wsa:FaultTo>
+        <wsa:FaultTo>
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+        </wsa:FaultTo>
+    </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>

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityFromMessage.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityFromMessage.xml?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityFromMessage.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityFromMessage.xml Thu May  4 20:19:55 2006
@@ -0,0 +1,57 @@
+<!--
+ Copyright 2004,2005 The Apache Software Foundation.
+ Copyright 2006 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.
+ -->
+<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 soapenv:mustUnderstand="0">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From soapenv:mustUnderstand="0">
+            <wsa:Address>
+                http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
+        </wsa:From>
+        <wsa:From soapenv:mustUnderstand="0">
+            <wsa:Address>
+                http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
+        </wsa:From>
+        <axis2:ParamOne wsa:IsReferenceParameter='true'>123456789</axis2:ParamOne>
+        <axis2:ParamTwo wsa:IsReferenceParameter='true'>ABCDEFG</axis2:ParamTwo>
+        <wsa:ReplyTo>
+            <wsa:Address>http://example.com/fabrikam/acct</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+        </wsa:ReplyTo>
+        <wsa:Action>http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:FaultTo>
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+        </wsa:FaultTo>
+    </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>

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityMessageIDMessage.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityMessageIDMessage.xml?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityMessageIDMessage.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityMessageIDMessage.xml Thu May  4 20:19:55 2006
@@ -0,0 +1,55 @@
+<!--
+ Copyright 2004,2005 The Apache Software Foundation.
+ Copyright 2006 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.
+ -->
+<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 soapenv:mustUnderstand="0">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:MessageID soapenv:mustUnderstand="0">
+            uuid:820C5190-0B8F-11D9-8DDD-F67EDEEBF7Z6</wsa:MessageID>
+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From soapenv:mustUnderstand="0">
+            <wsa:Address>
+                http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
+        </wsa:From>
+        <axis2:ParamOne wsa:IsReferenceParameter='true'>123456789</axis2:ParamOne>
+        <axis2:ParamTwo wsa:IsReferenceParameter='true'>ABCDEFG</axis2:ParamTwo>
+        <wsa:ReplyTo>
+            <wsa:Address>http://example.com/fabrikam/acct</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+        </wsa:ReplyTo>
+        <wsa:Action>http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:FaultTo>
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+        </wsa:FaultTo>
+    </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>

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityReplyToMessage.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityReplyToMessage.xml?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityReplyToMessage.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityReplyToMessage.xml Thu May  4 20:19:55 2006
@@ -0,0 +1,59 @@
+<!--
+ Copyright 2004,2005 The Apache Software Foundation.
+ Copyright 2006 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.
+ -->
+<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 soapenv:mustUnderstand="0">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From soapenv:mustUnderstand="0">
+            <wsa:Address>
+                http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
+        </wsa:From>
+        <axis2:ParamOne wsa:IsReferenceParameter='true'>123456789</axis2:ParamOne>
+        <axis2:ParamTwo wsa:IsReferenceParameter='true'>ABCDEFG</axis2:ParamTwo>
+        <wsa:ReplyTo>
+            <wsa:Address>http://example.com/fabrikam/acct</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+        </wsa:ReplyTo>
+        <wsa:Action>http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:ReplyTo>
+            <wsa:Address>http://example.com/fabrikam/acct2</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+            </wsa:ReferenceParameters>
+        </wsa:ReplyTo>
+        <wsa:FaultTo>
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+        </wsa:FaultTo>
+    </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>

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityToMessage.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityToMessage.xml?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityToMessage.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/final/invalidCardinalityToMessage.xml Thu May  4 20:19:55 2006
@@ -0,0 +1,54 @@
+<!--
+ Copyright 2004,2005 The Apache Software Foundation.
+ Copyright 2006 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.
+ -->
+<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 soapenv:mustUnderstand="0">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From soapenv:mustUnderstand="0">
+            <wsa:Address>
+                http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
+        </wsa:From>
+        <axis2:ParamOne wsa:IsReferenceParameter='true'>123456789</axis2:ParamOne>
+        <axis2:ParamTwo wsa:IsReferenceParameter='true'>ABCDEFG</axis2:ParamTwo>
+        <wsa:ReplyTo>
+            <wsa:Address>http://example.com/fabrikam/acct</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+        </wsa:ReplyTo>
+        <wsa:Action>http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:FaultTo>
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+        </wsa:FaultTo>
+    </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>

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityActionMessage.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityActionMessage.xml?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityActionMessage.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityActionMessage.xml Thu May  4 20:19:55 2006
@@ -0,0 +1,54 @@
+<!--
+ Copyright 2004,2005 The Apache Software Foundation.
+ Copyright 2006 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.
+ -->
+<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">
+    <soapenv:Header xmlns:fabrikam="http://example.com/fabrikam" xmlns:axis2="http://ws.apache.org/namespaces/axis2">
+        <wsa:MessageID soapenv:mustUnderstand="0">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From soapenv:mustUnderstand="0">
+            <wsa:Address>
+                http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
+        </wsa:From>
+        <axis2:ParamOne wsa:IsReferenceParameter='true'>123456789</axis2:ParamOne>
+        <axis2:ParamTwo wsa:IsReferenceParameter='true'>ABCDEFG</axis2:ParamTwo>
+        <wsa:ReplyTo>
+            <wsa:Address>http://example.com/fabrikam/acct</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+        </wsa:ReplyTo>
+        <wsa:Action>http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:Action>http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:FaultTo>
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+        </wsa:FaultTo>
+    </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>

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityFaultToMessage.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityFaultToMessage.xml?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityFaultToMessage.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityFaultToMessage.xml Thu May  4 20:19:55 2006
@@ -0,0 +1,56 @@
+<!--
+ Copyright 2004,2005 The Apache Software Foundation.
+ Copyright 2006 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.
+ -->
+<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">
+    <soapenv:Header xmlns:fabrikam="http://example.com/fabrikam" xmlns:axis2="http://ws.apache.org/namespaces/axis2">
+        <wsa:MessageID soapenv:mustUnderstand="0">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From soapenv:mustUnderstand="0">
+            <wsa:Address>
+                http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
+        </wsa:From>
+        <axis2:ParamOne wsa:IsReferenceParameter='true'>123456789</axis2:ParamOne>
+        <axis2:ParamTwo wsa:IsReferenceParameter='true'>ABCDEFG</axis2:ParamTwo>
+        <wsa:ReplyTo>
+            <wsa:Address>http://example.com/fabrikam/acct</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+        </wsa:ReplyTo>
+        <wsa:Action>http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:FaultTo>
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+        </wsa:FaultTo>
+        <wsa:FaultTo>
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+        </wsa:FaultTo>
+    </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>

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityFromMessage.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityFromMessage.xml?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityFromMessage.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityFromMessage.xml Thu May  4 20:19:55 2006
@@ -0,0 +1,57 @@
+<!--
+ Copyright 2004,2005 The Apache Software Foundation.
+ Copyright 2006 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.
+ -->
+<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">
+    <soapenv:Header xmlns:fabrikam="http://example.com/fabrikam" xmlns:axis2="http://ws.apache.org/namespaces/axis2">
+        <wsa:MessageID soapenv:mustUnderstand="0">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From soapenv:mustUnderstand="0">
+            <wsa:Address>
+                http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
+        </wsa:From>
+        <wsa:From soapenv:mustUnderstand="0">
+            <wsa:Address>
+                http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
+        </wsa:From>
+        <axis2:ParamOne wsa:IsReferenceParameter='true'>123456789</axis2:ParamOne>
+        <axis2:ParamTwo wsa:IsReferenceParameter='true'>ABCDEFG</axis2:ParamTwo>
+        <wsa:ReplyTo>
+            <wsa:Address>http://example.com/fabrikam/acct</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+        </wsa:ReplyTo>
+        <wsa:Action>http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:FaultTo>
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+        </wsa:FaultTo>
+    </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>

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityMessageIDMessage.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityMessageIDMessage.xml?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityMessageIDMessage.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityMessageIDMessage.xml Thu May  4 20:19:55 2006
@@ -0,0 +1,55 @@
+<!--
+ Copyright 2004,2005 The Apache Software Foundation.
+ Copyright 2006 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.
+ -->
+<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">
+    <soapenv:Header xmlns:fabrikam="http://example.com/fabrikam" xmlns:axis2="http://ws.apache.org/namespaces/axis2">
+        <wsa:MessageID soapenv:mustUnderstand="0">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:MessageID soapenv:mustUnderstand="0">
+            uuid:820C5190-0B8F-11D9-8DDD-F67EDEEBF7Z6</wsa:MessageID>
+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From soapenv:mustUnderstand="0">
+            <wsa:Address>
+                http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
+        </wsa:From>
+        <axis2:ParamOne wsa:IsReferenceParameter='true'>123456789</axis2:ParamOne>
+        <axis2:ParamTwo wsa:IsReferenceParameter='true'>ABCDEFG</axis2:ParamTwo>
+        <wsa:ReplyTo>
+            <wsa:Address>http://example.com/fabrikam/acct</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+        </wsa:ReplyTo>
+        <wsa:Action>http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:FaultTo>
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+        </wsa:FaultTo>
+    </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>

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityReplyToMessage.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityReplyToMessage.xml?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityReplyToMessage.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityReplyToMessage.xml Thu May  4 20:19:55 2006
@@ -0,0 +1,59 @@
+<!--
+ Copyright 2004,2005 The Apache Software Foundation.
+ Copyright 2006 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.
+ -->
+<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">
+    <soapenv:Header xmlns:fabrikam="http://example.com/fabrikam" xmlns:axis2="http://ws.apache.org/namespaces/axis2">
+        <wsa:MessageID soapenv:mustUnderstand="0">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From soapenv:mustUnderstand="0">
+            <wsa:Address>
+                http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
+        </wsa:From>
+        <axis2:ParamOne wsa:IsReferenceParameter='true'>123456789</axis2:ParamOne>
+        <axis2:ParamTwo wsa:IsReferenceParameter='true'>ABCDEFG</axis2:ParamTwo>
+        <wsa:ReplyTo>
+            <wsa:Address>http://example.com/fabrikam/acct</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+        </wsa:ReplyTo>
+        <wsa:Action>http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:ReplyTo>
+            <wsa:Address>http://example.com/fabrikam/acct2</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+            </wsa:ReferenceParameters>
+        </wsa:ReplyTo>
+        <wsa:FaultTo>
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+        </wsa:FaultTo>
+    </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>

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityToMessage.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityToMessage.xml?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityToMessage.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/invalid-cardinality-messages/submission/invalidCardinalityToMessage.xml Thu May  4 20:19:55 2006
@@ -0,0 +1,54 @@
+<!--
+ Copyright 2004,2005 The Apache Software Foundation.
+ Copyright 2006 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.
+ -->
+<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">
+    <soapenv:Header xmlns:fabrikam="http://example.com/fabrikam" xmlns:axis2="http://ws.apache.org/namespaces/axis2">
+        <wsa:MessageID soapenv:mustUnderstand="0">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From soapenv:mustUnderstand="0">
+            <wsa:Address>
+                http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
+        </wsa:From>
+        <axis2:ParamOne wsa:IsReferenceParameter='true'>123456789</axis2:ParamOne>
+        <axis2:ParamTwo wsa:IsReferenceParameter='true'>ABCDEFG</axis2:ParamTwo>
+        <wsa:ReplyTo>
+            <wsa:Address>http://example.com/fabrikam/acct</wsa:Address>
+            <wsa:ReferenceParameters>
+                <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+                <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+            </wsa:ReferenceParameters>
+        </wsa:ReplyTo>
+        <wsa:Action>http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:FaultTo>
+            <wsa:Address>http://example.com/fabrikam/fault</wsa:Address>
+        </wsa:FaultTo>
+    </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>

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/final/soapmessage.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/final/soapmessage.xml?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/final/soapmessage.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/final/soapmessage.xml Thu May  4 20:19:55 2006
@@ -0,0 +1,58 @@
+<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 soapenv:mustUnderstand="0">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From soapenv:mustUnderstand="0" axis2:AttrExt="123456789">
+            <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>
+        <axis2:ParamOne wsa:IsReferenceParameter='true'>123456789</axis2:ParamOne>
+        <axis2:ParamTwo wsa:IsReferenceParameter='true'>ABCDEFG</axis2:ParamTwo>
+        <wsa:Action>http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:ReplyTo axis2:AttrExt="123456789">
+            <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">
+            <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>http://some.previous.message</wsa:RelatesTo>
+        <wsa:RelatesTo RelationshipType="http://some.custom.relationship">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.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/submission/soapmessage.xml?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/submission/soapmessage.xml (added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/valid-messages/submission/soapmessage.xml Thu May  4 20:19:55 2006
@@ -0,0 +1,57 @@
+<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 soapenv:mustUnderstand="0">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From axis2:AttrExt="123456789" soapenv:mustUnderstand="0" >
+            <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>http://ws.apache.org/tests/action</wsa:Action>
+        <wsa:ReplyTo axis2:AttrExt="123456789">
+            <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">
+            <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>http://some.previous.message</wsa:RelatesTo>
+        <wsa:RelatesTo RelationshipType="axis2:some.custom.relationship">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/org/apache/axis2/handlers/addressing/AddressingFinalInHandlerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingFinalInHandlerTest.java?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingFinalInHandlerTest.java (added)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingFinalInHandlerTest.java Thu May  4 20:19:55 2006
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.handlers.addressing;
+
+import java.util.ArrayList;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class AddressingFinalInHandlerTest extends AddressingInHandlerTestBase {
+
+    private Log log = LogFactory.getLog(getClass());
+   
+    /**
+     * @param testName
+     */
+    public AddressingFinalInHandlerTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        inHandler = new AddressingFinalInHandler();
+        addressingNamespace = AddressingConstants.Final.WSA_NAMESPACE;
+        versionDirectory = "final";
+        fromAddress = "http://www.w3.org/2005/08/addressing/anonymous";
+        secondRelationshipType = "http://some.custom.relationship";
+    }
+
+    public void testExtractAddressingInformationFromHeaders() {
+        try {
+            Options options = extractAddressingInformationFromHeaders();
+            
+            assertNotNull(options);
+            assertNotNull(options.getTo());
+   
+            Map allReferenceParameters = options.getTo().getAllReferenceParameters();
+            assertNotNull(allReferenceParameters);
+            QName qName = new QName("http://ws.apache.org/namespaces/axis2", "ParamOne", "axis2");
+            assertNotNull(allReferenceParameters.get(qName));
+
+            assertEPRHasCorrectMetadata(options.getFrom());
+            assertEPRHasCorrectMetadata(options.getFaultTo());
+            assertEPRHasCorrectMetadata(options.getReplyTo());
+            
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+            fail(" An Exception has occured " + e.getMessage());
+        }
+    }
+    
+    private void assertEPRHasCorrectMetadata(EndpointReference epr){
+    	ArrayList metadata = epr.getMetaData();
+    	if(metadata != null){
+    		OMElement md = (OMElement)metadata.get(0);
+    		assertEquals(md.getQName(),new QName("http://ws.apache.org/namespaces/axis2","MetaExt"));
+    		assertEquals(md.getText(),"123456789");
+    		assertEquals(md.getAttributeValue(new QName("http://ws.apache.org/namespaces/axis2","AttrExt")),"123456789");
+    	}else{
+    		fail("No Metadata found in EPR");
+    	}
+    }
+}

Added: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTestBase.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTestBase.java?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTestBase.java (added)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTestBase.java Thu May  4 20:19:55 2006
@@ -0,0 +1,288 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.handlers.addressing;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+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.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.MessageContext;
+import org.apache.axis2.handlers.util.TestUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public abstract class AddressingInHandlerTestBase extends TestCase {
+    private Log log = LogFactory.getLog(getClass());
+    AddressingInHandler inHandler;
+    String addressingNamespace;
+    TestUtil testUtil = new TestUtil();
+    private String testFileName = "soapmessage.xml";
+    
+    String versionDirectory;
+
+    private String action = "http://ws.apache.org/tests/action";
+    private String messageID = "uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5";
+    String fromAddress;
+    String secondRelationshipType;
+    private String faultAddress = "http://example.com/fabrikam/fault";
+    private String replyAddress = "http://example.com/fabrikam/acct";
+    private String toAddress    = "http://localhost:8081/axis/services/BankPort";
+ 
+    /**
+     * @param testName
+     */
+    public AddressingInHandlerTestBase(String testName) {
+        super(testName);
+    }
+
+    protected void basicExtractAddressingInformationFromHeaders(String testMessagePath, MessageContext mc) throws Exception{
+    	StAXSOAPModelBuilder omBuilder = testUtil.getOMBuilder(testMessagePath);
+        SOAPHeader header = ((SOAPEnvelope) omBuilder.getDocumentElement()).getHeader();
+        ArrayList addressingHeaderBlocks = header.getHeaderBlocksWithNSURI(addressingNamespace);
+        inHandler.extractAddressingInformation(header, mc, addressingHeaderBlocks, addressingNamespace);
+    }
+    
+    protected Options extractAddressingInformationFromHeaders(){
+    	try {
+            String testfile = "valid-messages/"+versionDirectory+"/"+testFileName;
+
+            MessageContext mc = new MessageContext();
+            
+            basicExtractAddressingInformationFromHeaders(testfile, mc);
+         
+            Options options = mc.getOptions();
+
+            if (options == null) {
+                fail("Addressing Information Headers have not been retrieved properly");
+            }
+            assertEquals("action header is not correct",
+                    options.getAction(),
+                    action);
+            assertEquals("message id header is not correct",
+                    options.getMessageId().trim(),
+                    messageID.trim());
+
+            assertFullFromEPR(options.getFrom());
+            assertFullFaultEPR(options.getFaultTo());
+            assertFullReplyToEPR(options.getReplyTo());
+
+            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) {
+    	String testfile = "invalid-cardinality-messages/"+versionDirectory+"/invalidCardinality"+headerName+"Message.xml";
+        try {
+            MessageContext mc = new MessageContext();
+            try{
+            	basicExtractAddressingInformationFromHeaders(testfile, mc);            
+            	fail("An AxisFault should have been thrown due to 2 wsa:"+headerName+" headers.");
+            }catch(AxisFault af){
+            	if(headerName.equals(AddressingConstants.WSA_REPLY_TO)){
+            		assertNull("No ReplyTo should be set on the MessageContext", mc.getReplyTo());
+            	}else{
+            		assertReplyToEPR(mc.getReplyTo());
+            	}
+            	
+            	if(headerName.equals(AddressingConstants.WSA_FAULT_TO)){
+            		assertNull("No FaultTo should be set on the MessageContext", mc.getFaultTo());
+            	}else{
+            		assertFaultEPR(mc.getFaultTo());
+            	}
+            	
+            	if(headerName.equals(AddressingConstants.WSA_ACTION)){
+            		assertNull("No Action should be set on the MessageContext", mc.getWSAAction());
+            	}else{
+            		assertEquals("WSAAction property is not correct", mc.getWSAAction(), action);
+            	}
+            	
+            	if(headerName.equals(AddressingConstants.WSA_MESSAGE_ID)){
+            		assertNull("No MessageID should be set on the MessageContext", mc.getMessageID());
+            	}else{
+            		assertEquals("MessageID property is not correct", mc.getMessageID().trim(), messageID.trim());
+            	}
+            	
+            	if(headerName.equals(AddressingConstants.WSA_FROM)){
+            		assertNull("No From should be set on the MessageContext", mc.getFrom());
+            	}else{
+            		assertFromEPR(mc.getFrom());
+            	}
+            	
+            	if(headerName.equals(AddressingConstants.WSA_TO)){
+            		assertNull("No To should be set on the MessageContext", mc.getTo());
+            	}else{
+            		assertToEPR(mc.getTo());
+            	}
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.info(e.getMessage());
+            fail(" An Exception has occured " + e.getMessage());
+        }
+    }
+    
+    public void testExtractAddressingInformationFromHeadersInvalidCardinalityReplyTo() {
+    	testExtractAddressingInformationFromHeadersInvalidCardinality(AddressingConstants.WSA_REPLY_TO);
+    }
+
+    public void testExtractAddressingInformationFromHeadersInvalidCardinalityFaultTo() {
+        testExtractAddressingInformationFromHeadersInvalidCardinality(AddressingConstants.WSA_FAULT_TO);
+    }
+    
+    public void testExtractAddressingInformationFromHeadersInvalidCardinalityAction() {
+        testExtractAddressingInformationFromHeadersInvalidCardinality(AddressingConstants.WSA_ACTION);
+    }
+    
+    public void testExtractAddressingInformationFromHeadersInvalidCardinalityMessageID() {
+        testExtractAddressingInformationFromHeadersInvalidCardinality(AddressingConstants.WSA_MESSAGE_ID);
+    }
+    
+    public void testExtractAddressingInformationFromHeadersInvalidCardinalityFrom() {
+        testExtractAddressingInformationFromHeadersInvalidCardinality(AddressingConstants.WSA_FROM);
+    }
+
+    public void testExtractAddressingInformationFromHeadersInvalidCardinalityTo() {
+        testExtractAddressingInformationFromHeadersInvalidCardinality(AddressingConstants.WSA_TO);
+    }
+    
+    private void assertFromEPR(EndpointReference fromEPR) {
+        assertEquals("Address in From EPR is not valid",
+                fromEPR.getAddress().trim(),
+                fromAddress.trim());
+    }
+    
+    private void assertFaultEPR(EndpointReference faultEPR) {
+        assertEquals("Address in FaultTo EPR is not valid",
+        		faultEPR.getAddress().trim(),
+                faultAddress.trim());
+    }
+    
+    private void assertReplyToEPR(EndpointReference replyEPR) {
+        assertEquals("Address in ReplytTo EPR is not valid",
+        		replyEPR.getAddress().trim(),
+                replyAddress.trim());
+    }
+    
+    private void assertToEPR(EndpointReference toEPR) {
+        assertEquals("Address in To EPR is not valid",
+        		toEPR.getAddress().trim(),
+                toAddress.trim());
+    }
+    
+    private void assertFullFromEPR(EndpointReference fromEPR) {
+        assertEquals("Address in From EPR is not valid",
+                fromEPR.getAddress().trim(),
+                fromAddress.trim());
+        assertEPRHasExtensibilityAttribute(fromEPR);
+        assertEPRHasCorrectReferenceParameters(fromEPR);
+        assertEPRHasCorrectExtensibilityElements(fromEPR);
+    }
+    
+    private void assertFullFaultEPR(EndpointReference faultEPR) {
+        assertEquals("Address in FaultTo EPR is not valid",
+        		faultEPR.getAddress().trim(),
+                faultAddress.trim());
+        assertEPRHasExtensibilityAttribute(faultEPR);
+        assertEPRHasCorrectReferenceParameters(faultEPR);
+        assertEPRHasCorrectExtensibilityElements(faultEPR);
+    }
+    
+    private void assertFullReplyToEPR(EndpointReference replyEPR) {
+        assertEquals("Address in ReplytTo EPR is not valid",
+        		replyEPR.getAddress().trim(),
+                replyAddress.trim());
+        assertEPRHasExtensibilityAttribute(replyEPR);
+        assertEPRHasCorrectReferenceParameters(replyEPR);
+        assertEPRHasCorrectExtensibilityElements(replyEPR);
+    }
+    
+    private void assertEPRHasCorrectReferenceParameters(EndpointReference epr){
+    	//<wsa:ReferenceParameters>
+        //  <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
+        //  <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
+    	//</wsa:ReferenceParameters>
+    	Map referenceParameters = epr.getAllReferenceParameters();
+    	if(referenceParameters != null){
+    		OMElement refparm1 = (OMElement)referenceParameters.get(new QName("http://example.com/fabrikam","CustomerKey"));
+    		assertNotNull(refparm1);
+    		assertEquals("ReferenceParameter value incorrect.",refparm1.getText(),"123456789");
+    		
+    		OMElement refparm2 = (OMElement)referenceParameters.get(new QName("http://example.com/fabrikam","ShoppingCart"));
+    		assertNotNull(refparm2);
+    		assertEquals("ReferenceParameter value incorrect.",refparm2.getText(),"ABCDEFG");
+    	}else{
+    		fail("No ReferenceParameters found in EPR");
+    	}
+    }
+    
+    private void assertEPRHasExtensibilityAttribute(EndpointReference epr){
+    	boolean attributeFound=false;
+    	ArrayList attributes = epr.getAttributes();
+    	if(attributes!=null){
+	        Iterator iter = attributes.iterator();
+	        while(iter.hasNext()){
+	        	OMAttribute oa = (OMAttribute)iter.next();
+	        	if(oa.getLocalName().equals("AttrExt")){
+	        		attributeFound = true;
+	        		assertEquals("Attribute value incorrectly deserialised",oa.getAttributeValue(),"123456789");
+	        	}
+	        }
+    	}
+        assertTrue("Extensibility attribute not found on EPR", attributeFound);
+    }
+    
+    private void assertEPRHasCorrectExtensibilityElements(EndpointReference epr){
+    	ArrayList eelements = epr.getExtensibleElements();
+    	if(eelements != null){
+    		OMElement ee = (OMElement)eelements.get(0);
+    		assertEquals(ee.getQName(),new QName("http://ws.apache.org/namespaces/axis2","EPRExt"));
+    		assertEquals(ee.getText(),"123456789");
+    		assertEquals(ee.getAttributeValue(new QName("http://ws.apache.org/namespaces/axis2","AttrExt")),"123456789");
+    	}else{
+    		fail("No Extensibility Elements found in EPR");
+    	}
+    }
+    
+    private void assertRelationships(Options options) {
+    	assertNotNull(options.getRelatesTo());
+    	assertEquals(options.getRelatesTo().getValue(),"http://some.previous.message");
+    	assertEquals(options.getRelatesTo(secondRelationshipType).getValue(),"http://identifier.of.other.message/");
+	}
+}

Added: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandlerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandlerTest.java?rev=399923&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandlerTest.java (added)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandlerTest.java Thu May  4 20:19:55 2006
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.handlers.addressing;
+
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.client.Options;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class AddressingSubmissionInHandlerTest extends AddressingInHandlerTestBase {
+
+    private Log log = LogFactory.getLog(getClass());
+   
+    /**
+     * @param testName
+     */
+    public AddressingSubmissionInHandlerTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        inHandler = new AddressingSubmissionInHandler();
+        addressingNamespace = AddressingConstants.Submission.WSA_NAMESPACE;
+        versionDirectory = "submission";
+        fromAddress = "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous";
+        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());
+        }
+    }
+}