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 ng...@apache.org on 2007/03/28 16:28:58 UTC

svn commit: r523344 [2/2] - in /webservices/axis2/trunk/java/modules: jaxws/ jaxws/src/org/apache/axis2/jaxws/client/async/ jaxws/src/org/apache/axis2/jaxws/client/proxy/ jaxws/src/org/apache/axis2/jaxws/context/utils/ jaxws/src/org/apache/axis2/jaxws/...

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/InvocationController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/InvocationController.java?view=diff&rev=523344&r1=523343&r2=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/InvocationController.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/InvocationController.java Wed Mar 28 07:28:56 2007
@@ -22,10 +22,15 @@
 import javax.xml.ws.AsyncHandler;
 import javax.xml.ws.Response;
 
+import org.apache.axis2.AxisFault;
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.core.InvocationContext;
 import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.core.util.MessageContextUtils;
+import org.apache.axis2.jaxws.handler.HandlerChainProcessor;
+import org.apache.axis2.jaxws.handler.HandlerInvokerUtils;
 import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.jaxws.message.util.XMLFaultUtils;
 import org.apache.axis2.jaxws.util.Constants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -91,15 +96,24 @@
 
         request.getProperties().put(Constants.INVOCATION_PATTERN, InvocationPattern.SYNC);
         
-        // TODO: Place-holder for running the JAX-WS request handler chain
-        
-        prepareRequest(request);
-        response = doInvoke(request);
-        prepareResponse(response);
+        // Invoke outbound handlers.
+        // TODO uncomment, and get the EndpointDescription from the request context, which should soon be available
+        boolean success = true; //HandlerInvokerUtils.invokeOutboundHandlers(request, request.getEndpointDescription(), HandlerChainProcessor.MEP.REQUEST, false);
+
+        if (success) {
+        	prepareRequest(request);
+        	response = doInvoke(request);
+        	prepareResponse(response);
+        
+        	// Invoke inbound handlers.
+        	// TODO uncomment, and get the EndpointDescription from the request context, which should soon be available
+        	//HandlerInvokerUtils.invokeInboundHandlers(response, request.getEndpointDescription(), HandlerChainProcessor.MEP.RESPONSE, false);
+        } else { // the outbound handler chain must have had a problem, and we've reversed directions
+        	response = MessageContextUtils.createResponseMessageContext(request);
+        	// since we've reversed directions, the message has "become a response message" (section 9.3.2.1, footnote superscript 2)
+        	response.setMessage(request.getMessage());
+        }
         ic.setResponseMessageContext(response);
-        
-        // TODO: Place-holder for running the JAX-WS response handler chain
-        
         return ic;
     }
     
@@ -130,11 +144,15 @@
         
         MessageContext request = ic.getRequestMessageContext();
         request.getProperties().put(Constants.INVOCATION_PATTERN, InvocationPattern.ONEWAY);
-        
-        // TODO: Place-holder to run the JAX-WS request handler chain
-        
-        prepareRequest(request);
-        doInvokeOneWay(request);
+
+        // Invoke outbound handlers.
+        // TODO uncomment, and get the EndpointDescription from the request context, which should soon be available
+        boolean success = true; //HandlerInvokerUtils.invokeOutboundHandlers(request, request.getEndpointDescription(), HandlerChainProcessor.MEP.REQUEST, false);
+
+        if (success) {
+        	prepareRequest(request);
+            doInvokeOneWay(request);
+        }
         return;
     }
     
@@ -167,10 +185,24 @@
         MessageContext request = ic.getRequestMessageContext();
         request.getProperties().put(Constants.INVOCATION_PATTERN, InvocationPattern.ASYNC_POLLING);
 
-        // TODO: Place-holder for running the JAX-WS request handler chain
+        Response resp = null;
         
-        prepareRequest(request);
-        Response resp = doInvokeAsync(request);
+        // Invoke outbound handlers.
+        // TODO uncomment, and get the EndpointDescription from the request context, which should soon be available
+        boolean success = true; //HandlerInvokerUtils.invokeOutboundHandlers(request, request.getEndpointDescription(), HandlerChainProcessor.MEP.REQUEST, false);
+        if (success) {
+        	prepareRequest(request);
+        	resp = doInvokeAsync(request);
+        } else { // the outbound handler chain must have had a problem, and we've reversed directions
+        	// since we've reversed directions, the message has "become a response message" (section 9.3.2.1, footnote superscript 2)
+
+        	// TODO we know the message is a fault message, we should
+        	// convert it to an exception and throw it.
+        	// something like:
+        	
+        	//throw new AxisFault(request.getMessage());
+        }
+
         return resp;
     }
     
@@ -211,11 +243,24 @@
 
         MessageContext request = ic.getRequestMessageContext();
         request.getProperties().put(Constants.INVOCATION_PATTERN, InvocationPattern.ASYNC_CALLBACK);
+
+        Future<?> future = null;
         
-        // TODO: Place-holder for running the JAX-WS request handler chain
-        
-        prepareRequest(request);
-        Future<?> future = doInvokeAsync(request, asyncHandler);
+        // Invoke outbound handlers.
+        // TODO uncomment, and get the EndpointDescription from the request context, which should soon be available
+        boolean success = true; //HandlerInvokerUtils.invokeOutboundHandlers(request, request.getEndpointDescription(), HandlerChainProcessor.MEP.REQUEST, false);
+        if (success) {
+        	prepareRequest(request);
+        	future = doInvokeAsync(request, asyncHandler);
+        } else { // the outbound handler chain must have had a problem, and we've reversed directions
+        	// since we've reversed directions, the message has "become a response message" (section 9.3.2.1, footnote superscript 2)
+
+        	// TODO we know the message is a fault message, we should
+        	// convert it to an exception and throw it.
+        	// something like:
+
+        	//throw new AxisFault(request.getMessage());
+        }
         return future;        
     }
     

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java?view=diff&rev=523344&r1=523343&r2=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java Wed Mar 28 07:28:56 2007
@@ -23,6 +23,7 @@
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPConstants;
 import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
 import javax.xml.soap.SOAPFault;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.ws.ProtocolException;
@@ -38,8 +39,11 @@
 import org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils;
 import org.apache.axis2.jaxws.message.Protocol;
 import org.apache.axis2.jaxws.message.XMLFault;
+import org.apache.axis2.jaxws.message.util.MessageUtils;
 import org.apache.axis2.jaxws.message.util.XMLFaultUtils;
+import org.apache.axis2.jaxws.util.SoapUtils;
 import org.apache.axis2.jaxws.utility.SAAJFactory;
+import org.apache.axis2.saaj.SOAPFactoryImpl;
 
 public class HandlerChainProcessor {
 
@@ -265,7 +269,7 @@
                 // mark it as reverse direction
 				mc.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, (direction != Direction.OUT));
 			if (ProtocolException.class.isAssignableFrom(re.getClass())) {
-				convertToFaultMessage(re);
+				convertToFaultMessage(mc, re);
 				return PROTOCOL_EXCEPTION;
 			}
 			return OTHER_EXCEPTION;
@@ -368,7 +372,7 @@
 	}
 	
 	
-	private void convertToFaultMessage(Exception e) {
+	public static void convertToFaultMessage(MessageContext mc, Exception e) {
 
 		// need to check if message is already a fault message or not,
 		// probably by way of a flag (isFault) in the MessageContext or Message

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?view=diff&rev=523344&r1=523343&r2=523344
==============================================================================
--- 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 Wed Mar 28 07:28:56 2007
@@ -1,194 +1,227 @@
-package org.apache.axis2.jaxws.handler;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.handler.Handler;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.jaxws.ExceptionFactory;
-import org.apache.axis2.jaxws.context.factory.MessageContextFactory;
-import org.apache.axis2.jaxws.context.utils.ContextUtils;
-import org.apache.axis2.jaxws.core.MessageContext;
-import org.apache.axis2.jaxws.description.EndpointDescription;
-import org.apache.axis2.jaxws.message.Message;
-import org.apache.axis2.jaxws.message.factory.MessageFactory;
-import org.apache.axis2.jaxws.registry.FactoryRegistry;
-import org.apache.axis2.jaxws.server.endpoint.lifecycle.impl.EndpointLifecycleManagerImpl;
-
-public class HandlerInvokerUtils {
-
-    /**
-     * Invoke Inbound Handlers
-     * @param requestMsgCtx
-     */
-    public static boolean invokeInboundHandlers(MessageContext msgCtx,
-            EndpointDescription endpointDesc, HandlerChainProcessor.MEP mep, boolean isOneWay) {
-        List<String> handlers = endpointDesc.getHandlerList();
-
-        // TODO MIKE TEST -- REMOVE - for testing until we get a list of objects from EndpointDescription.getHandlerList();
-        /*
-        if (endpointDesc.getServiceQName().getLocalPart().contains("AddNumber"))
-            handlers.add("org.apache.axis2.jaxws.sample.addnumbers.AddNumbersLogicalHandler");
-        */
-        // TODO END MIKE TEST
-
-        int numHandlers = handlers.size();
-        javax.xml.ws.handler.MessageContext handlerMessageContext = null;
-
-        if (numHandlers > 0) {
-            handlerMessageContext = findOrCreateMessageContext(msgCtx);
-        } else {
-            return true;
-        }
-
-        // TODO remove this.  Handlers will have already been instantiated when
-        // we start using the handlerresolver to get our list.
-        ArrayList<Handler> handlerInstances = createHandlerInstances(endpointDesc);
-
-        HandlerChainProcessor processor = new HandlerChainProcessor(
-                handlerInstances);
-
-        // if not one-way, expect a response
-        if (msgCtx.getMessage().isFault()) {
-                processor.processFault(handlerMessageContext,
-                    HandlerChainProcessor.Direction.IN);
-        } else {
-                handlerMessageContext = processor.processChain(handlerMessageContext,
-                                HandlerChainProcessor.Direction.IN,
-                                mep,
-                                !isOneWay);
-        }
-
-        if (handlerMessageContext.get(javax.xml.ws.handler.MessageContext.MESSAGE_OUTBOUND_PROPERTY).equals(true)
-                        && mep.equals(HandlerChainProcessor.MEP.REQUEST)) {
-            // uh-oh.  We've changed directions on the server inbound handler processing,
-            // This means we're now on an outbound flow, and the endpoint will not
-            // be called.  Be sure to mark the context and message as such.
-            try {
-                Message msg = ((MessageFactory)FactoryRegistry.getFactory(MessageFactory.class)).createFrom(((SOAPMessageContext)handlerMessageContext).getMessage());
-                msgCtx.setMessage(msg);
-                return false;
-            } catch (XMLStreamException e) {
-                // TODO log it
-                throw ExceptionFactory.makeWebServiceException(e);
-            }
-        }
-
-        return true;
-    }
-
-    /**
-     * Invoke OutboundHandlers
-     * 
-     * @param msgCtx
-     */
-    public static boolean invokeOutboundHandlers(MessageContext msgCtx,
-            EndpointDescription endpointDesc, HandlerChainProcessor.MEP mep, boolean isOneWay) {
-        List<String> handlers = endpointDesc.getHandlerList();
-
-        // TODO you may need to hard-code add some handlers until we
-        // actually have useful code under EndpointDescription.getHandlerList()
-        int numHandlers = handlers.size();
-
-        javax.xml.ws.handler.MessageContext handlerMessageContext = null;
-        if (numHandlers > 0) {
-            handlerMessageContext = findOrCreateMessageContext(msgCtx);
-        } else {
-            return true;
-        }
-
-        // TODO probably don't want to make the newInstances here -- use
-        // RuntimeDescription instead?
-        // make instances of all the handlers
-        ArrayList<Handler> handlerInstances = createHandlerInstances(endpointDesc);
-
-        HandlerChainProcessor processor = new HandlerChainProcessor(
-                handlerInstances);
-
-        // if not one-way, expect a response
-        if (msgCtx.getMessage().isFault()) {
-                processor.processFault(handlerMessageContext,
-                    HandlerChainProcessor.Direction.OUT);
-        } else {
-                handlerMessageContext = processor.processChain(handlerMessageContext,
-                                HandlerChainProcessor.Direction.OUT,
-                                mep, !isOneWay);
-        }
-
-        if (handlerMessageContext.get(javax.xml.ws.handler.MessageContext.MESSAGE_OUTBOUND_PROPERTY).equals(false)
-                        && mep.equals(HandlerChainProcessor.MEP.REQUEST)) {
-                // uh-oh.  We've changed directions on the client outbound handler processing,
-                // This means we're now on an inbound flow, and the service will not
-                // be called.  Be sure to mark the context and message as such.
-                try {
-                        Message msg = ((MessageFactory)FactoryRegistry.getFactory(MessageFactory.class)).createFrom(((SOAPMessageContext)handlerMessageContext).getMessage());
-                        msgCtx.setMessage(msg);
-                        return false;
-                } catch (XMLStreamException e) {
-                        // TODO log it
-                        throw ExceptionFactory.makeWebServiceException(e);
-                }
-        }
-
-        return true;
-    }
-
-    /**
-     * Find or Create Handler Message Context
-     * @param mc
-     * @return javax.xml.ws.handler.MessageContext
-     */
-    private static javax.xml.ws.handler.MessageContext findOrCreateMessageContext(MessageContext mc) {
-        // See if a soap message context is already present on the WebServiceContext
-        javax.xml.ws.handler.MessageContext handlerMessageContext = null;
-        ServiceContext serviceContext = mc.getAxisMessageContext().getServiceContext();
-        WebServiceContext ws = (WebServiceContext)serviceContext.getProperty(EndpointLifecycleManagerImpl.WEBSERVICE_MESSAGE_CONTEXT);
-
-        if (ws != null) {
-            handlerMessageContext = ws.getMessageContext();
-        }
-
-        if (handlerMessageContext == null) {
-            handlerMessageContext = createSOAPMessageContext(mc);
-        }
-
-        return handlerMessageContext; 
-    }
-
-    /**
-     * @param mc
-     * @return new SOAPMessageContext
-     */
-    private static javax.xml.ws.handler.MessageContext createSOAPMessageContext(MessageContext mc){
-        SoapMessageContext soapMessageContext = (SoapMessageContext)MessageContextFactory.createSoapMessageContext(mc);
-        ContextUtils.addProperties(soapMessageContext, mc);
-        return soapMessageContext;
-     }
-
-    // TODO method is for TEST only.  instances will be created elsewhere
-    private static ArrayList<Handler> createHandlerInstances(EndpointDescription ed) {
-        // TODO remove this.  Handlers will have already been instantiated when
-        // we start using the handlerresolver to get our list.
-
-        List<String> handlers = ed.getHandlerList();
-        int numHandlers = handlers.size();
-
-        ArrayList<Handler> handlerInstances = new ArrayList<Handler>();
-        try {
-                for (int i = 0; i < numHandlers; i++) {
-                        handlerInstances.add((Handler) Class.forName(handlers.get(i)).newInstance());
-                }
-        } catch (Exception e) {
-                e.printStackTrace();
-        }
-
-        return handlerInstances;
-    }
-
-}
-
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.handler;
+
+import java.util.ArrayList;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.context.factory.MessageContextFactory;
+import org.apache.axis2.jaxws.context.utils.ContextUtils;
+import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.message.Message;
+import org.apache.axis2.jaxws.message.factory.MessageFactory;
+import org.apache.axis2.jaxws.registry.FactoryRegistry;
+import org.apache.axis2.jaxws.server.endpoint.lifecycle.impl.EndpointLifecycleManagerImpl;
+
+public class HandlerInvokerUtils {
+	
+    /**
+     * Invoke Inbound Handlers
+     * @param requestMsgCtx
+     */
+    public static boolean invokeInboundHandlers(MessageContext msgCtx,
+            EndpointDescription endpointDesc, HandlerChainProcessor.MEP mep, boolean isOneWay) {
+   
+        HandlerResolverImpl hResolver = new HandlerResolverImpl(endpointDesc);
+        ArrayList<Handler> handlers = hResolver.getHandlerChain(endpointDesc.getPortInfo());
+        
+        int numHandlers = handlers.size();
+
+        javax.xml.ws.handler.MessageContext handlerMessageContext = null;
+        if (numHandlers > 0) {
+            handlerMessageContext = findOrCreateMessageContext(msgCtx);
+        } else {
+            return true;
+        }
+
+        // TODO remove this.  Handlers will have already been instantiated when
+        // we start using the handlerresolver to get our list.
+        //ArrayList<Handler> handlerInstances = createHandlerInstances(endpointDesc);
+
+        HandlerChainProcessor processor = new HandlerChainProcessor(
+                handlers);
+        // if not one-way, expect a response
+        try {
+        	if (msgCtx.getMessage().isFault()) {
+        		processor.processFault(handlerMessageContext,
+        				HandlerChainProcessor.Direction.IN);
+        	} else {
+        		handlerMessageContext = processor.processChain(handlerMessageContext,
+        				HandlerChainProcessor.Direction.IN,
+        				mep,
+        				!isOneWay);
+        	}
+        } catch (RuntimeException re) {
+        	/*
+        	 * handler framework should only throw an exception here if
+        	 * we are in the client inbound case.  Make sure the message
+        	 * context and message are transformed.
+        	 */
+        	HandlerChainProcessor.convertToFaultMessage(handlerMessageContext, re);
+        	addConvertedFaultMsgToCtx(msgCtx, handlerMessageContext);
+        	return false;
+        }
+        
+        if (handlerMessageContext.get(javax.xml.ws.handler.MessageContext.MESSAGE_OUTBOUND_PROPERTY).equals(true)
+        		&& mep.equals(HandlerChainProcessor.MEP.REQUEST)) {
+        	// uh-oh.  We've changed directions on the server inbound handler processing,
+        	// This means we're now on an outbound flow, and the endpoint will not
+        	// be called.  Be sure to mark the context and message as such.
+        	addConvertedFaultMsgToCtx(msgCtx, handlerMessageContext);
+        	return false;
+        }
+        return true;
+
+    }
+
+    /**
+     * Invoke OutboundHandlers
+     * 
+     * @param msgCtx
+     */
+    public static boolean invokeOutboundHandlers(MessageContext msgCtx,
+            EndpointDescription endpointDesc, HandlerChainProcessor.MEP mep, boolean isOneWay) {
+
+        //ArrayList<String> handlers = endpointDesc.getHandlerList();
+        
+        // TODO you may need to hard-code add some handlers until we
+        // actually have useful code under EndpointDescription.getHandlerList()
+        
+        HandlerResolverImpl hResolver = new HandlerResolverImpl(endpointDesc);
+        ArrayList<Handler> handlers = hResolver.getHandlerChain(endpointDesc.getPortInfo());
+        
+        int numHandlers = handlers.size();
+
+        javax.xml.ws.handler.MessageContext handlerMessageContext = null;
+        if (numHandlers > 0) {
+            handlerMessageContext = findOrCreateMessageContext(msgCtx);
+        } else {
+            return true;
+        }
+
+        // TODO probably don't want to make the newInstances here -- use
+        // RuntimeDescription instead?
+        // make instances of all the handlers
+        //ArrayList<Handler> handlerInstances = createHandlerInstances(endpointDesc);
+
+        HandlerChainProcessor processor = new HandlerChainProcessor(
+                handlers);
+        // if not one-way, expect a response
+        try {
+        	if (msgCtx.getMessage().isFault()) {
+        		processor.processFault(handlerMessageContext,
+        				HandlerChainProcessor.Direction.OUT);
+        	} else {
+        		handlerMessageContext = processor.processChain(handlerMessageContext,
+        				HandlerChainProcessor.Direction.OUT,
+        				mep, !isOneWay);
+        	}
+        } catch (RuntimeException re) {
+        	/*
+        	 * handler framework should only throw an exception here if
+        	 * we are in the server outbound case.  Make sure the message
+        	 * context and message are transformed.
+        	 */
+        	HandlerChainProcessor.convertToFaultMessage(handlerMessageContext, re);
+        	addConvertedFaultMsgToCtx(msgCtx, handlerMessageContext);
+        	return false;
+        }
+
+        if (handlerMessageContext.get(javax.xml.ws.handler.MessageContext.MESSAGE_OUTBOUND_PROPERTY).equals(false)
+        		&& mep.equals(HandlerChainProcessor.MEP.REQUEST)) {
+        	// uh-oh.  We've changed directions on the client outbound handler processing,
+        	// This means we're now on an inbound flow, and the service will not
+        	// be called.  Be sure to mark the context and message as such.
+        	addConvertedFaultMsgToCtx(msgCtx, handlerMessageContext);
+        	return false;
+        }
+        return true;
+        
+    }
+    
+    /**
+     * Find or Create Handler Message Context
+     * @param mc
+     * @return javax.xml.ws.handler.MessageContext
+     */
+    private static javax.xml.ws.handler.MessageContext findOrCreateMessageContext(MessageContext mc) {
+        // See if a soap message context is already present on the WebServiceContext
+        javax.xml.ws.handler.MessageContext handlerMessageContext = null;
+        ServiceContext serviceContext = mc.getAxisMessageContext().getServiceContext();
+        WebServiceContext ws = (WebServiceContext)serviceContext.getProperty(EndpointLifecycleManagerImpl.WEBSERVICE_MESSAGE_CONTEXT);
+        if (ws != null) {
+            handlerMessageContext = ws.getMessageContext();
+        }
+        if (handlerMessageContext == null) {
+            handlerMessageContext = createSOAPMessageContext(mc);
+        }
+        return handlerMessageContext; 
+    }
+    
+    /**
+     * @param mc
+     * @return new SOAPMessageContext
+     */
+    private static javax.xml.ws.handler.MessageContext createSOAPMessageContext(MessageContext mc){
+        SoapMessageContext soapMessageContext = (SoapMessageContext)MessageContextFactory.createSoapMessageContext(mc);
+        ContextUtils.addProperties(soapMessageContext, mc);
+        return soapMessageContext;
+     }
+    
+
+    private static void addConvertedFaultMsgToCtx(MessageContext msgCtx, javax.xml.ws.handler.MessageContext handlerMsgCtx) {
+    	try {
+    		Message msg = ((MessageFactory)FactoryRegistry.getFactory(MessageFactory.class)).createFrom(((SOAPMessageContext)handlerMsgCtx).getMessage());
+    		msgCtx.setMessage(msg);
+    	} catch (XMLStreamException e) {
+    		// TODO log it
+    		throw ExceptionFactory.makeWebServiceException(e);
+    	}
+    }
+    
+    // TODO method is for TEST only.  instances will be created elsewhere
+    /*
+    private static ArrayList<Handler> createHandlerInstances(EndpointDescription ed) {
+        // TODO remove this.  Handlers will have already been instantiated when
+        // we start using the handlerresolver to get our list.
+    	
+    	List<String> handlers = ed.getHandlerList();
+        int numHandlers = handlers.size();
+    	
+        ArrayList<Handler> handlerInstances = new ArrayList<Handler>();
+        try {
+        	for (int i = 0; i < numHandlers; i++) {
+        		handlerInstances.add((Handler) Class.forName(handlers.get(i)).newInstance());
+        	}
+        } catch (Exception e) {
+        	e.printStackTrace();
+        }
+        
+        return handlerInstances;
+    }
+    */
+    
+}

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java?view=diff&rev=523344&r1=523343&r2=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java Wed Mar 28 07:28:56 2007
@@ -18,11 +18,15 @@
  */
 package org.apache.axis2.jaxws.handler;
 
+import java.lang.reflect.Method;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.Handler;
 import javax.xml.ws.handler.HandlerResolver;
@@ -33,8 +37,10 @@
 import org.apache.axis2.java.security.AccessController;
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.description.xml.handler.HandlerChainType;
+import org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType;
+import org.apache.axis2.jaxws.description.xml.handler.HandlerType;
 import org.apache.axis2.jaxws.i18n.Messages;
-import org.apache.axis2.jaxws.spi.ServiceDelegate;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -59,13 +65,13 @@
 	 */
 
 	// we'll need to refer to this object to get the port, and thus handlers
-	private ServiceDelegate delegate;
+	private EndpointDescription endpointDesc;
 
-	public HandlerResolverImpl(ServiceDelegate delegate) {
-		this.delegate = delegate;
+	public HandlerResolverImpl(EndpointDescription ed) {
+		this.endpointDesc = ed;
 	}
 
-	public List<Handler> getHandlerChain(PortInfo portinfo) {
+	public ArrayList<Handler> getHandlerChain(PortInfo portinfo) {
 		// TODO:  would check and/or build cache here if implemented later
 		return resolveHandlers(portinfo);
 	}
@@ -79,9 +85,12 @@
 	 * running the annotated PostConstruct method, sorting the list, resolving the list,
 	 * and returning it
 	 */
-	private List<Handler> resolveHandlers(PortInfo portinfo) throws WebServiceException {
-		EndpointDescription edesc = delegate.getServiceDescription().getEndpointDescription(portinfo.getPortName());
+	private ArrayList<Handler> resolveHandlers(PortInfo portinfo) throws WebServiceException {
 		
+        // our implementation already has a reference to the EndpointDescription,
+        // which is where one might bet the portinfo object.  We still have the 
+        // passed-in variable, however, due to the spec
+        
 		ArrayList handlers = new ArrayList<Handler>();
 		ArrayList logicalHandlers = new ArrayList<Handler>();
 		ArrayList protocolHandlers = new ArrayList<Handler>();
@@ -94,41 +103,56 @@
 		 * chain.
 		 */
 		
-		for (String portHandler : edesc.getHandlerList()) {
-			Handler handlerClass;
-			// instantiate portHandler class
-			try {
-				// TODO: ok to use system classloader?
-				handlerClass = (Handler) loadClass(portHandler).newInstance();
-				callHandlerPostConstruct(handlerClass);
-			} catch (ClassNotFoundException e) {
-				// TODO: should we just ignore this problem?
-				// TODO: NLS log and throw
-				throw ExceptionFactory.makeWebServiceException(e);
-			} catch (InstantiationException ie) {
-				// TODO: should we just ignore this problem?
-				// TODO: NLS log and throw
-				throw ExceptionFactory.makeWebServiceException(ie);
-			} catch (IllegalAccessException e) {
-				// TODO: should we just ignore this problem?
-				// TODO: NLS log and throw
-				throw ExceptionFactory.makeWebServiceException(e);
-			}
-			
-			// 9.2.1.2 sort them by Logical, then SOAP
-			if (LogicalHandler.class.isAssignableFrom(handlerClass.getClass()))
-				logicalHandlers.add((LogicalHandler)handlerClass);
-			else if (SOAPHandler.class.isAssignableFrom(handlerClass.getClass()))
-				// instanceof ProtocolHandler
-				protocolHandlers.add((SOAPHandler)handlerClass);
-			else if (Handler.class.isAssignableFrom(handlerClass.getClass())) {
-				// TODO: NLS better error message
-				throw ExceptionFactory.makeWebServiceException(Messages.getMessage("handlerChainErr1", handlerClass.getClass().getName()));
-			} else {
-				// TODO: NLS better error message
-				throw ExceptionFactory.makeWebServiceException(Messages.getMessage("handlerChainErr2", handlerClass.getClass().getName()));
-			}
-		}
+        HandlerChainsType handlerCT = endpointDesc.getHandlerChain();
+        
+        Iterator it = handlerCT == null ? null : handlerCT.getHandlerChain().iterator();
+        
+        while ((it != null) && (it.hasNext())) {
+            List<HandlerType> handlerTypeList = ((HandlerChainType) it.next()).getHandler();
+            Iterator ht = handlerTypeList.iterator();
+            while (ht.hasNext()) {
+                // TODO review: need to check for null getHandlerClass() return?
+                // or will schema not allow it?
+                String portHandler = ((HandlerType) ht.next()).getHandlerClass().getValue();
+                Handler handlerClass;
+                // instantiate portHandler class
+                try {
+                    // TODO: ok to use system classloader?
+                    handlerClass = (Handler) loadClass(portHandler).newInstance();
+                    callHandlerPostConstruct(handlerClass.getClass());
+                } catch (ClassNotFoundException e) {
+                    // TODO: should we just ignore this problem?
+                    // TODO: NLS log and throw
+                    throw ExceptionFactory.makeWebServiceException(e);
+                } catch (InstantiationException ie) {
+                    // TODO: should we just ignore this problem?
+                    // TODO: NLS log and throw
+                    throw ExceptionFactory.makeWebServiceException(ie);
+                } catch (IllegalAccessException e) {
+                    // TODO: should we just ignore this problem?
+                    // TODO: NLS log and throw
+                    throw ExceptionFactory.makeWebServiceException(e);
+                }
+
+                // 9.2.1.2 sort them by Logical, then SOAP
+                if (LogicalHandler.class.isAssignableFrom(handlerClass.getClass()))
+                    logicalHandlers.add((LogicalHandler) handlerClass);
+                else if (SOAPHandler.class.isAssignableFrom(handlerClass.getClass()))
+                    // instanceof ProtocolHandler
+                    protocolHandlers.add((SOAPHandler) handlerClass);
+                else if (Handler.class.isAssignableFrom(handlerClass.getClass())) {
+                    // TODO: NLS better error message
+                    throw ExceptionFactory.makeWebServiceException(Messages
+                            .getMessage("handlerChainErr1", handlerClass
+                                    .getClass().getName()));
+                } else {
+                    // TODO: NLS better error message
+                    throw ExceptionFactory.makeWebServiceException(Messages
+                            .getMessage("handlerChainErr2", handlerClass
+                                    .getClass().getName()));
+                }
+            }
+        }
 		
 		handlers.addAll(logicalHandlers);
 		handlers.addAll(protocolHandlers);
@@ -138,6 +162,7 @@
 	
 	private static Class loadClass(String clazz) throws ClassNotFoundException {
 		try {
+            // TODO: review:  necessary to use static method getSystemClassLoader in this class?
 			return forName(clazz, true, ClassLoader.getSystemClassLoader());
 		} catch (ClassNotFoundException e) {
 			throw e;
@@ -168,6 +193,7 @@
         
         return cl;
     }
+
     
     /**
      * @return ClassLoader
@@ -192,45 +218,19 @@
         
         return cl;
     }
+    
+
+	private static void callHandlerPostConstruct(Class handlerClass) {
+        // TODO implement -- copy or make utils from ResourceInjectionServiceRuntimeDescriptionBuilder
+    }
 
 
-	private static void callHandlerPostConstruct(Object handlerClass) {
-		/*
-		 * TODO apparently there's no javax.annotation.* package in Java
-		 * EE 5 ?? We need to call @PostConstruct method on handler if present
-		for (Method method : handlerClass.getClass().getMethods()) {
-			if (method.getAnnotation(javax.annotation.PostConstruct.class) != null) {
-				try {
-					method.invoke(handlerClass, new Object [0]);
-					break;
-				} catch (Exception e) {
-					// TODO: log it, but otherwise ignore
-				}
-			}
-		}
-		*/
-	}
-	
 	/*
 	 * Helper method to destroy all instantiated Handlers once the runtime
 	 * is done with them.
 	 */
 	public static void destroyHandlers(List<Handler> handlers) {
-		/*
-		 * TODO apparently there's no javax.annotation.* package in Java
-		 * EE 5 ?? We need to call @PostConstruct method on handler if present
-		for (Handler handler: handlers) {
-			for (Method method: handler.getClass().getMethods()) {
-				if (method.getAnnotation(javax.annotation.PreDestroy.class) != null) {
-					try {
-						method.invoke(handlerClass, new Object[0]);
-						break;
-					} catch (Exception e) {
-						// TODO: log it, but otherwise ignore
-					}
-				}
-			}
-		}
-		*/
+	    // TODO implement -- copy or make utils from ResourceInjectionServiceRuntimeDescriptionBuilder
+        // CALL the PreDestroy annotated method for each handler
 	}
 }

Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/AddNumbersHandler.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/AddNumbersHandler.wsdl?view=auto&rev=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/AddNumbersHandler.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/AddNumbersHandler.wsdl Wed Mar 28 07:28:56 2007
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+
+<definitions name="AddNumbersHandler" targetNamespace="http://org/test/addnumbershandler"
+	xmlns:tns="http://org/test/addnumbershandler" xmlns="http://schemas.xmlsoap.org/wsdl/"
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+
+
+	<types>
+		<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+			elementFormDefault="qualified" targetNamespace="http://org/test/addnumbershandler">
+			<element name="addNumbersHandlerResponse">
+				<complexType>
+					<sequence>
+						<element name="return" type="xsd:int" />
+					</sequence>
+				</complexType>
+			</element>
+
+			<element name="addNumbersHandler">
+				<complexType>
+					<sequence>
+						<element name="arg0" type="xsd:int" />
+						<element name="arg1" type="xsd:int" />
+					</sequence>
+				</complexType>
+			</element>
+
+			<element name="AddNumbersHandlerFault">
+				<complexType>
+					<sequence>
+						<element name="faultInfo" type="xsd:string" />
+						<element name="message" type="xsd:string" />
+					</sequence>
+				</complexType>
+			</element>
+
+			<element name="oneWayInt">
+				<complexType>
+					<sequence>
+						<element name="arg0" type="xsd:int" />
+					</sequence>
+				</complexType>
+			</element>
+
+		</xsd:schema>
+	</types>
+
+	<message name="addNumbersHandler">
+		<part name="parameters" element="tns:addNumbersHandler" />
+	</message>
+	<message name="addNumbersHandlerResponse">
+		<part name="result" element="tns:addNumbersHandlerResponse" />
+	</message>
+	<message name="addNumbersHandlerFault">
+		<part name="AddNumbersHandlerFault" element="tns:AddNumbersHandlerFault" />
+	</message>
+	<message name="oneWayInt">
+		<part name="parameters" element="tns:oneWayInt" />
+	</message>
+
+	<portType name="AddNumbersHandlerPortType">
+		<operation name="addNumbersHandler">
+			<input message="tns:addNumbersHandler" name="add" />
+			<output message="tns:addNumbersHandlerResponse" name="addResponse" />
+			<fault name="addNumbersHandlerFault" message="tns:addNumbersHandlerFault" />
+		</operation>
+		<operation name="oneWayInt">
+			<input message="tns:oneWayInt" />
+		</operation>
+	</portType>
+	<binding name="AddNumbersHandlerBinding" type="tns:AddNumbersHandlerPortType">
+		<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
+			style="document" />
+		<operation name="addNumbersHandler">
+			
+			<input>
+				<soap:body use="literal" />
+			</input>
+			<output>
+				<soap:body use="literal" />
+			</output>
+			<fault name="addNumbersHandlerFault">
+				<soap:fault name="addNumbersHandlerFault" use="literal" />
+			</fault>
+		</operation>
+		<operation name="oneWayInt">
+			
+			<input>
+				<soap:body use="literal" />
+			</input>
+		</operation>
+	</binding>
+	<service name="AddNumbersHandlerService">
+		<port name="AddNumbersHandlerPort" binding="tns:AddNumbersHandlerBinding">
+			<soap:address
+				location="http://localhost:9080/AddNumberHandler/AddNumbersHandlerImplService" />
+		</port>
+	</service>
+</definitions>
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java?view=diff&rev=523344&r1=523343&r2=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java Wed Mar 28 07:28:56 2007
@@ -20,6 +20,7 @@
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
+
 import org.apache.axis2.jaxws.anytype.tests.AnyTypeTests;
 import org.apache.axis2.jaxws.attachments.MTOMSerializationTests;
 import org.apache.axis2.jaxws.client.ClientConfigTests;
@@ -62,6 +63,8 @@
 import org.apache.axis2.jaxws.proxy.RPCProxyTests;
 import org.apache.axis2.jaxws.proxy.SOAP12ProxyTests;
 import org.apache.axis2.jaxws.rpclit.enumtype.tests.RPCLitEnumTests;
+import org.apache.axis2.jaxws.sample.AddNumbersHandlerTests;
+import org.apache.axis2.jaxws.sample.AddNumbersTests;
 import org.apache.axis2.jaxws.sample.AddressBookTests;
 import org.apache.axis2.jaxws.sample.BareTests;
 import org.apache.axis2.jaxws.sample.DLWMinTests;
@@ -151,7 +154,8 @@
         suite.addTestSuite(WrapTests.class);
         suite.addTestSuite(DLWMinTests.class);
         suite.addTestSuite(NonAnonymousComplexTypeTests.class);
-        //suite.addTestSuite(AddNumbersTests.class);
+        suite.addTestSuite(AddNumbersTests.class);
+        suite.addTestSuite(AddNumbersHandlerTests.class);
         
         // TODO: This test intermittently fails on Linux and with trace enabled.
         //suite.addTestSuite(ParallelAsyncTests.class);
@@ -174,7 +178,7 @@
         suite.addTestSuite(SchemaReaderTests.class);
         suite.addTestSuite(RPCLitEnumTests.class);
         suite.addTestSuite(BindingProviderTests.class);
-        
+
         // Start (and stop) the server only once for all the tests
         TestSetup testSetup = new TestSetup(suite) {
             public void setUp() {

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java?view=auto&rev=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java Wed Mar 28 07:28:56 2007
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample;
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import junit.framework.TestCase;
+import org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersHandlerPortType;
+import org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersHandlerService;
+
+public class AddNumbersHandlerTests extends TestCase {
+	
+    String axisEndpoint = "http://localhost:8080/axis2/services/AddNumbersHandlerService";
+    // TODO: disabled until handler support is more complete
+    public void _testAddNumbersHandler() {
+		try{
+			System.out.println("----------------------------------");
+		    System.out.println("test: " + getName());
+			
+            AddNumbersHandlerService service = new AddNumbersHandlerService();
+			AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
+			
+            BindingProvider p =	(BindingProvider)proxy;
+			p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
+                    axisEndpoint);	
+			int total = proxy.addNumbersHandler(10,10);
+			
+            assertEquals("With handler manipulation, total should be 2 less than a proper sumation.", 18, total);
+			System.out.println("Total (after handler manipulation) = " +total);
+			System.out.println("----------------------------------");
+		} catch(Exception e) {
+			e.printStackTrace();
+			fail();
+		}
+	}
+
+    // TODO: disabled until handler support is more complete
+    public void _testAddNumbersHandlerWithFault() {
+        try{
+            System.out.println("----------------------------------");
+            System.out.println("test: " + getName());
+            
+            AddNumbersHandlerService service = new AddNumbersHandlerService();
+            AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
+            
+            BindingProvider p = (BindingProvider)proxy;
+            p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
+                    axisEndpoint);  
+            // value 99 triggers the handler to throw an exception, but does
+            // NOT trigger the AddNumbersHandler.handlefault method.
+            // The spec does not call the handlefault method of a handler that
+            // causes a flow reversal
+            int total = proxy.addNumbersHandler(99,10);
+            
+            fail("We should have got an exception due to the handler.");
+        } catch(Exception e) {
+            e.printStackTrace();
+            assertTrue("Exception should be SOAPFaultException", e instanceof SOAPFaultException);
+            assertEquals(((SOAPFaultException)e).getMessage(), "AddNumbersLogicalHandler2 was here");
+        }
+        System.out.println("----------------------------------");
+    }
+    
+    public void testOneWay() {
+        try {
+            System.out.println("----------------------------------");
+            System.out.println("test: " + getName());
+            
+            AddNumbersHandlerService service = new AddNumbersHandlerService();
+            AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
+            
+            BindingProvider bp = (BindingProvider) proxy;
+            bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
+                    axisEndpoint);
+            proxy.oneWayInt(11);
+            System.out.println("----------------------------------");
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }       
+    }
+}

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersTests.java?view=diff&rev=523344&r1=523343&r2=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersTests.java Wed Mar 28 07:28:56 2007
@@ -19,7 +19,6 @@
 package org.apache.axis2.jaxws.sample;
 
 import javax.xml.ws.BindingProvider;
-import javax.xml.ws.soap.SOAPFaultException;
 
 import junit.framework.TestCase;
 import org.apache.axis2.jaxws.sample.addnumbers.AddNumbersPortType;
@@ -29,51 +28,19 @@
 	
     String axisEndpoint = "http://localhost:8080/axis2/services/AddNumbersService";
 	
-    public void testAddNumbers() {
-		try{
-			System.out.println("----------------------------------");
-		    System.out.println("test: " + getName());
-			
-            AddNumbersService service = new AddNumbersService();
-			AddNumbersPortType proxy = service.getAddNumbersPort();
-			
-            BindingProvider p =	(BindingProvider)proxy;
-			p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
-                    axisEndpoint);	
-			int total = proxy.addNumbers(10,10);
-			
-            assertEquals("With handler manipulation, total should be 2 less than a proper sumation.", 18, total);
-			System.out.println("Total (after handler manipulation) = " +total);
-			System.out.println("----------------------------------");
-		} catch(Exception e) {
-			e.printStackTrace();
-			fail();
-		}
-	}
-    
-    public void testAddNumbersWithFault() {
-        try{
-            System.out.println("----------------------------------");
-            System.out.println("test: " + getName());
-            
-            AddNumbersService service = new AddNumbersService();
-            AddNumbersPortType proxy = service.getAddNumbersPort();
-            
-            BindingProvider p = (BindingProvider)proxy;
-            p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
-                    axisEndpoint);  
-            // value 99 triggers the handler to throw an exception, but does
-            // NOT trigger the AddNumbersHandler.handlefault method.
-            // The spec does not call the handlefault method of a handler that
-            // causes a flow reversal
-            int total = proxy.addNumbers(99,10);
-            
-            fail("We should have got an exception due to the handler.");
-        } catch(Exception e) {
-            e.printStackTrace();
-            assertTrue("Exception should be SOAPFaultException", e instanceof SOAPFaultException);
-            assertEquals(((SOAPFaultException)e).getMessage(), "I don't like the value 99");
-        }
+    public void testAddNumbers() throws Exception {
+        System.out.println("----------------------------------");
+        System.out.println("test: " + getName());
+        
+        AddNumbersService service = new AddNumbersService();
+        AddNumbersPortType proxy = service.getAddNumbersPort();
+        
+        BindingProvider p =	(BindingProvider)proxy;
+        p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
+                axisEndpoint);	
+        int total = proxy.addNumbers(10,10);
+                
+        System.out.println("Total =" +total);
         System.out.println("----------------------------------");
     }
     

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerFault_Exception.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerFault_Exception.java?view=auto&rev=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerFault_Exception.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerFault_Exception.java Wed Mar 28 07:28:56 2007
@@ -0,0 +1,56 @@
+
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import javax.xml.ws.WebFault;
+
+import org.test.addnumbershandler.AddNumbersHandlerFault;
+
+
+/**
+ * This class was generated by the JAXWS SI.
+ * JAX-WS RI 2.0_01-b15-fcs
+ * Generated source version: 2.0
+ * 
+ */
+@WebFault(faultBean="", name = "AddNumbersHandlerFault", targetNamespace = "http://duke/org")
+public class AddNumbersHandlerFault_Exception
+    extends Exception
+{
+
+    /**
+     * Java type that goes as soapenv:Fault detail element.
+     * 
+     */
+    private AddNumbersHandlerFault faultInfo;
+
+    /**
+     * 
+     * @param faultInfo
+     * @param message
+     */
+    public AddNumbersHandlerFault_Exception(String message, AddNumbersHandlerFault faultInfo) {
+        super(message);
+        this.faultInfo = faultInfo;
+    }
+
+    /**
+     * 
+     * @param faultInfo
+     * @param message
+     * @param cause
+     */
+    public AddNumbersHandlerFault_Exception(String message, AddNumbersHandlerFault faultInfo, Throwable cause) {
+        super(message, cause);
+        this.faultInfo = faultInfo;
+    }
+
+    /**
+     * 
+     * @return
+     *     returns fault bean: duke.org.AddNumbersHandlerFault
+     */
+    public AddNumbersHandlerFault getFaultInfo() {
+        return faultInfo;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerPortType.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerPortType.java?view=auto&rev=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerPortType.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerPortType.java Wed Mar 28 07:28:56 2007
@@ -0,0 +1,56 @@
+
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+
+
+
+/**
+ * This class was generated by the JAXWS SI.
+ * JAX-WS RI 2.0_01-b15-fcs
+ * Generated source version: 2.0
+ * 
+ */
+@WebService(name = "AddNumbersHandlerPortType", targetNamespace = "http://org/test/addnumbershandler")
+public interface AddNumbersHandlerPortType {
+
+
+    /**
+     * 
+     * @param arg1
+     * @param arg0
+     * @return
+     *     returns int
+     * @throws AddNumbersHandlerFault_Exception
+     */
+    @WebMethod
+    @WebResult(targetNamespace = "http://org/test/addnumbershandler")
+    @RequestWrapper(localName = "addNumbersHandler", targetNamespace = "http://org/test/addnumbershandler", className = "org.test.addnumbershandler.AddNumbersHandler")
+    @ResponseWrapper(localName = "addNumbersHandlerResponse", targetNamespace = "http://org/test/addnumbershandler", className = "org.test.addnumbershandler.AddNumbersHandlerResponse")
+    public int addNumbersHandler(
+        @WebParam(name = "arg0", targetNamespace = "http://org/test/addnumbershandler")
+        int arg0,
+        @WebParam(name = "arg1", targetNamespace = "http://org/test/addnumbershandler")
+        int arg1)
+        throws AddNumbersHandlerFault_Exception
+    ;
+
+    /**
+     * 
+     * @param arg0
+     */
+    @WebMethod
+    @Oneway
+    @RequestWrapper(localName = "oneWayInt", targetNamespace = "http://org/test/addnumbershandler", className = "org.test.addnumbershandler.OneWayInt")
+    public void oneWayInt(
+        @WebParam(name = "arg0", targetNamespace = "http://org/test/addnumbershandler")
+        int arg0);
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerPortTypeImpl.java?view=auto&rev=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerPortTypeImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerPortTypeImpl.java Wed Mar 28 07:28:56 2007
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import javax.jws.WebService;
+import javax.jws.HandlerChain;
+
+
+@WebService(endpointInterface="org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersHandlerPortType")
+@HandlerChain(file="META-INF/AddNumbersHandlers.xml", name="")
+public class AddNumbersHandlerPortTypeImpl implements AddNumbersHandlerPortType {
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersHandlerPortType#addNumbersHandler(int, int)
+	 */
+	public int addNumbersHandler(int arg0, int arg1) throws AddNumbersHandlerFault_Exception {
+	    System.out.println(">> Received addNumbersHandler request for " + arg0 + " and " + arg1);
+        return arg0+arg1;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersHandlerPortType#oneWayInt(int)
+	 */
+	public void oneWayInt(int arg0) {
+	    System.out.println(">> Received one-way request.");
+        return;
+	}
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerService.java?view=auto&rev=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerService.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerService.java Wed Mar 28 07:28:56 2007
@@ -0,0 +1,61 @@
+
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+
+/**
+ * This class was generated by the JAXWS SI.
+ * JAX-WS RI 2.0_01-b15-fcs
+ * Generated source version: 2.0
+ * 
+ */
+@WebServiceClient(name = "AddNumbersHandlerService", targetNamespace = "http://org/test/addnumbershandler", wsdlLocation = "AddNumbersHandler1.wsdl")
+public class AddNumbersHandlerService
+    extends Service
+{
+
+    private final static URL ADDNUMBERSSERVICE_WSDL_LOCATION;
+    private static String wsdlLocation="/test/org/apache/axis2/jaxws/sample/addnumbershandler/META-INF/AddNumbersHandler.wsdl";
+    static {
+        URL url = null;
+        try {
+        	try{
+	        	String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
+	        	wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
+        	}catch(Exception e){
+        		e.printStackTrace();
+        	}
+        	File file = new File(wsdlLocation);
+        	url = file.toURL();
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        }
+        ADDNUMBERSSERVICE_WSDL_LOCATION = url;
+    }
+
+    public AddNumbersHandlerService(URL wsdlLocation, QName serviceName) {
+        super(wsdlLocation, serviceName);
+    }
+
+    public AddNumbersHandlerService() {
+        super(ADDNUMBERSSERVICE_WSDL_LOCATION, new QName("http://org/test/addnumbershandler", "AddNumbersHandlerService"));
+    }
+
+    /**
+     * 
+     * @return
+     *     returns AddNumbersHandlerPortType
+     */
+    @WebEndpoint(name = "AddNumbersHandlerPort")
+    public AddNumbersHandlerPortType getAddNumbersHandlerPort() {
+        return (AddNumbersHandlerPortType)super.getPort(new QName("http://org/test/addnumbershandler", "AddNumbersHandlerPort"), AddNumbersHandlerPortType.class);
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersLogicalHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersLogicalHandler.java?view=auto&rev=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersLogicalHandler.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersLogicalHandler.java Wed Mar 28 07:28:56 2007
@@ -0,0 +1,59 @@
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import javax.xml.ws.ProtocolException;
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.axis2.jaxws.handler.SoapMessageContext;
+
+public class AddNumbersLogicalHandler implements javax.xml.ws.handler.LogicalHandler {
+
+    public void close(MessageContext messagecontext) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public boolean handleFault(MessageContext messagecontext) {
+        Boolean outbound = (Boolean)messagecontext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+        if (outbound) {  // outbound response if we're on the server
+            SOAPMessage msg = ((SoapMessageContext)messagecontext).getMessage();
+            SOAPPart part = msg.getSOAPPart();
+            part.getFirstChild().getFirstChild().getFirstChild().setTextContent("a handler was here");
+        }
+        return true;
+    }
+
+    /*
+     * this test handleMessage method is obviously not what a customer might write, but it does
+     * the trick for kicking the tires in the handler framework.  The AddNumbers service takes two
+     * ints as incoming params, adds them, and returns the sum.  This method subtracts 1 from the 
+     * first int on the inbound request, and subtracts 1 from the int on the outbound response.
+     * So the client app should expect a sum 2 less than a sum without this handler manipulating
+     * the SOAP message.
+     */
+    public boolean handleMessage(MessageContext messagecontext) {
+        Boolean outbound = (Boolean)messagecontext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+        if (!outbound) {  // inbound request if we're on the server
+            SOAPMessage msg = ((SoapMessageContext)messagecontext).getMessage();
+            SOAPPart part = msg.getSOAPPart();
+            // hack-ish change, but it's for testing, so who cares.
+            String txt = part.getFirstChild().getFirstChild().getFirstChild().getFirstChild().getTextContent();
+            if (txt.equals("99")) {
+                throw new ProtocolException("I don't like the value 99");
+            }
+            txt = String.valueOf(Integer.valueOf(txt) - 1);
+            part.getFirstChild().getFirstChild().getFirstChild().getFirstChild().setTextContent(txt);
+            return true;
+        } else { // outbound response if we're on the server
+            SOAPMessage msg = ((SoapMessageContext)messagecontext).getMessage();
+            SOAPPart part = msg.getSOAPPart();
+            // hack-ish change, but it's for testing, so who cares.
+            String txt = part.getFirstChild().getFirstChild().getFirstChild().getTextContent();
+            txt = String.valueOf(Integer.valueOf(txt) - 1);
+            part.getFirstChild().getFirstChild().getFirstChild().getFirstChild().setTextContent(txt);
+            return true;
+        }
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersLogicalHandler2.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersLogicalHandler2.java?view=auto&rev=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersLogicalHandler2.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersLogicalHandler2.java Wed Mar 28 07:28:56 2007
@@ -0,0 +1,39 @@
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import javax.xml.ws.ProtocolException;
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.axis2.jaxws.handler.SoapMessageContext;
+
+public class AddNumbersLogicalHandler2 implements javax.xml.ws.handler.LogicalHandler {
+
+    public void close(MessageContext messagecontext) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public boolean handleFault(MessageContext messagecontext) {
+        Boolean outbound = (Boolean)messagecontext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+        if (outbound) {  // outbound response if we're on the server
+            SOAPMessage msg = ((SoapMessageContext)messagecontext).getMessage();
+            SOAPPart part = msg.getSOAPPart();
+            part.getFirstChild().getFirstChild().getFirstChild().getFirstChild().getNextSibling().setTextContent("AddNumbersLogicalHandler2 was here");
+        }
+        return true;
+    }
+
+    /*
+     * this test handleMessage method is obviously not what a customer might write, but it does
+     * the trick for kicking the tires in the handler framework.  The AddNumbers service takes two
+     * ints as incoming params, adds them, and returns the sum.  This method subtracts 1 from the 
+     * first int on the inbound request, and subtracts 1 from the int on the outbound response.
+     * So the client app should expect a sum 2 less than a sum without this handler manipulating
+     * the SOAP message.
+     */
+    public boolean handleMessage(MessageContext messagecontext) {
+    	return true;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/META-INF/AddNumbersHandler.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/META-INF/AddNumbersHandler.wsdl?view=auto&rev=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/META-INF/AddNumbersHandler.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/META-INF/AddNumbersHandler.wsdl Wed Mar 28 07:28:56 2007
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+
+<definitions name="AddNumbersHandler" targetNamespace="http://org/test/addnumbershandler"
+	xmlns:tns="http://org/test/addnumbershandler" xmlns="http://schemas.xmlsoap.org/wsdl/"
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+
+
+	<types>
+		<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+			elementFormDefault="qualified" targetNamespace="http://org/test/addnumbershandler">
+			<element name="addNumbersHandlerResponse">
+				<complexType>
+					<sequence>
+						<element name="return" type="xsd:int" />
+					</sequence>
+				</complexType>
+			</element>
+
+			<element name="addNumbersHandler">
+				<complexType>
+					<sequence>
+						<element name="arg0" type="xsd:int" />
+						<element name="arg1" type="xsd:int" />
+					</sequence>
+				</complexType>
+			</element>
+
+			<element name="AddNumbersHandlerFault">
+				<complexType>
+					<sequence>
+						<element name="faultInfo" type="xsd:string" />
+						<element name="message" type="xsd:string" />
+					</sequence>
+				</complexType>
+			</element>
+
+			<element name="oneWayInt">
+				<complexType>
+					<sequence>
+						<element name="arg0" type="xsd:int" />
+					</sequence>
+				</complexType>
+			</element>
+
+		</xsd:schema>
+	</types>
+
+	<message name="addNumbersHandler">
+		<part name="parameters" element="tns:addNumbersHandler" />
+	</message>
+	<message name="addNumbersHandlerResponse">
+		<part name="result" element="tns:addNumbersHandlerResponse" />
+	</message>
+	<message name="addNumbersHandlerFault">
+		<part name="AddNumbersHandlerFault" element="tns:AddNumbersHandlerFault" />
+	</message>
+	<message name="oneWayInt">
+		<part name="parameters" element="tns:oneWayInt" />
+	</message>
+
+	<portType name="AddNumbersHandlerPortType">
+		<operation name="addNumbersHandler">
+			<input message="tns:addNumbersHandler" name="add" />
+			<output message="tns:addNumbersHandlerResponse" name="addResponse" />
+			<fault name="addNumbersHandlerFault" message="tns:addNumbersHandlerFault" />
+		</operation>
+		<operation name="oneWayInt">
+			<input message="tns:oneWayInt" />
+		</operation>
+	</portType>
+	<binding name="AddNumbersHandlerBinding" type="tns:AddNumbersHandlerPortType">
+		<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
+			style="document" />
+		<operation name="addNumbersHandler">
+			
+			<input>
+				<soap:body use="literal" />
+			</input>
+			<output>
+				<soap:body use="literal" />
+			</output>
+			<fault name="addNumbersHandlerFault">
+				<soap:fault name="addNumbersHandlerFault" use="literal" />
+			</fault>
+		</operation>
+		<operation name="oneWayInt">
+			
+			<input>
+				<soap:body use="literal" />
+			</input>
+		</operation>
+	</binding>
+	<service name="AddNumbersHandlerService">
+		<port name="AddNumbersHandlerPort" binding="tns:AddNumbersHandlerBinding">
+			<soap:address
+				location="http://localhost:9080/AddNumberHandler/AddNumbersHandlerImplService" />
+		</port>
+	</service>
+</definitions>

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/META-INF/AddNumbersHandlers.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/META-INF/AddNumbersHandlers.xml?view=auto&rev=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/META-INF/AddNumbersHandlers.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/META-INF/AddNumbersHandlers.xml Wed Mar 28 07:28:56 2007
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jws:handler-chains xmlns:jws="http://java.sun.com/xml/ns/javaee">
+
+	<jws:handler-chain name="LoggingHandlerChain">
+		<jws:handler>
+			<jws:handler-class>org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersLogicalHandler</jws:handler-class>
+		</jws:handler>
+		<jws:handler>
+			<jws:handler-class>org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersLogicalHandler2</jws:handler-class>
+		</jws:handler>
+	</jws:handler-chain>
+	
+</jws:handler-chains>
+

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/META-INF/services.xml?view=auto&rev=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/META-INF/services.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/META-INF/services.xml Wed Mar 28 07:28:56 2007
@@ -0,0 +1,14 @@
+<serviceGroup>
+ <service name="AddNumbersHandlerService">
+  <messageReceivers>
+   <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver"/>
+  </messageReceivers>
+  <parameter locked="false" name="ServiceClass">org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersHandlerPortTypeImpl</parameter>
+  <operation name="addNumbers" mep="http://www.w3.org/2004/08/wsdl/in-out">
+    <actionMapping/>
+  </operation>
+  <operation name="oneWayInt" mep="http://www.w3.org/2004/08/wsdl/in-only">
+    <actionMapping/>
+  </operation>
+ </service>
+</serviceGroup>

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java?view=diff&rev=523344&r1=523343&r2=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java Wed Mar 28 07:28:56 2007
@@ -28,6 +28,7 @@
 
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.description.AxisService;
+import org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType;
 
 /**
  * An EndpointDescription corresponds to a particular Service Implementation. It
@@ -91,6 +92,9 @@
      * @return
      */
     public abstract String getBindingType();
+    
+    public abstract HandlerChainsType getHandlerChain();
+    
     /**
      * Set the binding type FOR A CLIENT.  The BindingType annotation is not valid on the client per
      * the JAX-WS spec.  The value can be set via addPort(...) for a Dispatch client or via TBD for
@@ -108,7 +112,7 @@
     public void setEndpointAddress(String endpointAddress);
     public abstract String getEndpointAddress();
     
-    public abstract List<String> getHandlerList();
+    //public abstract List<String> getHandlerList();
     public abstract QName getPortQName();
     public abstract QName getServiceQName();
     public abstract Service.Mode getServiceMode(); 

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?view=diff&rev=523344&r1=523343&r2=523344
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Wed Mar 28 07:28:56 2007
@@ -171,11 +171,6 @@
     // Default BindingType.value per JAXWS Spec Sec 7.8 "javax.xml.ws.BindingType" pg 83 
     // and Sec 1.4 "SOAP Transport and Transfer Bindings" pg 119
     public static final String  BindingType_DEFAULT = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING;
-    
-    // ANNOTATION: @HandlerChain
-    // TODO: @HandlerChain support
-    // TODO: This needs to be a collection of handler descriptions; use JAX-WS Appendix B Handler Chain Configuration File Schema as a starting point
-    private ArrayList<String> handlerList = new ArrayList<String>();
 
     /**
      * Create an EndpointDescription based on the WSDL port.  Note that per the JAX-WS Spec (Final Release, 4/19/2006
@@ -1193,10 +1188,16 @@
                             + composite.getClassName());
                 }
 
+                String className = getServiceDescriptionImpl().isDBCMap() ? 
+                        composite.getClassName():implOrSEIClass.getName();
+
+                ClassLoader classLoader = getServiceDescriptionImpl().isDBCMap() ? 
+                        composite.getClassLoader() : this.getClass().getClassLoader();
+                
                 InputStream is = DescriptionUtils.openHandlerConfigStream(
                         handlerFileName, 
-                        composite.getClassName(), 
-                        composite.getClassLoader());
+                        className, 
+                        classLoader);
 
                 try {
                     // All the classes we need should be part of this package
@@ -1222,24 +1223,27 @@
     	    if (getServiceDescriptionImpl().isDBCMap()) {
     	        handlerChainAnnotation = composite.getHandlerChainAnnot();
     	    } else {
-    	        //TODO: Implement this for reflection
+    	        if (implOrSEIClass != null) {
+    	            handlerChainAnnotation = (HandlerChain) implOrSEIClass.getAnnotation(HandlerChain.class);
+    	        }
     	    }
     	}
     	
     	return handlerChainAnnotation;
     }
     
-    /**
+    /*
      * Returns a live list describing the handlers on this port.
      * TODO: This is currently returning List<String>, but it should return a HandlerDescritpion
      * object that can represent a handler description from various Metadata (annotation, deployment descriptors, etc);
      * use JAX-WS Appendix B Handler Chain Configuration File Schema as a starting point for HandlerDescription.
      *  
      * @return A List of handlers for this port.  The actual list is returned, and therefore can be modified.
-     */
+    
     public List<String> getHandlerList() {
         return handlerList;
     }
+    */
     
     private Definition getWSDLDefinition() {
         return ((ServiceDescriptionWSDL) getServiceDescription()).getWSDLDefinition();
@@ -1622,9 +1626,6 @@
 	        string.append("Is proxy-based: " + (isEndpointBased() == true));
 	        string.append(sameline);
 	        string.append("Is WSDL fully specified: " + (isWSDLFullySpecified() == true));
-	        //
-	        string.append(newline);
-	        string.append("Handler List: " + getHandlerList());
 	        //
 	        string.append(newline);
 	        string.append("AxisService: " + getAxisService());



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