axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject svn commit: r518829 - in /webservices/axis2/trunk/java/modules: addressing/src/org/apache/axis2/handlers/addressing/ jaxws/src/org/apache/axis2/jaxws/message/attachments/ kernel/src/org/apache/axis2/engine/ kernel/src/org/apache/axis2/i18n/ kernel/test...
Date Fri, 16 Mar 2007 01:44:11 GMT
Author: gdaniels
Date: Thu Mar 15 18:44:11 2007
New Revision: 518829

URL: http://svn.apache.org/viewvc?view=rev&rev=518829
Log:
* Clean up mustUnderstand check in AxisEngine.  Now use SOAPHeader.getHeadersToProcess() to
obtain a list of targeted headers, vastly simplifying the logic in there.  Use SOAPVersion
to send back the appropriate MU fault for the active SOAP version.

* Remove deprecated references to old UUIDGenerator.


Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentMarshaller.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/i18n/resource.properties
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveATest.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveBTest.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveCTest.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSelfManagedDataTest.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/OperationContextSaveTest.java

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java?view=diff&rev=518829&r1=518828&r2=518829
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
Thu Mar 15 18:44:11 2007
@@ -68,10 +68,7 @@
             return InvocationResponse.CONTINUE;
         }
 
-        SOAPHeader header = null;
-        if (msgContext.isHeaderPresent()) {
-            header = msgContext.getEnvelope().getHeader();
-        }
+        SOAPHeader header = msgContext.getEnvelope().getHeader();
 
         // if there are not headers put a flag to disable addressing temporary
         if (header == null) {

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentMarshaller.java?view=diff&rev=518829&r1=518828&r2=518829
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentMarshaller.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentMarshaller.java
Thu Mar 15 18:44:11 2007
@@ -27,9 +27,9 @@
 import org.apache.axis2.jaxws.i18n.Messages;
 import org.apache.axis2.jaxws.message.Attachment;
 import org.apache.axis2.jaxws.message.Message;
-import org.apache.axis2.util.UUIDGenerator;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.axiom.om.util.UUIDGenerator;
 
 /**
  * An implementation of the JAXB AttachmentMarshaller that is used to 
@@ -39,9 +39,9 @@
 public class JAXBAttachmentMarshaller extends AttachmentMarshaller {
 
     private static final Log log = LogFactory.getLog(JAXBAttachmentMarshaller.class);
-    
+
     private Message message;
-    
+
     public JAXBAttachmentMarshaller() {
         super();
     }
@@ -49,10 +49,10 @@
     public void setMessage(Message msg) {
         message = msg;
     }
-    
+
     @Override
     public boolean isXOPPackage() {
-        
+
         // FIXME: This should really be set based on whether or not the 
         // we want to send MTOM for this message.  In such cases the
         // transport must identify the message as application/xop+xml
@@ -60,30 +60,30 @@
         // FIXME: This should really be set based on whether or not we
         // the SOAP 1.1 or SOAP 1.2 MTOM binding is set.
         boolean value = true;
-        if (log.isDebugEnabled()){ 
+        if (log.isDebugEnabled()){
             log.debug("isXOPPackage returns " + value);
         }
         return value;
     }
 
     @Override
-    public String addMtomAttachment(byte[] data, int offset, int length, 
-            String mimeType, String namespace, String localPart) {
-        
+    public String addMtomAttachment(byte[] data, int offset, int length,
+                                    String mimeType, String namespace, String localPart)
{
+
         String cid = UUIDGenerator.getUUID();
-        if (log.isDebugEnabled()){ 
+        if (log.isDebugEnabled()){
             log.debug("Adding MTOM/XOP byte array attachment for element: " + "{" + namespace
+ "}" + localPart);
             log.debug("   content id=" + cid);
             log.debug("   mimeType  =" + mimeType);
         }
-        
+
         DataHandler dataHandler = null;
         MimeBodyPart mbp = null;
-        
+
         try
         {
-        	//Create mime parts 
-        	InternetHeaders ih = new InternetHeaders();
+            //Create mime parts
+            InternetHeaders ih = new InternetHeaders();
             ih.setHeader(Attachment.CONTENT_TYPE, mimeType);
             ih.setHeader(Attachment.CONTENT_ID, cid);
             mbp = new MimeBodyPart(ih,data);
@@ -91,21 +91,21 @@
         catch(MessagingException me){
             throw ExceptionFactory.makeWebServiceException(Messages.getMessage("mimeBodyPartError"),me);
         }
-        
+
         //Create a data source for the byte array
         MimePartDataSource mpds = new MimePartDataSource(mbp);
-        
+
         dataHandler = new DataHandler(mpds);
         Attachment a = message.createAttachment(dataHandler, cid);
         message.addAttachment(a);
-        
+
         return cid;
     }
 
     @Override
     public String addMtomAttachment(DataHandler data, String namespace, String localPart)
{
         String cid = UUIDGenerator.getUUID();
-        if (log.isDebugEnabled()){ 
+        if (log.isDebugEnabled()){
             log.debug("Adding MTOM/XOP datahandler attachment for element: " + "{" + namespace
+ "}" + localPart);
             log.debug("   content id=" + cid);
             log.debug("   dataHandler  =" + data);
@@ -118,15 +118,15 @@
     @Override
     public String addSwaRefAttachment(DataHandler data) {
         String cid = UUIDGenerator.getUUID();
-        if (log.isDebugEnabled()){ 
+        if (log.isDebugEnabled()){
             log.debug("Adding SWAREF attachment");
             log.debug("   content id=" + cid);
             log.debug("   dataHandler  =" + data);
         }
-        
+
         Attachment a = message.createAttachment(data, cid);
         message.addAttachment(a);
         return cid;
     }
-    
+
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java?view=diff&rev=518829&r1=518828&r2=518829
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
Thu Mar 15 18:44:11 2007
@@ -22,6 +22,7 @@
 import org.apache.axiom.soap.SOAPConstants;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.soap.RolePlayer;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.client.async.Callback;
 import org.apache.axis2.context.ConfigurationContext;
@@ -38,6 +39,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import javax.xml.namespace.QName;
 import java.util.ArrayList;
 import java.util.Iterator;
 
@@ -66,69 +68,28 @@
     }
 
     private void checkMustUnderstand(MessageContext msgContext) throws AxisFault {
-
-        if (!msgContext.isHeaderPresent()) {
-            return;
-        }
         SOAPEnvelope envelope = msgContext.getEnvelope();
         if (envelope.getHeader() == null) {
             return;
         }
-        Iterator headerBlocks = envelope.getHeader().examineAllHeaderBlocks();
+
+        // Get all the headers targeted to us
+        Iterator headerBlocks = envelope.getHeader().getHeadersToProcess(null);
+
         while (headerBlocks.hasNext()) {
             SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) headerBlocks.next();
+
             // if this header block has been processed or mustUnderstand isn't
             // turned on then its cool
             if (headerBlock.isProcessed() || !headerBlock.getMustUnderstand()) {
                 continue;
             }
-            // if this header block is not targetted to me then its not my
-            // problem. Currently this code only supports the "next" role; we
-            // need to fix this to allow the engine/service to be in one or more
-            // additional roles and then to check that any headers targetted for
-            // that role too have been dealt with.
-
-            String role = headerBlock.getRole();
-
-            String prefix = envelope.getNamespace().getPrefix();
-
-            if (!msgContext.isSOAP11()) {
-
-                // if must understand and soap 1.2 the Role should be NEXT , if it is null
we consider
-                // it to be NEXT
-                if (prefix == null || "".equals(prefix)) {
-                    prefix = SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX;
-                }
-                if (role != null) {
-                    if (!SOAP12Constants.SOAP_ROLE_NEXT.equals(role)) {
-                        // TODO: should we be using a prefix on the faultcode?  What about
-                        // the QName object Constants.FAULT_SOAP12_MUSTUNDERSTAND?
-                        throw new AxisFault(Messages.getMessage(
-                                "mustunderstandfailed",
-                                prefix, SOAP12Constants.FAULT_CODE_MUST_UNDERSTAND),
-                                            SOAP12Constants.FAULT_CODE_MUST_UNDERSTAND);
-                    }
-                } else {
-                    // TODO: should we be using a prefix on the faultcode?  What about
-                    // the QName object Constants.FAULT_SOAP12_MUSTUNDERSTAND?
-                    throw new AxisFault(Messages.getMessage(
-                            "mustunderstandfailed",
-                            prefix, SOAP12Constants.FAULT_CODE_MUST_UNDERSTAND),
-                                        SOAP12Constants.FAULT_CODE_MUST_UNDERSTAND);
-                }
-            } else {
-
-                // if must understand and soap 1.1 the actor should be NEXT , if it is null
we considerr
-                // it to be NEXT
-                if ((role != null) && !SOAP11Constants.SOAP_ACTOR_NEXT.equals(role))
{
-                    // TODO: should we be using a prefix on the faultcode?  What about
-                    // the QName object Constants.FAULT_MUSTUNDERSTAND?
-                    throw new AxisFault(Messages.getMessage(
-                            "mustunderstandfailed",
-                            prefix, SOAP11Constants.FAULT_CODE_MUST_UNDERSTAND),
-                                        SOAP11Constants.FAULT_CODE_MUST_UNDERSTAND);
-                }
-            }
+
+            // Oops, throw an appropriate MustUnderstand fault!!
+            QName faultQName = headerBlock.getVersion().getMustUnderstandFaultCode();
+            throw new AxisFault(Messages.getMessage("mustunderstandfailed",
+                                                    headerBlock.getNamespace().getNamespaceURI(),
+                                                    headerBlock.getLocalName()), faultQName);
         }
     }
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/i18n/resource.properties?view=diff&rev=518829&r1=518828&r2=518829
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/i18n/resource.properties
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/i18n/resource.properties
Thu Mar 15 18:44:11 2007
@@ -230,7 +230,7 @@
 serviceinactive=The system is attempting to access an inactive service: {0}
 servicenamenotvalid=The {0} service name in not valid.
 enginestarted=The Axis engine started.
-mustunderstandfailed=Must Understand check failed {0} : {1}
+mustunderstandfailed=Must Understand check failed for header {0} : {1}
 receivederrormessage=The system received an error message with the {0} ID. 
 servicenotfoundforepr=Service not found for the endpoint reference (EPR) {0}
 operationnotfoundforepr=The endpoint reference (EPR) for the Operation not found is {0} and
the WSA Action = {1}

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveATest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveATest.java?view=diff&rev=518829&r1=518828&r2=518829
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveATest.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveATest.java
Thu Mar 15 18:44:11 2007
@@ -18,6 +18,7 @@
 
 import junit.framework.TestCase;
 import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.util.UUIDGenerator;
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
@@ -41,7 +42,6 @@
 import org.apache.axis2.transport.http.CommonsHTTPTransportSender;
 import org.apache.axis2.transport.http.SimpleHTTPServer;
 import org.apache.axis2.util.ObjectStateUtils;
-import org.apache.axis2.util.UUIDGenerator;
 import org.apache.axis2.wsdl.WSDLConstants;
 
 import javax.xml.namespace.QName;

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveBTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveBTest.java?view=diff&rev=518829&r1=518828&r2=518829
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveBTest.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveBTest.java
Thu Mar 15 18:44:11 2007
@@ -18,6 +18,7 @@
 
 import junit.framework.TestCase;
 import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.util.UUIDGenerator;
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
@@ -41,7 +42,6 @@
 import org.apache.axis2.transport.http.CommonsHTTPTransportSender;
 import org.apache.axis2.transport.http.SimpleHTTPServer;
 import org.apache.axis2.util.ObjectStateUtils;
-import org.apache.axis2.util.UUIDGenerator;
 import org.apache.axis2.wsdl.WSDLConstants;
 
 import javax.xml.namespace.QName;

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveCTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveCTest.java?view=diff&rev=518829&r1=518828&r2=518829
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveCTest.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveCTest.java
Thu Mar 15 18:44:11 2007
@@ -18,6 +18,7 @@
 
 import junit.framework.TestCase;
 import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.util.UUIDGenerator;
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
@@ -41,7 +42,6 @@
 import org.apache.axis2.transport.http.CommonsHTTPTransportSender;
 import org.apache.axis2.transport.http.SimpleHTTPServer;
 import org.apache.axis2.util.MetaDataEntry;
-import org.apache.axis2.util.UUIDGenerator;
 import org.apache.axis2.wsdl.WSDLConstants;
 
 import javax.xml.namespace.QName;

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSelfManagedDataTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSelfManagedDataTest.java?view=diff&rev=518829&r1=518828&r2=518829
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSelfManagedDataTest.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSelfManagedDataTest.java
Thu Mar 15 18:44:11 2007
@@ -18,6 +18,7 @@
 
 import junit.framework.TestCase;
 import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.util.UUIDGenerator;
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
@@ -40,7 +41,6 @@
 import org.apache.axis2.receivers.RawXMLINOutMessageReceiver;
 import org.apache.axis2.transport.http.CommonsHTTPTransportSender;
 import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.util.UUIDGenerator;
 
 import javax.xml.namespace.QName;
 import java.io.ByteArrayInputStream;

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/OperationContextSaveTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/OperationContextSaveTest.java?view=diff&rev=518829&r1=518828&r2=518829
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/OperationContextSaveTest.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/OperationContextSaveTest.java
Thu Mar 15 18:44:11 2007
@@ -18,6 +18,7 @@
 
 import junit.framework.TestCase;
 import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.util.UUIDGenerator;
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
@@ -38,7 +39,6 @@
 import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
 import org.apache.axis2.receivers.RawXMLINOutMessageReceiver;
 import org.apache.axis2.transport.http.CommonsHTTPTransportSender;
-import org.apache.axis2.util.UUIDGenerator;
 
 import javax.xml.namespace.QName;
 import java.io.File;



---------------------------------------------------------------------
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