axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prad...@apache.org
Subject svn commit: r498584 - in /webservices/axis2/trunk/java/modules/addressing: ./ src/META-INF/ src/org/apache/axis2/handlers/addressing/ test/org/apache/axis2/handlers/util/
Date Mon, 22 Jan 2007 11:26:08 GMT
Author: pradine
Date: Mon Jan 22 03:26:07 2007
New Revision: 498584

URL: http://svn.apache.org/viewvc?view=rev&rev=498584
Log:
Changes related to AXIS2-1967

Added:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java
      - copied, changed from r496698, webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingWSDLValidationHandler.java
Removed:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingWSDLValidationHandler.java
Modified:
    webservices/axis2/trunk/java/modules/addressing/project.xml
    webservices/axis2/trunk/java/modules/addressing/src/META-INF/module.xml
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalInHandler.java
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java
    webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/util/TestUtil.java

Modified: webservices/axis2/trunk/java/modules/addressing/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/project.xml?view=diff&rev=498584&r1=498583&r2=498584
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/project.xml (original)
+++ webservices/axis2/trunk/java/modules/addressing/project.xml Mon Jan 22 03:26:07 2007
@@ -107,6 +107,11 @@
                 <module>true</module>
             </properties>
         </dependency>
+         <dependency>
+            <groupId>org.apache.ws.commons.schema</groupId>
+            <artifactId>XmlSchema</artifactId>
+            <version>${XmlSchema.version}</version>
+        </dependency>
         <dependency>
             <groupId>javax.mail</groupId>
             <artifactId>mail</artifactId>

Modified: webservices/axis2/trunk/java/modules/addressing/src/META-INF/module.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/META-INF/module.xml?view=diff&rev=498584&r1=498583&r2=498584
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/META-INF/module.xml (original)
+++ webservices/axis2/trunk/java/modules/addressing/src/META-INF/module.xml Mon Jan 22 03:26:07
2007
@@ -7,7 +7,7 @@
         <handler name="AddressingSubmissionInHandler" class="org.apache.axis2.handlers.addressing.AddressingSubmissionInHandler">
             <order phase="PreDispatch"/>
         </handler>
-        <handler name="AddressingWSDLValidationHandler" class="org.apache.axis2.handlers.addressing.AddressingWSDLValidationHandler">
+        <handler name="AddressingValidationHandler" class="org.apache.axis2.handlers.addressing.AddressingValidationHandler">
             <order phase="Dispatch" after="AddressingBasedDispatcher" />
         </handler>
     </InFlow>
@@ -32,6 +32,6 @@
         <handler name="AddressingSubmissionInHandler" class="org.apache.axis2.handlers.addressing.AddressingSubmissionInHandler">
             <order phase="PreDispatch"/>
         </handler>
-        <!-- AddressingWSDLValidationHandler not present on the INfaultflow so that we
don't get faults bouncing around forever -->
+        <!-- AddressingValidationHandler not present on the INfaultflow so that we don't
get faults bouncing around forever -->
     </InFaultFlow>
 </module>

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalInHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalInHandler.java?view=diff&rev=498584&r1=498583&r2=498584
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalInHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalInHandler.java
Mon Jan 22 03:26:07 2007
@@ -60,6 +60,8 @@
     }
 
     protected void checkForMandatoryHeaders(ArrayList alreadyFoundAddrHeader, MessageContext
messageContext) throws AxisFault {
+        //Validation of the wsa:MessageID is performed in the AddressingValidationHandler.
+        
         if (!alreadyFoundAddrHeader.contains(WSA_ACTION)) {
             AddressingFaultsHelper.triggerMessageAddressingRequiredFault(messageContext,
WSA_ACTION);
         } 

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java?view=diff&rev=498584&r1=498583&r2=498584
==============================================================================
--- 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
Mon Jan 22 03:26:07 2007
@@ -48,7 +48,6 @@
 
     protected void checkForMandatoryHeaders(ArrayList alreadyFoundAddrHeader, MessageContext
messageContext) throws AxisFault {
         if (!alreadyFoundAddrHeader.contains(WSA_TO)) {
-            // Should write a new SubmissionFaults class but for the moment use the FinalFaults
             AddressingFaultsHelper.triggerMessageAddressingRequiredFault(messageContext,
WSA_TO);
         }
         

Copied: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java
(from r496698, webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingWSDLValidationHandler.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java?view=diff&rev=498584&p1=webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingWSDLValidationHandler.java&r1=496698&p2=webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java&r2=498584
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingWSDLValidationHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java
Mon Jan 22 03:26:07 2007
@@ -21,26 +21,42 @@
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.AddressingFaultsHelper;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.handlers.AbstractHandler;
 import org.apache.axis2.util.JavaUtils;
+import org.apache.axis2.util.Utils;
+import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-public class AddressingWSDLValidationHandler extends AbstractHandler implements AddressingConstants
{
+public class AddressingValidationHandler extends AbstractHandler implements AddressingConstants
{
 
-    private static final Log log = LogFactory.getLog(AddressingWSDLValidationHandler.class);
+    private static final Log log = LogFactory.getLog(AddressingValidationHandler.class);
     
     /* (non-Javadoc)
      * @see org.apache.axis2.engine.Handler#invoke(org.apache.axis2.context.MessageContext)
      */
     public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
-    	// If no AxisOperation has been found at the end of the dispatch phase and addressing
-        // is in use we should throw an ActionNotSupported Fault
-        checkAction(msgContext);
-        // Check that if wsaddressing=required that addressing headers were found inbound
-        checkUsingAddressing(msgContext);
-        // Check that if anonymous flag is in effect that the replyto and faultto are valid
-        //checkAnonymous(msgContext);
+        Object flag = msgContext.getProperty(IS_ADDR_INFO_ALREADY_PROCESSED);
+        if (log.isTraceEnabled()){
+            log.trace("invoke: IS_ADDR_INFO_ALREADY_PROCESSED=" + flag);
+        }
+        
+        if (JavaUtils.isTrueExplicitly(flag)) {
+            // If no AxisOperation has been found at the end of the dispatch phase and addressing
+            // is in use we should throw an ActionNotSupported Fault
+            checkAction(msgContext);
+            // Check if the wsa:MessageID is required or not.
+            checkMessageIDHeader(msgContext);
+            // Check that if anonymous flag is in effect that the replyto and faultto are
valid
+            //checkAnonymous(msgContext);
+        }
+        
+        if (JavaUtils.isFalseExplicitly(flag)) {
+            // Check that if wsaddressing=required that addressing headers were found inbound
+            checkUsingAddressing(msgContext);            
+        }
+        
         return InvocationResponse.CONTINUE;        
     }
     
@@ -62,13 +78,7 @@
             log.trace("checkUsingAddressing: WSAddressingFlag=" + addressingFlag);
         }
         if (AddressingConstants.ADDRESSING_REQUIRED.equals(addressingFlag)) {
-            Object flag = msgContext.getProperty(AddressingConstants.IS_ADDR_INFO_ALREADY_PROCESSED);
-            if (log.isTraceEnabled()){
-                log.trace("checkUsingAddressing: IS_ADDR_INFO_ALREADY_PROCESSED=" + flag);
-            }
-            if (JavaUtils.isFalseExplicitly(flag)) {
-                AddressingFaultsHelper.triggerMessageAddressingRequiredFault(msgContext,AddressingConstants.WSA_ACTION);
-            }
+            AddressingFaultsHelper.triggerMessageAddressingRequiredFault(msgContext,AddressingConstants.WSA_ACTION);
         }
     }
     
@@ -110,13 +120,37 @@
      * is moved into the addressing module
      */
     private void checkAction(MessageContext msgContext) throws AxisFault{
-        Object flag = msgContext.getProperty(AddressingConstants.IS_ADDR_INFO_ALREADY_PROCESSED);
-        if (log.isTraceEnabled()){
-            log.trace("checkAction: IS_ADDR_INFO_ALREADY_PROCESSED=" + flag);
+        if((msgContext.getAxisService() == null) || (msgContext.getAxisOperation() == null)){
+            AddressingFaultsHelper.triggerActionNotSupportedFault(msgContext, msgContext.getWSAAction());
         }
-        if(JavaUtils.isTrueExplicitly(flag)){
-            if((msgContext.getAxisService() == null) || (msgContext.getAxisOperation() ==
null)){
-                AddressingFaultsHelper.triggerActionNotSupportedFault(msgContext, msgContext.getWSAAction());
+    }
+    
+    /**
+     * Validate that a message id is present when required. The check applied here
+     * only applies to WS-Addressing headers that comply with the 2005/08 (final)
+     * spec. 
+     * 
+     * @param msgContext
+     * @throws AxisFault
+     * @see AddressingSubmissionInHandler#checkForMandatoryHeaders
+     */
+    private void checkMessageIDHeader(MessageContext msgContext) throws AxisFault {
+        String namespace = (String) msgContext.getProperty(WS_ADDRESSING_VERSION);
+        if (!Final.WSA_NAMESPACE.equals(namespace)) {
+            return;
+        }
+
+        AxisOperation axisOperation = msgContext.getAxisOperation();
+        String mep = axisOperation.getMessageExchangePattern();
+        int mepConstant = Utils.getAxisSpecifMEPConstant(mep);
+        
+        if (mepConstant == WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_IN_OUT ||
+            mepConstant == WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_IN_OPTIONAL_OUT
||
+            mepConstant == WSDLConstants.WSDL20_2004Constants.MEP_CONSTANT_ROBUST_IN_ONLY)
+        {
+            String messageId = msgContext.getOptions().getMessageId();
+            if (messageId == null || "".equals(messageId)) {
+                AddressingFaultsHelper.triggerMessageAddressingRequiredFault(msgContext,
WSA_MESSAGE_ID);
             }
         }
     }

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/util/TestUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/util/TestUtil.java?view=diff&rev=498584&r1=498583&r2=498584
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/util/TestUtil.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/util/TestUtil.java
Mon Jan 22 03:26:07 2007
@@ -19,7 +19,6 @@
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.apache.axiom.om.util.StAXUtils;
 
-import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamReader;
 import java.io.File;
 import java.io.FileReader;



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


Mime
View raw message