You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ba...@apache.org on 2008/08/25 21:44:10 UTC

svn commit: r688847 - in /webservices/axis2/trunk/java/modules: jaxws-integration/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java

Author: barrettj
Date: Mon Aug 25 12:44:09 2008
New Revision: 688847

URL: http://svn.apache.org/viewvc?rev=688847&view=rev
Log:
Call JAX-WS application SOAPHandler getHeaders method on the inbound message (i.e. response) on the client side.  
Note that this is just calling getHeaders at this point; the list of headers is not used by the runtime (for example, for mustUnderstand processing).

Modified:
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java

Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java?rev=688847&r1=688846&r2=688847&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java Mon Aug 25 12:44:09 2008
@@ -195,6 +195,7 @@
                     + "AddNumbersProtocolHandler2 CLOSE\n"
                     + "AddNumbersProtocolHandler CLOSE\n"
                     + "AddNumbersProtocolHandler PRE_DESTROY\n"
+                    + "AddNumbersClientProtocolHandler GET_HEADERS\n"
                     + "AddNumbersClientProtocolHandler HANDLE_MESSAGE_INBOUND\n"
                     + "AddNumbersClientLogicalHandler HANDLE_MESSAGE_INBOUND\n"
                     + "AddNumbersClientProtocolHandler CLOSE\n"
@@ -250,6 +251,7 @@
                 + "AddNumbersProtocolHandler2 CLOSE\n"
                 + "AddNumbersProtocolHandler CLOSE\n"
                 + "AddNumbersProtocolHandler PRE_DESTROY\n"
+                + "AddNumbersClientProtocolHandler GET_HEADERS\n"
                 + "AddNumbersClientProtocolHandler HANDLE_MESSAGE_INBOUND\n"
                 + "AddNumbersClientLogicalHandler HANDLE_MESSAGE_INBOUND\n"
                 + "AddNumbersClientProtocolHandler CLOSE\n"
@@ -406,6 +408,7 @@
                 + "AddNumbersProtocolHandler2 CLOSE\n"
                 + "AddNumbersProtocolHandler CLOSE\n"
                 + "AddNumbersProtocolHandler PRE_DESTROY\n"
+                + "AddNumbersClientProtocolHandler GET_HEADERS\n"
                 + "AddNumbersClientProtocolHandler HANDLE_MESSAGE_INBOUND\n"
                 + "AddNumbersClientLogicalHandler HANDLE_MESSAGE_INBOUND\n"
                 + "AddNumbersClientProtocolHandler CLOSE\n"
@@ -465,6 +468,7 @@
                 + "AddNumbersProtocolHandler2 CLOSE\n"
                 + "AddNumbersProtocolHandler CLOSE\n"
                 + "AddNumbersProtocolHandler PRE_DESTROY\n"
+                + "AddNumbersClientProtocolHandler GET_HEADERS\n"
                 + "AddNumbersClientProtocolHandler HANDLE_MESSAGE_INBOUND\n"
                 + "AddNumbersClientLogicalHandler HANDLE_MESSAGE_INBOUND\n"
                 + "AddNumbersClientProtocolHandler CLOSE\n"
@@ -530,6 +534,7 @@
                 + "AddNumbersProtocolHandler2 CLOSE\n"
                 + "AddNumbersProtocolHandler CLOSE\n"
                 + "AddNumbersProtocolHandler PRE_DESTROY\n"
+                + "AddNumbersClientProtocolHandler GET_HEADERS\n"
                 + "AddNumbersClientProtocolHandler HANDLE_FAULT_INBOUND\n"
                 + "AddNumbersClientLogicalHandler HANDLE_FAULT_INBOUND\n"
                 + "AddNumbersClientProtocolHandler CLOSE\n"
@@ -645,6 +650,7 @@
                 + "AddNumbersProtocolHandler2 CLOSE\n"
                 + "AddNumbersProtocolHandler CLOSE\n"
                 + "AddNumbersProtocolHandler PRE_DESTROY\n"
+                + "AddNumbersClientProtocolHandler GET_HEADERS\n"
                 + "AddNumbersClientProtocolHandler HANDLE_MESSAGE_INBOUND\n"
                 + "AddNumbersClientLogicalHandler2 HANDLE_MESSAGE_INBOUND\n"
                 + "AddNumbersClientLogicalHandler HANDLE_MESSAGE_INBOUND\n"

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java?rev=688847&r1=688846&r2=688847&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java Mon Aug 25 12:44:09 2008
@@ -21,11 +21,19 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.jaxws.message.Protocol;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
+import javax.xml.namespace.QName;
 import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.soap.SOAPHandler;
+
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
 
 public class HandlerInvokerUtils {
+    private static Log log = LogFactory.getLog(HandlerInvokerUtils.class);
 
     /**
      * Invoke Inbound Handlers
@@ -40,9 +48,39 @@
         String bindingProto = null;
         if (mep.equals(HandlerChainProcessor.MEP.REQUEST)) // inbound request; must be on the server
             bindingProto = mepMessageCtx.getEndpointDesc().getBindingType();
-        else
+        else {
             // inbound response; must be on the client
             bindingProto = mepMessageCtx.getEndpointDesc().getClientBindingID();
+            // The getHeader processing is done on the server by the EndpointController.
+            // For messages inbound to the client (i.e. responses), we do it here since all three
+            // client JAX-WS APIs (i.e. sync, async, and async callback) use this method to 
+            // invoke the handlers.
+            List<QName> understood = new ArrayList<QName>();
+            for(Handler handler:handlers){
+                if(handler instanceof SOAPHandler){
+                    SOAPHandler soapHandler = (SOAPHandler)handler;
+                    //Invoking getHeaders.
+                    if(log.isDebugEnabled()){
+                        log.debug("Client side: Invoking getHeader() on SOAPHandler: " + soapHandler);
+                    }
+                    Set<QName> headers = soapHandler.getHeaders();
+                    if(headers!=null){
+                        for(QName header:headers){
+                            if(!understood.contains(header)){
+                                if(log.isDebugEnabled()){
+                                    log.debug("Adding Header QName" + header + " to uderstoodHeaderQName List");
+                                }
+                                //Adding this to understood header list.
+                                // FIXME: This list of headers undestood by the client inbound
+                                // JAX-WS handlers should be used in client-side inbound 
+                                // mustUnderstand header processing.
+                                understood.add(header);
+                            }
+                        }
+                    }
+                }
+            }
+        }
         Protocol proto = Protocol.getProtocolForBinding(bindingProto);