[jboss-svn-commits] JBossWS SVN: r691 - in trunk: . src/main/java/org/jboss/ws/integration/jboss src/main/java/org/jboss/ws/jaxrpc src/main/java/org/jboss/ws/jaxws src/main/java/org/jboss/ws/server

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Aug 4 10:31:09 EDT 2006


Author: thomas.diesler at jboss.com
Date: 2006-08-04 10:30:52 -0400 (Fri, 04 Aug 2006)
New Revision: 691

Added:
   trunk/src/main/java/org/jboss/ws/jaxrpc/HandlerDelegateJAXRPC.java
   trunk/src/main/java/org/jboss/ws/jaxws/HandlerDelegateJAXWS.java
   trunk/src/main/java/org/jboss/ws/server/HandlerDelegate.java
Removed:
   trunk/src/main/java/org/jboss/ws/jaxrpc/InvokerDelegateJAXRPC.java
   trunk/src/main/java/org/jboss/ws/jaxws/InvokerDelegateJAXWS.java
   trunk/src/main/java/org/jboss/ws/server/InvokerDelegate.java
Modified:
   trunk/.classpath
   trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerEJB21.java
   trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java
   trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvokerBase.java
Log:
Restore handler callback from ejb interceptor

Modified: trunk/.classpath
===================================================================
--- trunk/.classpath	2006-08-04 13:58:52 UTC (rev 690)
+++ trunk/.classpath	2006-08-04 14:30:52 UTC (rev 691)
@@ -1,28 +1,31 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" path="src/main/java"/>
-	<classpathentry excluding="org/jboss/test/ws/interop/" kind="src" path="src/test/java"/>
-	<classpathentry kind="lib" path="thirdparty/activation.jar"/>
-	<classpathentry kind="lib" path="thirdparty/mailapi.jar"/>
-	<classpathentry kind="lib" path="thirdparty/qdox.jar"/>
-	<classpathentry kind="lib" path="thirdparty/servlet-api.jar"/>
-	<classpathentry kind="lib" path="thirdparty/wsdl4j.jar"/>
-	<classpathentry kind="lib" path="thirdparty/xercesImpl.jar"/>
-	<classpathentry kind="lib" path="thirdparty/xml-apis.jar"/>
-	<classpathentry kind="lib" path="thirdparty/xmlsec.jar"/>
-	<classpathentry kind="lib" path="thirdparty/xmlunit1.0.jar"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="lib" path="thirdparty/xalan.jar"/>
-	<classpathentry kind="lib" path="thirdparty/junit.jar"/>
-	<classpathentry kind="lib" path="thirdparty/concurrent.jar"/>
-	<classpathentry kind="lib" path="thirdparty/javassist.jar"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/jboss-5.0.x"/>
-	<classpathentry kind="lib" path="thirdparty/jboss-xml-binding.jar"/>
-	<classpathentry kind="lib" path="thirdparty/policy-1.0.jar"/>
-	<classpathentry kind="lib" path="thirdparty/stax-api-1.0.jar"/>
-	<classpathentry kind="lib" path="thirdparty/wstx-lgpl-2.0.6.jar"/>
-	<classpathentry kind="lib" path="thirdparty/jaxb-api.jar"/>
-	<classpathentry kind="lib" path="thirdparty/ant.jar"/>
-	<classpathentry kind="lib" path="thirdparty/jboss-common.jar"/>
-	<classpathentry kind="output" path="output-eclipse"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry excluding="org/jboss/test/ws/interop/" kind="src" path="src/test/java"/>
+	<classpathentry kind="lib" path="thirdparty/activation.jar"/>
+	<classpathentry kind="lib" path="thirdparty/mailapi.jar"/>
+	<classpathentry kind="lib" path="thirdparty/qdox.jar"/>
+	<classpathentry kind="lib" path="thirdparty/servlet-api.jar"/>
+	<classpathentry kind="lib" path="thirdparty/wsdl4j.jar"/>
+	<classpathentry kind="lib" path="thirdparty/xercesImpl.jar"/>
+	<classpathentry kind="lib" path="thirdparty/xml-apis.jar"/>
+	<classpathentry kind="lib" path="thirdparty/xmlsec.jar"/>
+	<classpathentry kind="lib" path="thirdparty/xmlunit1.0.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="lib" path="thirdparty/xalan.jar"/>
+	<classpathentry kind="lib" path="thirdparty/junit.jar"/>
+	<classpathentry kind="lib" path="thirdparty/concurrent.jar"/>
+	<classpathentry kind="lib" path="thirdparty/javassist.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/jboss-5.0.x"/>
+	<classpathentry kind="lib" path="thirdparty/jboss-xml-binding.jar"/>
+	<classpathentry kind="lib" path="thirdparty/policy-1.0.jar"/>
+	<classpathentry kind="lib" path="thirdparty/stax-api-1.0.jar"/>
+	<classpathentry kind="lib" path="thirdparty/wstx-lgpl-2.0.6.jar"/>
+	<classpathentry kind="lib" path="thirdparty/jaxb-api.jar"/>
+	<classpathentry kind="lib" path="thirdparty/ant.jar"/>
+	<classpathentry kind="lib" path="thirdparty/jboss-common.jar"/>
+	<classpathentry kind="lib" path="thirdparty/jboss-container.jar"/>
+	<classpathentry kind="lib" path="thirdparty/jboss-microcontainer.jar"/>
+	<classpathentry kind="lib" path="thirdparty/jboss-remoting.jar"/>
+	<classpathentry kind="output" path="output-eclipse"/>
+</classpath>

Modified: trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerEJB21.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerEJB21.java	2006-08-04 13:58:52 UTC (rev 690)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerEJB21.java	2006-08-04 14:30:52 UTC (rev 691)
@@ -196,6 +196,24 @@
       // do nothing
    }
 
+   /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
+   public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+   {
+      return true;
+   }
+
+   /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
+   public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+   {
+      return true;
+   }
+   
+   /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
+   public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex)
+   {
+      return true;
+   }
+   
    // The ServiceEndpointInterceptor calls the methods in this callback
    public class HandlerCallback
    {
@@ -208,17 +226,17 @@
 
       public boolean callRequestHandlerChain(HandlerType type)
       {
-         return delegate.callRequestHandlerChain(seInfo, type);
+         return handlerDelegate.callRequestHandlerChain(seInfo, type);
       }
 
       public boolean callResponseHandlerChain(HandlerType type)
       {
-         return delegate.callResponseHandlerChain(seInfo, type);
+         return handlerDelegate.callResponseHandlerChain(seInfo, type);
       }
 
       public boolean callFaultHandlerChain(HandlerType type, Exception ex)
       {
-         return delegate.callFaultHandlerChain(seInfo, type, ex);
+         return handlerDelegate.callFaultHandlerChain(seInfo, type, ex);
       }
    }
 }

Copied: trunk/src/main/java/org/jboss/ws/jaxrpc/HandlerDelegateJAXRPC.java (from rev 682, trunk/src/main/java/org/jboss/ws/jaxrpc/InvokerDelegateJAXRPC.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/InvokerDelegateJAXRPC.java	2006-08-04 08:44:22 UTC (rev 682)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/HandlerDelegateJAXRPC.java	2006-08-04 14:30:52 UTC (rev 691)
@@ -0,0 +1,199 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.jaxrpc;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.HandlerChain;
+import javax.xml.rpc.handler.HandlerInfo;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.jaxrpc.handler.HandlerChainBaseImpl;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.jaxrpc.handler.ServerHandlerChain;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedInitParamMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
+import org.jboss.ws.server.HandlerDelegate;
+import org.jboss.ws.server.ServiceEndpointInfo;
+import org.jboss.ws.soap.MessageContextAssociation;
+
+/** Delegates to JAXRPC handlers
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 19-Jan-2005
+ */
+public class HandlerDelegateJAXRPC implements HandlerDelegate
+{
+   // provide logging
+   private static Logger log = Logger.getLogger(HandlerDelegateJAXRPC.class);
+
+   // This endpoints handler chain
+   private ServerHandlerChain preHandlerChain;
+   // This endpoints handler chain
+   private ServerHandlerChain jaxrpcHandlerChain;
+   // This endpoints handler chain
+   private ServerHandlerChain postHandlerChain;
+
+   public HandlerDelegateJAXRPC()
+   {
+   }
+
+   public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+   {
+      SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
+
+      // Initialize the handler chain
+      if (jaxrpcHandlerChain == null)
+      {
+         initHandlerChain(seInfo, HandlerType.PRE);
+         initHandlerChain(seInfo, HandlerType.JAXRPC);
+         initHandlerChain(seInfo, HandlerType.POST);
+      }
+
+      boolean status = true;
+      String[] roles = null;
+
+      HandlerChain handlerChain = null;
+      if (type == HandlerType.PRE)
+         handlerChain = preHandlerChain;
+      else if (type == HandlerType.JAXRPC)
+         handlerChain = jaxrpcHandlerChain;
+      else if (type == HandlerType.POST)
+         handlerChain = postHandlerChain;
+      
+      if (handlerChain != null)
+      {
+         roles = handlerChain.getRoles();
+         status = handlerChain.handleRequest(msgContext);
+      }
+
+      // BP-1.0 R1027
+      if (type == HandlerType.POST)
+         HandlerChainBaseImpl.checkMustUnderstand(msgContext, roles);
+      
+      return status;
+   }
+
+   public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+   {
+      SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
+      
+      HandlerChain handlerChain = null;
+      if (type == HandlerType.PRE)
+         handlerChain = preHandlerChain;
+      else if (type == HandlerType.JAXRPC)
+         handlerChain = jaxrpcHandlerChain;
+      else if (type == HandlerType.POST)
+         handlerChain = postHandlerChain;
+      
+      return (handlerChain != null ? handlerChain.handleResponse(msgContext) : true);
+   }
+
+   public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex)
+   {
+      SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
+
+      HandlerChain handlerChain = null;
+      if (type == HandlerType.PRE)
+         handlerChain = preHandlerChain;
+      else if (type == HandlerType.JAXRPC)
+         handlerChain = jaxrpcHandlerChain;
+      else if (type == HandlerType.POST)
+         handlerChain = postHandlerChain;
+      
+      return (handlerChain != null ? handlerChain.handleFault(msgContext) : true);
+   }
+
+   /**
+    * Init the handler chain
+    */
+   private void initHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+   {
+      Set<String> handlerRoles = new HashSet<String>();
+      List<HandlerInfo> hInfos = new ArrayList<HandlerInfo>();
+
+      ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
+      for (UnifiedHandlerMetaData handlerMetaData : sepMetaData.getHandlers(type))
+      {
+         handlerRoles.addAll(Arrays.asList(handlerMetaData.getSoapRoles()));
+
+         Class hClass;
+         String handlerClass = handlerMetaData.getHandlerClass();
+         try
+         {
+            // Load the handler class using the deployments top level CL
+            ClassLoader classLoader = sepMetaData.getClassLoader();
+            hClass = classLoader.loadClass(handlerClass);
+         }
+         catch (ClassNotFoundException e)
+         {
+            throw new WSException("Cannot load handler class: " + handlerClass);
+         }
+
+         HashMap<String, Object> hConfig = new HashMap<String, Object>();
+         UnifiedInitParamMetaData[] params = handlerMetaData.getInitParams();
+         for (int j = 0; j < params.length; j++)
+         {
+            UnifiedInitParamMetaData param = params[j];
+            hConfig.put(param.getParamName(), param.getParamValue());
+         }
+         QName[] hHeaders = handlerMetaData.getSoapHeaders();
+         HandlerInfo info = new HandlerInfo(hClass, hConfig, hHeaders);
+
+         log.debug("Adding server side handler to service '" + sepMetaData.getQName() + "': " + info);
+         hInfos.add(info);
+      }
+
+      initHandlerChain(seInfo, hInfos, handlerRoles, type);
+   }
+
+   private void initHandlerChain(ServiceEndpointInfo seInfo, List<HandlerInfo> hInfos, Set<String> handlerRoles, HandlerType type)
+   {
+      log.debug("Init handler chain with [" + hInfos.size() + "] handlers");
+
+      ServerHandlerChain handlerChain = new ServerHandlerChain(hInfos, handlerRoles, type);
+      if (type == HandlerType.PRE)
+         preHandlerChain = handlerChain;
+      else if (type == HandlerType.JAXRPC)
+         jaxrpcHandlerChain = handlerChain;
+      else if (type == HandlerType.POST)
+         postHandlerChain = handlerChain;
+
+      if (handlerChain.getState() == ServerHandlerChain.STATE_CREATED)
+      {
+         // what is the config for a handler chain?
+         handlerChain.init(null);
+      }
+   }
+
+}

Deleted: trunk/src/main/java/org/jboss/ws/jaxrpc/InvokerDelegateJAXRPC.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/InvokerDelegateJAXRPC.java	2006-08-04 13:58:52 UTC (rev 690)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/InvokerDelegateJAXRPC.java	2006-08-04 14:30:52 UTC (rev 691)
@@ -1,340 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.jaxrpc;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
-import javax.xml.rpc.handler.HandlerChain;
-import javax.xml.rpc.handler.HandlerInfo;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPBodyElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.Service.Mode;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.binding.BindingProvider;
-import org.jboss.ws.binding.BindingProviderRegistry;
-import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.common.SOAPMessageContextBase;
-import org.jboss.ws.jaxrpc.handler.HandlerChainBaseImpl;
-import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.jaxrpc.handler.ServerHandlerChain;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedInitParamMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
-import org.jboss.ws.server.InvokerDelegate;
-import org.jboss.ws.server.ServiceEndpointInfo;
-import org.jboss.ws.server.ServiceEndpointInvoker;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageImpl;
-
-/** An implementation of handles invocations on the endpoint
- *
- * @author Thomas.Diesler at jboss.org
- * @since 19-Jan-2005
- */
-public class InvokerDelegateJAXRPC implements InvokerDelegate
-{
-   // provide logging
-   private static Logger log = Logger.getLogger(InvokerDelegateJAXRPC.class);
-
-   // The endpoint invoker
-   private ServiceEndpointInvoker sepInvoker;
-   // This endpoints handler chain
-   private ServerHandlerChain preHandlerChain;
-   // This endpoints handler chain
-   private ServerHandlerChain jaxrpcHandlerChain;
-   // This endpoints handler chain
-   private ServerHandlerChain postHandlerChain;
-
-   public InvokerDelegateJAXRPC(ServiceEndpointInvoker sepInvoker)
-   {
-      this.sepInvoker = sepInvoker;
-   }
-
-   /** Invoke the the service endpoint */
-   public SOAPMessage invoke(ServiceEndpointInfo seInfo, Object context) throws Exception
-   {
-      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
-      EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
-      SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgContext.getMessage();
-
-      // Load the endpoint implementation bean
-      Class seImpl = sepInvoker.loadServiceEndpoint(seInfo);
-
-      // Create an instance of the endpoint implementation bean
-      Object seInstance = sepInvoker.createServiceEndpoint(seInfo, context, seImpl);
-
-      try
-      {
-         boolean oneway = false;
-
-         // call the handler chain
-         boolean handlersPass = callRequestHandlerChain(seInfo, HandlerType.PRE);
-         handlersPass = handlersPass && callRequestHandlerChain(seInfo, HandlerType.JAXRPC);
-         handlersPass = handlersPass && callRequestHandlerChain(seInfo, HandlerType.POST);
-         
-         if (handlersPass)
-         {
-            // Get the binding provider for the given bindingURI
-            BindingProvider bindingProvider;
-            if (epMetaData.getServiceMode() == Mode.MESSAGE)
-            {
-               bindingProvider = BindingProviderRegistry.getProvider(BindingProvider.JAXWS_MESSAGE_BINDING);
-            }
-            else if (epMetaData.getServiceMode() == Mode.PAYLOAD)
-            {
-               bindingProvider = BindingProviderRegistry.getProvider(BindingProvider.JAXWS_PAYLOAD_BINDING);
-            }
-            else
-            {
-               bindingProvider = BindingProviderRegistry.getDefaultProvider();
-            }
-
-            // Get the operation meta data from the SOAP message
-            OperationMetaData opMetaData = getDispatchDestination(epMetaData, reqMessage);
-            msgContext.setOperationMetaData(opMetaData);
-            oneway = opMetaData.isOneWayOperation();
-
-            // Unbind the request message
-            EndpointInvocation epInv = bindingProvider.unbindRequestMessage(opMetaData, reqMessage);
-
-            // Invoke the service endpoint
-            sepInvoker.invokeServiceEndpoint(seInfo, seInstance, epInv);
-
-            // Bind the response message
-            SOAPMessage resMessage = bindingProvider.bindResponseMessage(opMetaData, epInv);
-            msgContext.setMessage(resMessage);
-         }
-
-         // call the handler chain
-         if (oneway == false)
-         {
-            handlersPass = callResponseHandlerChain(seInfo, HandlerType.POST);
-            handlersPass = handlersPass && callResponseHandlerChain(seInfo, HandlerType.JAXRPC);
-            handlersPass = handlersPass && callResponseHandlerChain(seInfo, HandlerType.PRE);
-         }
-
-         SOAPMessage resMessage = msgContext.getMessage();
-         return resMessage;
-      }
-      catch (Exception ex)
-      {
-         try
-         {
-            SOAPMessage faultMessage = SOAPFaultExceptionHelper.exceptionToFaultMessage(ex);
-            msgContext.setMessage(faultMessage);
-            
-            // call the handler chain
-            boolean handlersPass = callFaultHandlerChain(seInfo, HandlerType.POST, ex);
-            handlersPass = handlersPass && callFaultHandlerChain(seInfo, HandlerType.JAXRPC, ex);
-            handlersPass = handlersPass && callFaultHandlerChain(seInfo, HandlerType.PRE, ex);
-         }
-         catch (Exception subEx)
-         {
-            log.warn("Cannot process handlerChain.handleFault, ignoring: ", subEx);
-         }
-         throw ex;
-      }
-      finally
-      {
-         sepInvoker.destroyServiceEndpoint(seInfo, seInstance);
-      }
-   }
-
-   private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData, SOAPMessageImpl reqMessage) throws SOAPException
-   {
-      OperationMetaData opMetaData = reqMessage.getOperationMetaData(epMetaData);
-      SOAPHeader soapHeader = reqMessage.getSOAPHeader();
-
-      // Report a MustUnderstand fault
-      if (opMetaData == null)
-      {
-         SOAPBody soapBody = reqMessage.getSOAPBody();
-         SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
-         Name soapName = soapBodyElement.getElementName();
-
-         // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL description, it SHOULD generate a soap:Fault
-         // with a faultcode of "Client", unless a "MustUnderstand" or "VersionMismatch" fault is generated.
-         if (soapHeader != null && soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
-         {
-            QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
-            String faultString = "Endpoint " + epMetaData.getQName() + " does not contain operation meta data for: " + soapName;
-            throw new SOAPFaultException(faultCode, faultString, null, null);
-         }
-         else
-         {
-            QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
-            String faultString = "Endpoint " + epMetaData.getQName() + " does not contain operation meta data for: " + soapName;
-            throw new SOAPFaultException(faultCode, faultString, null, null);
-         }
-      }
-      return opMetaData;
-   }
-
-   public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
-   {
-      SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
-
-      // Initialize the handler chain
-      if (jaxrpcHandlerChain == null)
-      {
-         initHandlerChain(seInfo, HandlerType.PRE);
-         initHandlerChain(seInfo, HandlerType.JAXRPC);
-         initHandlerChain(seInfo, HandlerType.POST);
-      }
-
-      boolean status = true;
-      String[] roles = null;
-
-      HandlerChain handlerChain = null;
-      if (type == HandlerType.PRE)
-         handlerChain = preHandlerChain;
-      else if (type == HandlerType.JAXRPC)
-         handlerChain = jaxrpcHandlerChain;
-      else if (type == HandlerType.POST)
-         handlerChain = postHandlerChain;
-      
-      if (handlerChain != null)
-      {
-         roles = handlerChain.getRoles();
-         status = handlerChain.handleRequest(msgContext);
-      }
-
-      // BP-1.0 R1027
-      if (type == HandlerType.POST)
-         HandlerChainBaseImpl.checkMustUnderstand(msgContext, roles);
-      
-      return status;
-   }
-
-   public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
-   {
-      SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
-      
-      HandlerChain handlerChain = null;
-      if (type == HandlerType.PRE)
-         handlerChain = preHandlerChain;
-      else if (type == HandlerType.JAXRPC)
-         handlerChain = jaxrpcHandlerChain;
-      else if (type == HandlerType.POST)
-         handlerChain = postHandlerChain;
-      
-      return (handlerChain != null ? handlerChain.handleResponse(msgContext) : true);
-   }
-
-   public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex)
-   {
-      SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
-
-      HandlerChain handlerChain = null;
-      if (type == HandlerType.PRE)
-         handlerChain = preHandlerChain;
-      else if (type == HandlerType.JAXRPC)
-         handlerChain = jaxrpcHandlerChain;
-      else if (type == HandlerType.POST)
-         handlerChain = postHandlerChain;
-      
-      return (handlerChain != null ? handlerChain.handleFault(msgContext) : true);
-   }
-
-   /**
-    * Init the handler chain
-    */
-   private void initHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
-   {
-      Set<String> handlerRoles = new HashSet<String>();
-      List<HandlerInfo> hInfos = new ArrayList<HandlerInfo>();
-
-      ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
-      for (UnifiedHandlerMetaData handlerMetaData : sepMetaData.getHandlers(type))
-      {
-         handlerRoles.addAll(Arrays.asList(handlerMetaData.getSoapRoles()));
-
-         Class hClass;
-         String handlerClass = handlerMetaData.getHandlerClass();
-         try
-         {
-            // Load the handler class using the deployments top level CL
-            ClassLoader classLoader = sepMetaData.getClassLoader();
-            hClass = classLoader.loadClass(handlerClass);
-         }
-         catch (ClassNotFoundException e)
-         {
-            throw new WSException("Cannot load handler class: " + handlerClass);
-         }
-
-         HashMap<String, Object> hConfig = new HashMap<String, Object>();
-         UnifiedInitParamMetaData[] params = handlerMetaData.getInitParams();
-         for (int j = 0; j < params.length; j++)
-         {
-            UnifiedInitParamMetaData param = params[j];
-            hConfig.put(param.getParamName(), param.getParamValue());
-         }
-         QName[] hHeaders = handlerMetaData.getSoapHeaders();
-         HandlerInfo info = new HandlerInfo(hClass, hConfig, hHeaders);
-
-         log.debug("Adding server side handler to service '" + sepMetaData.getQName() + "': " + info);
-         hInfos.add(info);
-      }
-
-      initHandlerChain(seInfo, hInfos, handlerRoles, type);
-   }
-
-   private void initHandlerChain(ServiceEndpointInfo seInfo, List<HandlerInfo> hInfos, Set<String> handlerRoles, HandlerType type)
-   {
-      log.debug("Init handler chain with [" + hInfos.size() + "] handlers");
-
-      ServerHandlerChain handlerChain = new ServerHandlerChain(hInfos, handlerRoles, type);
-      if (type == HandlerType.PRE)
-         preHandlerChain = handlerChain;
-      else if (type == HandlerType.JAXRPC)
-         jaxrpcHandlerChain = handlerChain;
-      else if (type == HandlerType.POST)
-         postHandlerChain = handlerChain;
-
-      if (handlerChain.getState() == ServerHandlerChain.STATE_CREATED)
-      {
-         // what is the config for a handler chain?
-         handlerChain.init(null);
-      }
-   }
-
-}

Copied: trunk/src/main/java/org/jboss/ws/jaxws/HandlerDelegateJAXWS.java (from rev 682, trunk/src/main/java/org/jboss/ws/jaxws/InvokerDelegateJAXWS.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/InvokerDelegateJAXWS.java	2006-08-04 08:44:22 UTC (rev 682)
+++ trunk/src/main/java/org/jboss/ws/jaxws/HandlerDelegateJAXWS.java	2006-08-04 14:30:52 UTC (rev 691)
@@ -0,0 +1,238 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.jaxws;
+
+// $Id$
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.management.MBeanException;
+import javax.xml.rpc.soap.SOAPFaultException;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.jaxws.handler.HandlerChainBaseImpl;
+import org.jboss.ws.jaxws.handler.HandlerInfo;
+import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.jaxws.handler.ServerHandlerChain;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedInitParamMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
+import org.jboss.ws.server.HandlerDelegate;
+import org.jboss.ws.server.ServiceEndpointInfo;
+import org.jboss.ws.soap.MessageContextAssociation;
+
+/** Delegates to JAXWS handlers
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 19-Jan-2005
+ */
+public class HandlerDelegateJAXWS implements HandlerDelegate
+{
+   // provide logging
+   private static Logger log = Logger.getLogger(HandlerDelegateJAXWS.class);
+
+   // This endpoints handler chain
+   private ServerHandlerChain preHandlerChain;
+   // This endpoints handler chain
+   private ServerHandlerChain jaxwsHandlerChain;
+   // This endpoints handler chain
+   private ServerHandlerChain postHandlerChain;
+
+   public HandlerDelegateJAXWS()
+   {
+   }
+
+   /** handle invokation exceptions */
+   public void handleInvocationException(Throwable th) throws SOAPFaultException
+   {
+      if (th instanceof RuntimeException)
+         throw (RuntimeException)th;
+
+      if (th instanceof InvocationTargetException)
+      {
+         InvocationTargetException targetException = (InvocationTargetException)th;
+         Throwable targetEx = targetException.getTargetException();
+         if (targetEx instanceof SOAPFaultException)
+         {
+            throw (SOAPFaultException)targetEx;
+         }
+         else
+         {
+            String faultString = targetEx.toString();
+            SOAPFaultException soapFaultEx = new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, faultString, null, null);
+            soapFaultEx.initCause(targetEx);
+            throw soapFaultEx;
+         }
+      }
+
+      if (th instanceof MBeanException)
+      {
+         Exception targetEx = ((MBeanException)th).getTargetException();
+         if (targetEx instanceof SOAPFaultException)
+         {
+            throw (SOAPFaultException)targetEx;
+         }
+         else
+         {
+            String faultString = targetEx.toString();
+            SOAPFaultException soapFaultEx = new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, faultString, null, null);
+            soapFaultEx.initCause(targetEx);
+            throw soapFaultEx;
+         }
+      }
+
+      String faultString = th.toString();
+      SOAPFaultException soapFaultEx = new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, faultString, null, null);
+      soapFaultEx.initCause(th);
+      throw soapFaultEx;
+   }
+
+   public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+   {
+      SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
+
+      // Initialize the handler chain
+      if (jaxwsHandlerChain == null)
+      {
+         initHandlerChain(seInfo, HandlerType.PRE);
+         initHandlerChain(seInfo, HandlerType.JAXWS);
+         initHandlerChain(seInfo, HandlerType.POST);
+      }
+
+      boolean status = true;
+      String[] roles = null;
+
+      HandlerChainBaseImpl handlerChain = null;
+      if (type == HandlerType.PRE)
+         handlerChain = preHandlerChain;
+      else if (type == HandlerType.JAXWS)
+         handlerChain = jaxwsHandlerChain;
+      else if (type == HandlerType.POST)
+         handlerChain = postHandlerChain;
+      
+      if (handlerChain != null)
+      {
+         roles = handlerChain.getRoles();
+         status = handlerChain.handleMessage(msgContext);
+      }
+
+      // BP-1.0 R1027
+      if (type == HandlerType.POST)
+         HandlerChainBaseImpl.checkMustUnderstand(msgContext, roles);
+      
+      return status;
+   }
+
+   public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+   {
+      SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
+      
+      HandlerChainBaseImpl handlerChain = null;
+      if (type == HandlerType.PRE)
+         handlerChain = preHandlerChain;
+      else if (type == HandlerType.JAXWS)
+         handlerChain = jaxwsHandlerChain;
+      else if (type == HandlerType.POST)
+         handlerChain = postHandlerChain;
+      
+      return (handlerChain != null ? handlerChain.handleMessage(msgContext) : true);
+   }
+
+   public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex)
+   {
+      SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
+
+      HandlerChainBaseImpl handlerChain = null;
+      if (type == HandlerType.PRE)
+         handlerChain = preHandlerChain;
+      else if (type == HandlerType.JAXWS)
+         handlerChain = jaxwsHandlerChain;
+      else if (type == HandlerType.POST)
+         handlerChain = postHandlerChain;
+      
+      return (handlerChain != null ? handlerChain.handleFault(msgContext) : true);
+   }
+
+   /**
+    * Init the handler chain
+    */
+   private void initHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+   {
+      Set<String> handlerRoles = new HashSet<String>();
+      List<HandlerInfo> hInfos = new ArrayList<HandlerInfo>();
+
+      ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
+      for (UnifiedHandlerMetaData handlerMetaData : sepMetaData.getHandlers(type))
+      {
+         handlerRoles.addAll(Arrays.asList(handlerMetaData.getSoapRoles()));
+
+         Class hClass;
+         String handlerClass = handlerMetaData.getHandlerClass();
+         try
+         {
+            // Load the handler class using the deployments top level CL
+            ClassLoader classLoader = sepMetaData.getClassLoader();
+            hClass = classLoader.loadClass(handlerClass);
+         }
+         catch (ClassNotFoundException e)
+         {
+            throw new WSException("Cannot load handler class: " + handlerClass);
+         }
+
+         HashMap<String, Object> hConfig = new HashMap<String, Object>();
+         UnifiedInitParamMetaData[] params = handlerMetaData.getInitParams();
+         for (int j = 0; j < params.length; j++)
+         {
+            UnifiedInitParamMetaData param = params[j];
+            hConfig.put(param.getParamName(), param.getParamValue());
+         }
+         HandlerInfo info = new HandlerInfo(hClass);
+
+         log.debug("Adding server side handler to service '" + sepMetaData.getQName() + "': " + info);
+         hInfos.add(info);
+      }
+
+      initHandlerChain(seInfo, hInfos, handlerRoles, type);
+   }
+
+   private void initHandlerChain(ServiceEndpointInfo seInfo, List<HandlerInfo> hInfos, Set<String> handlerRoles, HandlerType type)
+   {
+      log.debug("Init handler chain with [" + hInfos.size() + "] handlers");
+
+      ServerHandlerChain handlerChain = new ServerHandlerChain(hInfos, handlerRoles, type);
+      if (type == HandlerType.PRE)
+         preHandlerChain = handlerChain;
+      else if (type == HandlerType.JAXWS)
+         jaxwsHandlerChain = handlerChain;
+      else if (type == HandlerType.POST)
+         postHandlerChain = handlerChain;
+   }
+}

Deleted: trunk/src/main/java/org/jboss/ws/jaxws/InvokerDelegateJAXWS.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/InvokerDelegateJAXWS.java	2006-08-04 13:58:52 UTC (rev 690)
+++ trunk/src/main/java/org/jboss/ws/jaxws/InvokerDelegateJAXWS.java	2006-08-04 14:30:52 UTC (rev 691)
@@ -1,380 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.jaxws;
-
-// $Id$
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.management.MBeanException;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPBodyElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.Service.Mode;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.binding.BindingProvider;
-import org.jboss.ws.binding.BindingProviderRegistry;
-import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
-import org.jboss.ws.jaxws.handler.HandlerChainBaseImpl;
-import org.jboss.ws.jaxws.handler.HandlerInfo;
-import org.jboss.ws.jaxws.handler.MessageContextJAXWS;
-import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.jaxws.handler.ServerHandlerChain;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedInitParamMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
-import org.jboss.ws.server.InvokerDelegate;
-import org.jboss.ws.server.ServiceEndpointInfo;
-import org.jboss.ws.server.ServiceEndpointInvoker;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageImpl;
-
-/** An implementation of handles invocations on the endpoint
- *
- * @author Thomas.Diesler at jboss.org
- * @since 19-Jan-2005
- */
-public class InvokerDelegateJAXWS implements InvokerDelegate
-{
-   // provide logging
-   private static Logger log = Logger.getLogger(InvokerDelegateJAXWS.class);
-
-   private ServiceEndpointInvoker sepInvoker;
-   // This endpoints handler chain
-   private ServerHandlerChain preHandlerChain;
-   // This endpoints handler chain
-   private ServerHandlerChain jaxwsHandlerChain;
-   // This endpoints handler chain
-   private ServerHandlerChain postHandlerChain;
-
-   public InvokerDelegateJAXWS(ServiceEndpointInvoker sepInvoker)
-   {
-      this.sepInvoker = sepInvoker;
-   }
-
-   /** Invoke the the service endpoint */
-   public SOAPMessage invoke(ServiceEndpointInfo seInfo, Object endpointContext) throws Exception
-   {
-      SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
-      EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
-      SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgContext.getMessage();
-
-      // Load the endpoint implementation bean
-      Class seImpl = sepInvoker.loadServiceEndpoint(seInfo);
-
-      // Create an instance of the endpoint implementation bean
-      Object seInstance = sepInvoker.createServiceEndpoint(seInfo, endpointContext, seImpl);
-
-      try
-      {
-         boolean oneway = false;
-
-         // call the handler chain
-         boolean handlersPass = callRequestHandlerChain(seInfo, HandlerType.PRE);
-         handlersPass = handlersPass && callRequestHandlerChain(seInfo, HandlerType.JAXWS);
-         handlersPass = handlersPass && callRequestHandlerChain(seInfo, HandlerType.POST);
-         
-         if (handlersPass)
-         {
-            // Get the binding provider for the given bindingURI
-            BindingProvider bindingProvider;
-            if (epMetaData.getServiceMode() == Mode.MESSAGE)
-            {
-               bindingProvider = BindingProviderRegistry.getProvider(BindingProvider.JAXWS_MESSAGE_BINDING);
-            }
-            else if (epMetaData.getServiceMode() == Mode.PAYLOAD)
-            {
-               bindingProvider = BindingProviderRegistry.getProvider(BindingProvider.JAXWS_PAYLOAD_BINDING);
-            }
-            else
-            {
-               bindingProvider = BindingProviderRegistry.getDefaultProvider();
-            }
-
-            // Get the operation meta data from the SOAP message
-            OperationMetaData opMetaData = getDispatchDestination(epMetaData, reqMessage);
-            msgContext.setOperationMetaData(opMetaData);
-            oneway = opMetaData.isOneWayOperation();
-
-            // Unbind the request message
-            EndpointInvocation epInv = bindingProvider.unbindRequestMessage(opMetaData, reqMessage);
-
-            // Invoke the service endpoint
-            sepInvoker.invokeServiceEndpoint(seInfo, seInstance, epInv);
-
-            // Bind the response message
-            SOAPMessage resMessage = bindingProvider.bindResponseMessage(opMetaData, epInv);
-            msgContext.setMessage(resMessage);
-            
-            // Mark the message context as outbound
-            msgContext.setProperty(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new Boolean(true));
-         }
-
-         // call the handler chain
-         if (oneway == false)
-         {
-            handlersPass = callResponseHandlerChain(seInfo, HandlerType.POST);
-            handlersPass = handlersPass && callResponseHandlerChain(seInfo, HandlerType.JAXWS);
-            handlersPass = handlersPass && callResponseHandlerChain(seInfo, HandlerType.PRE);
-         }
-
-         SOAPMessage resMessage = msgContext.getMessage();
-         return resMessage;
-      }
-      catch (Exception ex)
-      {
-         try
-         {
-            SOAPMessage faultMessage = SOAPFaultExceptionHelper.exceptionToFaultMessage(ex);
-            msgContext.setMessage(faultMessage);
-            
-            // call the handler chain
-            boolean handlersPass = callFaultHandlerChain(seInfo, HandlerType.POST, ex);
-            handlersPass = handlersPass && callFaultHandlerChain(seInfo, HandlerType.JAXWS, ex);
-            handlersPass = handlersPass && callFaultHandlerChain(seInfo, HandlerType.PRE, ex);
-         }
-         catch (Exception subEx)
-         {
-            log.warn("Cannot process handlerChain.handleFault, ignoring: ", subEx);
-         }
-         throw ex;
-      }
-      finally
-      {
-         sepInvoker.destroyServiceEndpoint(seInfo, seInstance);
-      }
-   }
-
-   private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData, SOAPMessageImpl reqMessage) throws SOAPException
-   {
-      OperationMetaData opMetaData = reqMessage.getOperationMetaData(epMetaData);
-      SOAPHeader soapHeader = reqMessage.getSOAPHeader();
-
-      // Report a MustUnderstand fault
-      if (opMetaData == null)
-      {
-         SOAPBody soapBody = reqMessage.getSOAPBody();
-         SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
-         Name soapName = soapBodyElement.getElementName();
-
-         // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL description, it SHOULD generate a soap:Fault
-         // with a faultcode of "Client", unless a "MustUnderstand" or "VersionMismatch" fault is generated.
-         if (soapHeader != null && soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
-         {
-            QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
-            String faultString = "Endpoint " + epMetaData.getQName() + " does not contain operation meta data for: " + soapName;
-            throw new SOAPFaultException(faultCode, faultString, null, null);
-         }
-         else
-         {
-            QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
-            String faultString = "Endpoint " + epMetaData.getQName() + " does not contain operation meta data for: " + soapName;
-            throw new SOAPFaultException(faultCode, faultString, null, null);
-         }
-      }
-      return opMetaData;
-   }
-
-   /** handle invokation exceptions */
-   public void handleInvocationException(Throwable th) throws SOAPFaultException
-   {
-      if (th instanceof RuntimeException)
-         throw (RuntimeException)th;
-
-      if (th instanceof InvocationTargetException)
-      {
-         InvocationTargetException targetException = (InvocationTargetException)th;
-         Throwable targetEx = targetException.getTargetException();
-         if (targetEx instanceof SOAPFaultException)
-         {
-            throw (SOAPFaultException)targetEx;
-         }
-         else
-         {
-            String faultString = targetEx.toString();
-            SOAPFaultException soapFaultEx = new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, faultString, null, null);
-            soapFaultEx.initCause(targetEx);
-            throw soapFaultEx;
-         }
-      }
-
-      if (th instanceof MBeanException)
-      {
-         Exception targetEx = ((MBeanException)th).getTargetException();
-         if (targetEx instanceof SOAPFaultException)
-         {
-            throw (SOAPFaultException)targetEx;
-         }
-         else
-         {
-            String faultString = targetEx.toString();
-            SOAPFaultException soapFaultEx = new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, faultString, null, null);
-            soapFaultEx.initCause(targetEx);
-            throw soapFaultEx;
-         }
-      }
-
-      String faultString = th.toString();
-      SOAPFaultException soapFaultEx = new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, faultString, null, null);
-      soapFaultEx.initCause(th);
-      throw soapFaultEx;
-   }
-
-   public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
-   {
-      SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
-
-      // Initialize the handler chain
-      if (jaxwsHandlerChain == null)
-      {
-         initHandlerChain(seInfo, HandlerType.PRE);
-         initHandlerChain(seInfo, HandlerType.JAXWS);
-         initHandlerChain(seInfo, HandlerType.POST);
-      }
-
-      boolean status = true;
-      String[] roles = null;
-
-      HandlerChainBaseImpl handlerChain = null;
-      if (type == HandlerType.PRE)
-         handlerChain = preHandlerChain;
-      else if (type == HandlerType.JAXWS)
-         handlerChain = jaxwsHandlerChain;
-      else if (type == HandlerType.POST)
-         handlerChain = postHandlerChain;
-      
-      if (handlerChain != null)
-      {
-         roles = handlerChain.getRoles();
-         status = handlerChain.handleMessage(msgContext);
-      }
-
-      // BP-1.0 R1027
-      if (type == HandlerType.POST)
-         HandlerChainBaseImpl.checkMustUnderstand(msgContext, roles);
-      
-      return status;
-   }
-
-   public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
-   {
-      SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
-      
-      HandlerChainBaseImpl handlerChain = null;
-      if (type == HandlerType.PRE)
-         handlerChain = preHandlerChain;
-      else if (type == HandlerType.JAXWS)
-         handlerChain = jaxwsHandlerChain;
-      else if (type == HandlerType.POST)
-         handlerChain = postHandlerChain;
-      
-      return (handlerChain != null ? handlerChain.handleMessage(msgContext) : true);
-   }
-
-   public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex)
-   {
-      SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
-
-      HandlerChainBaseImpl handlerChain = null;
-      if (type == HandlerType.PRE)
-         handlerChain = preHandlerChain;
-      else if (type == HandlerType.JAXWS)
-         handlerChain = jaxwsHandlerChain;
-      else if (type == HandlerType.POST)
-         handlerChain = postHandlerChain;
-      
-      return (handlerChain != null ? handlerChain.handleFault(msgContext) : true);
-   }
-
-   /**
-    * Init the handler chain
-    */
-   private void initHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
-   {
-      Set<String> handlerRoles = new HashSet<String>();
-      List<HandlerInfo> hInfos = new ArrayList<HandlerInfo>();
-
-      ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
-      for (UnifiedHandlerMetaData handlerMetaData : sepMetaData.getHandlers(type))
-      {
-         handlerRoles.addAll(Arrays.asList(handlerMetaData.getSoapRoles()));
-
-         Class hClass;
-         String handlerClass = handlerMetaData.getHandlerClass();
-         try
-         {
-            // Load the handler class using the deployments top level CL
-            ClassLoader classLoader = sepMetaData.getClassLoader();
-            hClass = classLoader.loadClass(handlerClass);
-         }
-         catch (ClassNotFoundException e)
-         {
-            throw new WSException("Cannot load handler class: " + handlerClass);
-         }
-
-         HashMap<String, Object> hConfig = new HashMap<String, Object>();
-         UnifiedInitParamMetaData[] params = handlerMetaData.getInitParams();
-         for (int j = 0; j < params.length; j++)
-         {
-            UnifiedInitParamMetaData param = params[j];
-            hConfig.put(param.getParamName(), param.getParamValue());
-         }
-         HandlerInfo info = new HandlerInfo(hClass);
-
-         log.debug("Adding server side handler to service '" + sepMetaData.getQName() + "': " + info);
-         hInfos.add(info);
-      }
-
-      initHandlerChain(seInfo, hInfos, handlerRoles, type);
-   }
-
-   private void initHandlerChain(ServiceEndpointInfo seInfo, List<HandlerInfo> hInfos, Set<String> handlerRoles, HandlerType type)
-   {
-      log.debug("Init handler chain with [" + hInfos.size() + "] handlers");
-
-      ServerHandlerChain handlerChain = new ServerHandlerChain(hInfos, handlerRoles, type);
-      if (type == HandlerType.PRE)
-         preHandlerChain = handlerChain;
-      else if (type == HandlerType.JAXWS)
-         jaxwsHandlerChain = handlerChain;
-      else if (type == HandlerType.POST)
-         postHandlerChain = handlerChain;
-   }
-}

Copied: trunk/src/main/java/org/jboss/ws/server/HandlerDelegate.java (from rev 682, trunk/src/main/java/org/jboss/ws/server/InvokerDelegate.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/InvokerDelegate.java	2006-08-04 08:44:22 UTC (rev 682)
+++ trunk/src/main/java/org/jboss/ws/server/HandlerDelegate.java	2006-08-04 14:30:52 UTC (rev 691)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.server;
+
+// $Id$
+
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
+
+/** An implementation of handles invocations on the endpoint
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 19-Jan-2005
+ */
+public interface HandlerDelegate 
+{
+   public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type);
+
+   public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type);
+   
+   public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex);
+}

Deleted: trunk/src/main/java/org/jboss/ws/server/InvokerDelegate.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/InvokerDelegate.java	2006-08-04 13:58:52 UTC (rev 690)
+++ trunk/src/main/java/org/jboss/ws/server/InvokerDelegate.java	2006-08-04 14:30:52 UTC (rev 691)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.server;
-
-// $Id$
-
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
-
-/** An implementation of handles invocations on the endpoint
- *
- * @author Thomas.Diesler at jboss.org
- * @since 19-Jan-2005
- */
-public interface InvokerDelegate 
-{
-   public SOAPMessage invoke(ServiceEndpointInfo seInfo, Object endpointContext) throws Exception;
-
-   public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type);
-
-   public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type);
-   
-   public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex);
-}

Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java	2006-08-04 13:58:52 UTC (rev 690)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java	2006-08-04 14:30:52 UTC (rev 691)
@@ -25,9 +25,7 @@
 
 import javax.xml.soap.SOAPMessage;
 
-import org.jboss.ws.binding.EndpointInvocation;
-
-/** An implementation of handles invocations on the endpoint
+/** An implementation handles invocations on the endpoint
  *
  * @author Thomas.Diesler at jboss.org
  * @since 19-Jan-2005
@@ -36,19 +34,7 @@
 {
    /** Initialize the service endpoint */
    public void initServiceEndpoint(ServiceEndpointInfo seInfo);
-
+   
    /** Invoke the the service endpoint */
    public SOAPMessage invoke(ServiceEndpointInfo seInfo, Object endpointContext) throws Exception;
-   
-   /** Load the SEI implementation bean if necessary */
-   public Class loadServiceEndpoint(ServiceEndpointInfo seInfo) throws ClassNotFoundException;
-
-   /** Create the instance of the SEI implementation bean if necessary */
-   public Object createServiceEndpoint(ServiceEndpointInfo seInfo, Object context, Class seiImplClass) throws IllegalAccessException, InstantiationException;
-
-   /** Invoke the instance of the SEI implementation bean */
-   public void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl, EndpointInvocation epInv);
-
-   /** Destroy the instance of the SEI implementation bean if necessary */
-   public void destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl);
 }

Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvokerBase.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvokerBase.java	2006-08-04 13:58:52 UTC (rev 690)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvokerBase.java	2006-08-04 14:30:52 UTC (rev 691)
@@ -27,44 +27,206 @@
 import java.lang.reflect.Method;
 
 import javax.management.MBeanException;
+import javax.xml.namespace.QName;
 import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
 import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.Service.Mode;
 
+import org.jboss.logging.Logger;
 import org.jboss.ws.Constants;
-import org.jboss.ws.jaxrpc.InvokerDelegateJAXRPC;
-import org.jboss.ws.jaxws.InvokerDelegateJAXWS;
+import org.jboss.ws.binding.BindingProvider;
+import org.jboss.ws.binding.BindingProviderRegistry;
+import org.jboss.ws.binding.EndpointInvocation;
+import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.jaxrpc.HandlerDelegateJAXRPC;
+import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
+import org.jboss.ws.jaxws.HandlerDelegateJAXWS;
 import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.OperationMetaData;
 import org.jboss.ws.metadata.EndpointMetaData.Type;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
+import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.soap.SOAPMessageImpl;
 import org.jboss.ws.utils.JavaUtils;
 
-/** An implementation of handles invocations on the endpoint
+/** An implementation handles invocations on the endpoint
  *
  * @author Thomas.Diesler at jboss.org
  * @since 19-Jan-2005
  */
-public abstract class ServiceEndpointInvokerBase implements ServiceEndpointInvoker 
+public abstract class ServiceEndpointInvokerBase implements ServiceEndpointInvoker, HandlerDelegate 
 {
-   protected InvokerDelegate delegate;
+   // provide logging
+   private static Logger log = Logger.getLogger(ServiceEndpointInvokerBase.class);
    
+   protected HandlerDelegate handlerDelegate;
+   
    /** Initialize the service endpoint */
    public void initServiceEndpoint(ServiceEndpointInfo seInfo)
    {
       Type type = seInfo.getServerEndpointMetaData().getType();
       if (type == EndpointMetaData.Type.JAXRPC)
       {
-         delegate = new InvokerDelegateJAXRPC(this);
+         handlerDelegate = new HandlerDelegateJAXRPC();
       }
       else
       {
-         delegate = new InvokerDelegateJAXWS(this);
+         handlerDelegate = new HandlerDelegateJAXWS();
       }
    }
 
+   /** Load the SEI implementation bean if necessary */
+   protected abstract Class loadServiceEndpoint(ServiceEndpointInfo seInfo) throws ClassNotFoundException;
+
+   /** Create the instance of the SEI implementation bean if necessary */
+   protected abstract Object createServiceEndpoint(ServiceEndpointInfo seInfo, Object context, Class seiImplClass) throws IllegalAccessException, InstantiationException;
+
+   /** Invoke the instance of the SEI implementation bean */
+   protected abstract void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl, EndpointInvocation epInv);
+
+   /** Destroy the instance of the SEI implementation bean if necessary */
+   protected abstract void destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl);
+
+   public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+   {
+      return handlerDelegate.callRequestHandlerChain(seInfo, type);
+   }
+
+   public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+   {
+      return handlerDelegate.callResponseHandlerChain(seInfo, type);
+   }
+   
+   public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex)
+   {
+      return handlerDelegate.callFaultHandlerChain(seInfo, type, ex);
+   }
+   
+   /** Invoke the the service endpoint */
    public SOAPMessage invoke(ServiceEndpointInfo seInfo, Object context) throws Exception
    {
-      return delegate.invoke(seInfo, context);
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+      EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
+      SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgContext.getMessage();
+
+      // Load the endpoint implementation bean
+      Class seImpl = loadServiceEndpoint(seInfo);
+
+      // Create an instance of the endpoint implementation bean
+      Object seInstance = createServiceEndpoint(seInfo, context, seImpl);
+
+      try
+      {
+         boolean oneway = false;
+
+         // call the handler chain
+         boolean handlersPass = callRequestHandlerChain(seInfo, HandlerType.PRE);
+         handlersPass = handlersPass && callRequestHandlerChain(seInfo, HandlerType.JAXRPC);
+         handlersPass = handlersPass && callRequestHandlerChain(seInfo, HandlerType.POST);
+         
+         if (handlersPass)
+         {
+            // Get the binding provider for the given bindingURI
+            BindingProvider bindingProvider;
+            if (epMetaData.getServiceMode() == Mode.MESSAGE)
+            {
+               bindingProvider = BindingProviderRegistry.getProvider(BindingProvider.JAXWS_MESSAGE_BINDING);
+            }
+            else if (epMetaData.getServiceMode() == Mode.PAYLOAD)
+            {
+               bindingProvider = BindingProviderRegistry.getProvider(BindingProvider.JAXWS_PAYLOAD_BINDING);
+            }
+            else
+            {
+               bindingProvider = BindingProviderRegistry.getDefaultProvider();
+            }
+
+            // Get the operation meta data from the SOAP message
+            OperationMetaData opMetaData = getDispatchDestination(epMetaData, reqMessage);
+            msgContext.setOperationMetaData(opMetaData);
+            oneway = opMetaData.isOneWayOperation();
+
+            // Unbind the request message
+            EndpointInvocation epInv = bindingProvider.unbindRequestMessage(opMetaData, reqMessage);
+
+            // Invoke the service endpoint
+            invokeServiceEndpoint(seInfo, seInstance, epInv);
+
+            // Bind the response message
+            SOAPMessage resMessage = bindingProvider.bindResponseMessage(opMetaData, epInv);
+            msgContext.setMessage(resMessage);
+         }
+
+         // call the handler chain
+         if (oneway == false)
+         {
+            handlersPass = callResponseHandlerChain(seInfo, HandlerType.POST);
+            handlersPass = handlersPass && callResponseHandlerChain(seInfo, HandlerType.JAXRPC);
+            handlersPass = handlersPass && callResponseHandlerChain(seInfo, HandlerType.PRE);
+         }
+
+         SOAPMessage resMessage = msgContext.getMessage();
+         return resMessage;
+      }
+      catch (Exception ex)
+      {
+         try
+         {
+            SOAPMessage faultMessage = SOAPFaultExceptionHelper.exceptionToFaultMessage(ex);
+            msgContext.setMessage(faultMessage);
+            
+            // call the handler chain
+            boolean handlersPass = handlerDelegate.callFaultHandlerChain(seInfo, HandlerType.POST, ex);
+            handlersPass = handlersPass && handlerDelegate.callFaultHandlerChain(seInfo, HandlerType.JAXRPC, ex);
+            handlersPass = handlersPass && handlerDelegate.callFaultHandlerChain(seInfo, HandlerType.PRE, ex);
+         }
+         catch (Exception subEx)
+         {
+            log.warn("Cannot process handlerChain.handleFault, ignoring: ", subEx);
+         }
+         throw ex;
+      }
+      finally
+      {
+         destroyServiceEndpoint(seInfo, seInstance);
+      }
    }
-   
+
+   private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData, SOAPMessageImpl reqMessage) throws SOAPException
+   {
+      OperationMetaData opMetaData = reqMessage.getOperationMetaData(epMetaData);
+      SOAPHeader soapHeader = reqMessage.getSOAPHeader();
+
+      // Report a MustUnderstand fault
+      if (opMetaData == null)
+      {
+         SOAPBody soapBody = reqMessage.getSOAPBody();
+         SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+         Name soapName = soapBodyElement.getElementName();
+
+         // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL description, it SHOULD generate a soap:Fault
+         // with a faultcode of "Client", unless a "MustUnderstand" or "VersionMismatch" fault is generated.
+         if (soapHeader != null && soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
+         {
+            QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
+            String faultString = "Endpoint " + epMetaData.getQName() + " does not contain operation meta data for: " + soapName;
+            throw new SOAPFaultException(faultCode, faultString, null, null);
+         }
+         else
+         {
+            QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
+            String faultString = "Endpoint " + epMetaData.getQName() + " does not contain operation meta data for: " + soapName;
+            throw new SOAPFaultException(faultCode, faultString, null, null);
+         }
+      }
+      return opMetaData;
+   }
+
    protected Method getImplMethod(Class implClass, Method seiMethod) throws ClassNotFoundException, NoSuchMethodException
    {
       String methodName = seiMethod.getName();




More information about the jboss-svn-commits mailing list