[jboss-svn-commits] JBossWS SVN: r660 - in trunk/src: main/java/javax/jws main/java/org/jboss/ws main/java/org/jboss/ws/addressing/soap main/java/org/jboss/ws/binding main/java/org/jboss/ws/binding/soap main/java/org/jboss/ws/common main/java/org/jboss/ws/eventing main/java/org/jboss/ws/handler main/java/org/jboss/ws/integration/jboss main/java/org/jboss/ws/jaxrpc main/java/org/jboss/ws/jaxrpc/encoding main/java/org/jboss/ws/jaxrpc/handler main/java/org/jboss/ws/jaxws main/java/org/jboss/ws/jaxws/client main/java/org/jboss/ws/jaxws/handler main/java/org/jboss/ws/jbossxb main/java/org/jboss/ws/metadata main/java/org/jboss/ws/metadata/j2ee main/java/org/jboss/ws/metadata/wsdl main/java/org/jboss/ws/server main/java/org/jboss/ws/soap main/java/org/jboss/ws/utils main/java/org/jboss/ws/wsse test/java/org/jboss/test/ws/benchmark test/java/org/jboss/test/ws/binding test/java/org/jboss/test/ws/jaxws/context test/java/org/jboss/test/ws/jbossxb test/java/org/jboss/test/ws/samples/wsaddressing ! test/java/org/jboss/test/ws/soap/attachment test/java/org/jboss/test/ws/xop

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Aug 1 12:31:42 EDT 2006


Author: thomas.diesler at jboss.com
Date: 2006-08-01 12:29:43 -0400 (Tue, 01 Aug 2006)
New Revision: 660

Added:
   trunk/src/main/java/org/jboss/ws/common/
   trunk/src/main/java/org/jboss/ws/jaxrpc/InvokerDelegateJAXRPC.java
   trunk/src/main/java/org/jboss/ws/jaxrpc/SerializationContextJAXRPC.java
   trunk/src/main/java/org/jboss/ws/jaxrpc/handler/
   trunk/src/main/java/org/jboss/ws/jaxrpc/handler/ClientHandlerChain.java
   trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerChainBaseImpl.java
   trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerWrapper.java
   trunk/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java
   trunk/src/main/java/org/jboss/ws/jaxrpc/handler/SOAPMessageContextJAXRPC.java
   trunk/src/main/java/org/jboss/ws/jaxrpc/handler/ServerHandlerChain.java
   trunk/src/main/java/org/jboss/ws/jaxws/SerializationContextJAXWS.java
   trunk/src/main/java/org/jboss/ws/jaxws/handler/MessageContextJAXWS.java
   trunk/src/main/java/org/jboss/ws/jaxws/handler/SOAPMessageContextJAXWS.java
Removed:
   trunk/src/main/java/org/jboss/ws/client/
   trunk/src/main/java/org/jboss/ws/handler/ClientHandlerChain.java
   trunk/src/main/java/org/jboss/ws/handler/HandlerChainBaseImpl.java
   trunk/src/main/java/org/jboss/ws/handler/HandlerWrapper.java
   trunk/src/main/java/org/jboss/ws/handler/MessageContextImpl.java
   trunk/src/main/java/org/jboss/ws/handler/ServerHandlerChain.java
   trunk/src/main/java/org/jboss/ws/jaxrpc/JAXRPCSerializationContext.java
   trunk/src/main/java/org/jboss/ws/jaxws/JAXWSSerializationContext.java
   trunk/src/main/java/org/jboss/ws/jaxws/handler/MessageContextImpl.java
   trunk/src/main/java/org/jboss/ws/jaxws/handler/SOAPMessageContextImpl.java
   trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInterceptor.java
   trunk/src/main/java/org/jboss/ws/soap/SOAPMessageContextImpl.java
Modified:
   trunk/src/main/java/javax/jws/WebMethod.java
   trunk/src/main/java/javax/jws/WebService.java
   trunk/src/main/java/org/jboss/ws/addressing/soap/SOAPServerHandler.java
   trunk/src/main/java/org/jboss/ws/binding/AttachmentMarshallerImpl.java
   trunk/src/main/java/org/jboss/ws/binding/AttachmentMarshallerSupport.java
   trunk/src/main/java/org/jboss/ws/binding/AttachmentUnmarshallerImpl.java
   trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProvider.java
   trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java
   trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderPayload.java
   trunk/src/main/java/org/jboss/ws/common/CommonClient.java
   trunk/src/main/java/org/jboss/ws/eventing/EventingEndpointBase.java
   trunk/src/main/java/org/jboss/ws/eventing/SubscriptionManagerEndpointImpl.java
   trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInterceptor.java
   trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerEJB21.java
   trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerEJB3.java
   trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerMDB.java
   trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java
   trunk/src/main/java/org/jboss/ws/jaxrpc/HandlerRegistryImpl.java
   trunk/src/main/java/org/jboss/ws/jaxrpc/SOAPFaultExceptionHelper.java
   trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPDeserializer.java
   trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPSerializer.java
   trunk/src/main/java/org/jboss/ws/jaxws/client/JAXWSClient.java
   trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializer.java
   trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializer.java
   trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBUnmarshallerImpl.java
   trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
   trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java
   trunk/src/main/java/org/jboss/ws/metadata/wsdl/NCName.java
   trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLImport.java
   trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInfault.java
   trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutfault.java
   trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java
   trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInfo.java
   trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java
   trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvokerJSE.java
   trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java
   trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerMBean.java
   trunk/src/main/java/org/jboss/ws/server/ServletEndpointContextImpl.java
   trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java
   trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java
   trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
   trunk/src/main/java/org/jboss/ws/soap/SOAPMessageDispatcher.java
   trunk/src/main/java/org/jboss/ws/utils/ThreadLocalAssociation.java
   trunk/src/main/java/org/jboss/ws/wsse/WSSecurityDispatcher.java
   trunk/src/main/java/org/jboss/ws/wsse/WSSecurityHandler.java
   trunk/src/test/java/org/jboss/test/ws/benchmark/Address.java
   trunk/src/test/java/org/jboss/test/ws/benchmark/BenchmarkService.java
   trunk/src/test/java/org/jboss/test/ws/benchmark/Customer.java
   trunk/src/test/java/org/jboss/test/ws/benchmark/LineItem.java
   trunk/src/test/java/org/jboss/test/ws/benchmark/Order.java
   trunk/src/test/java/org/jboss/test/ws/benchmark/OrderBL.java
   trunk/src/test/java/org/jboss/test/ws/benchmark/SimpleUserType.java
   trunk/src/test/java/org/jboss/test/ws/benchmark/Synthetic.java
   trunk/src/test/java/org/jboss/test/ws/binding/SOAPBindingTestCase.java
   trunk/src/test/java/org/jboss/test/ws/jaxws/context/WebServiceContextTestCase.java
   trunk/src/test/java/org/jboss/test/ws/jbossxb/SerializerDeserializerTestCase.java
   trunk/src/test/java/org/jboss/test/ws/samples/wsaddressing/StatefulEndpointImpl.java
   trunk/src/test/java/org/jboss/test/ws/soap/attachment/GenericAttachmentTestCase.java
   trunk/src/test/java/org/jboss/test/ws/xop/XOPElementRPCTestCase.java
Log:
Refactor SOAPMessageContext in two flavors

Modified: trunk/src/main/java/javax/jws/WebMethod.java
===================================================================
--- trunk/src/main/java/javax/jws/WebMethod.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/javax/jws/WebMethod.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -29,7 +29,7 @@
 import java.lang.annotation.Target;
 
 /**
- * Specifies that the given method is exposed as a Web Service operation, making it part of the Web Service’s public
+ * Specifies that the given method is exposed as a Web Service operation, making it part of the Web Service's public
  * contract.  A WebMethod annotation is required for each method that is published by the Web Service.  The associated
  * method must be public and its parameters return value, and exceptions must follow the rules defined in JAX-RPC 1.1,
  * section 5.  The method is not required to throw java.rmi.RemoteException.

Modified: trunk/src/main/java/javax/jws/WebService.java
===================================================================
--- trunk/src/main/java/javax/jws/WebService.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/javax/jws/WebService.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -52,7 +52,7 @@
 
    /**
     * The service name of the Web Service.  Used as the name of the wsdl:service when mapped to WSDL 1.1.
-    * Not allowed on interfaces.  Defaults to the simple name of the Java class + “Service".
+    * Not allowed on interfaces.  Defaults to the simple name of the Java class + Service".
     */
    String serviceName() default "";
 
@@ -67,7 +67,7 @@
    String wsdlLocation() default "";
 
    /**
-    * The complete name of the service endpoint interface defining the service’s abstract Web Service contract.   This
+    * The complete name of the service endpoint interface defining the service's abstract Web Service contract.   This
     * annotation allows the developer to separate the interface contract from the implementation.  If this annotation
     * is present, the service endpoint interface is used to determine the abstract WSDL contract (portType and
     * bindings). The service endpoint interface may include JSR-181 annotations to customize the mapping from Java to

Modified: trunk/src/main/java/org/jboss/ws/addressing/soap/SOAPServerHandler.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/addressing/soap/SOAPServerHandler.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/addressing/soap/SOAPServerHandler.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -22,8 +22,8 @@
 package org.jboss.ws.addressing.soap;
 
 import org.jboss.logging.Logger;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
 import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 import org.jboss.ws.addressing.AddressingConstantsImpl;
 import org.jboss.ws.addressing.metadata.AddressingOpMetaExt;
 
@@ -145,7 +145,7 @@
       {
          // supply the response action
 
-         OperationMetaData opMetaData = ((SOAPMessageContextImpl)msgContext).getOperationMetaData();
+         OperationMetaData opMetaData = ((SOAPMessageContextJAXRPC)msgContext).getOperationMetaData();
 
          if(!isFault && !opMetaData.isOneWayOperation()) {
 

Modified: trunk/src/main/java/org/jboss/ws/binding/AttachmentMarshallerImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/binding/AttachmentMarshallerImpl.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/binding/AttachmentMarshallerImpl.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -31,8 +31,8 @@
 import org.jboss.logging.Logger;
 import org.jboss.util.NotImplementedException;
 import org.jboss.ws.Constants;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
 import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 import org.jboss.ws.soap.SOAPMessageImpl;
 import org.jboss.ws.soap.attachment.MimeConstants;
 import org.jboss.xb.binding.NamespaceRegistry;
@@ -67,7 +67,7 @@
       QName xmlName = new QName(elementNamespace, elementName);
       log.debug("serialize: [xmlName=" + xmlName + "]");
 
-      SOAPMessageContextImpl msgContext = (SOAPMessageContextImpl)MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
       SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
       SerializationContext serContext = msgContext.getSerializationContext();
       NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();

Modified: trunk/src/main/java/org/jboss/ws/binding/AttachmentMarshallerSupport.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/binding/AttachmentMarshallerSupport.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/binding/AttachmentMarshallerSupport.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -21,7 +21,7 @@
 */
 package org.jboss.ws.binding;
 
-import org.jboss.ws.soap.SOAPMessageContextImpl;
+import org.jboss.ws.common.SOAPMessageContextBase;
 import org.jboss.ws.soap.MessageContextAssociation;
 import org.jboss.ws.soap.SOAPMessageImpl;
 
@@ -33,7 +33,7 @@
 
    public static boolean isXOPPackage() {
       boolean isXOP = false;
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
       if(msgContext!=null) {
          SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
          isXOP = (soapMessage != null && soapMessage.isXOPMessage());

Modified: trunk/src/main/java/org/jboss/ws/binding/AttachmentUnmarshallerImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/binding/AttachmentUnmarshallerImpl.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/binding/AttachmentUnmarshallerImpl.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -31,8 +31,8 @@
 import org.jboss.logging.Logger;
 import org.jboss.util.NotImplementedException;
 import org.jboss.ws.WSException;
+import org.jboss.ws.common.SOAPMessageContextBase;
 import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 import org.jboss.ws.soap.SOAPMessageImpl;
 
 /**
@@ -65,12 +65,13 @@
 
       try
       {
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+         SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
          SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
 
          // RFC2392 requires the 'cid:' part to be stripped from the cid
          if (cid.startsWith("cid:"))
             cid = cid.substring(4);
+         
          cid = '<' + cid + '>'; // RFC2392 requirement
 
          AttachmentPart part = soapMessage.getAttachmentByContentId(cid);

Modified: trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProvider.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProvider.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProvider.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -23,6 +23,26 @@
 
 // $Id$
 
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.JAXRPCException;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPMessage;
+
 import org.apache.xerces.xs.XSElementDeclaration;
 import org.apache.xerces.xs.XSTypeDefinition;
 import org.jboss.logging.Logger;
@@ -33,32 +53,29 @@
 import org.jboss.ws.binding.BindingProvider;
 import org.jboss.ws.binding.EndpointInvocation;
 import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.common.SOAPMessageContextBase;
 import org.jboss.ws.jaxrpc.ParameterWrapping;
 import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
 import org.jboss.ws.jaxrpc.Style;
 import org.jboss.ws.metadata.OperationMetaData;
 import org.jboss.ws.metadata.ParameterMetaData;
 import org.jboss.ws.metadata.TypesMetaData;
-import org.jboss.ws.soap.*;
+import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.soap.NameImpl;
+import org.jboss.ws.soap.SOAPBodyElementDoc;
+import org.jboss.ws.soap.SOAPBodyElementRpc;
+import org.jboss.ws.soap.SOAPContentElement;
+import org.jboss.ws.soap.SOAPElementImpl;
+import org.jboss.ws.soap.SOAPFaultImpl;
+import org.jboss.ws.soap.SOAPHeaderElementImpl;
+import org.jboss.ws.soap.SOAPMessageImpl;
 import org.jboss.ws.soap.attachment.AttachmentPartImpl;
 import org.jboss.ws.soap.attachment.CIDGenerator;
-import org.jboss.ws.soap.attachment.MimeConstants;
 import org.jboss.ws.utils.JavaUtils;
 import org.jboss.ws.utils.MimeUtils;
 import org.jboss.xb.binding.NamespaceRegistry;
 import org.w3c.dom.Element;
 
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.*;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
 /** An abstract BindingProvider for SOAP that is independent of the SOAP version.
  *
  * @author Thomas.Diesler at jboss.org
@@ -79,7 +96,7 @@
 
       try
       {
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+         SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
          if (msgContext == null)
             throw new WSException("MessageContext not available");
 
@@ -198,7 +215,7 @@
          // Construct the endpoint invocation object
          EndpointInvocation epInv = new EndpointInvocation(opMetaData);
 
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+         SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
          if (msgContext == null)
             throw new WSException("MessageContext not available");
 
@@ -310,7 +327,7 @@
 
       try
       {
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+         SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
          if (msgContext == null)
             throw new WSException("MessageContext not available");
 
@@ -458,7 +475,7 @@
          }
 
          // Get the SOAP message context that is associated with the current thread
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+         SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
          if (msgContext == null)
             throw new WSException("MessageContext not available");
 
@@ -653,7 +670,7 @@
       // Make sure we have a prefix on qualified names
       if (xmlName.getNamespaceURI().length() > 0)
       {
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+         SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
          NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
          xmlName = namespaceRegistry.registerQName(xmlName);
       }

Modified: trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -35,10 +35,10 @@
 import org.jboss.ws.binding.BindingProvider;
 import org.jboss.ws.binding.EndpointInvocation;
 import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
 import org.jboss.ws.metadata.OperationMetaData;
 import org.jboss.ws.metadata.ParameterMetaData;
 import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 
 /** A BindingProvider for unprocessed SOAP Messages 
  *
@@ -66,7 +66,7 @@
          // Construct the endpoint invocation object
          EndpointInvocation epInv = new EndpointInvocation(opMetaData);
 
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+         SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
          if (msgContext == null)
             throw new WSException("MessageContext not available");
 
@@ -90,7 +90,7 @@
 
       try
       {
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+         SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
          if (msgContext == null)
             throw new WSException("MessageContext not available");
 

Modified: trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderPayload.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderPayload.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderPayload.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -37,12 +37,13 @@
 import org.jboss.ws.binding.BindingProvider;
 import org.jboss.ws.binding.EndpointInvocation;
 import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
 import org.jboss.ws.metadata.OperationMetaData;
 import org.jboss.ws.metadata.ParameterMetaData;
 import org.jboss.ws.soap.MessageContextAssociation;
 import org.jboss.ws.soap.MessageFactoryImpl;
 import org.jboss.ws.soap.SOAPBodyImpl;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 import org.jboss.ws.soap.SOAPMessageImpl;
 
 /** A BindingProvider for a JAXWS payload 
@@ -71,7 +72,7 @@
          // Construct the endpoint invocation object
          EndpointInvocation epInv = new EndpointInvocation(opMetaData);
 
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+         SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
          if (msgContext == null)
             throw new WSException("MessageContext not available");
 
@@ -98,7 +99,7 @@
 
       try
       {
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+         SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
          if (msgContext == null)
             throw new WSException("MessageContext not available");
 

Copied: trunk/src/main/java/org/jboss/ws/common (from rev 643, trunk/src/main/java/org/jboss/ws/client)

Modified: trunk/src/main/java/org/jboss/ws/common/CommonClient.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/client/CommonClient.java	2006-07-30 12:25:17 UTC (rev 643)
+++ trunk/src/main/java/org/jboss/ws/common/CommonClient.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -19,7 +19,7 @@
  * 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.client;
+package org.jboss.ws.common;
 
 // $Id$
 
@@ -32,7 +32,6 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.rpc.ParameterMode;
-import javax.xml.rpc.handler.MessageContext;
 import javax.xml.rpc.soap.SOAPFaultException;
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPMessage;
@@ -59,7 +58,6 @@
 import org.jboss.ws.soap.EndpointInfo;
 import org.jboss.ws.soap.MessageContextAssociation;
 import org.jboss.ws.soap.SOAPConnectionImpl;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 import org.jboss.ws.utils.HolderUtils;
 import org.jboss.ws.utils.JavaUtils;
 
@@ -197,9 +195,9 @@
       return epMetaData;
    }
 
-   protected abstract boolean callRequestHandlerChain(QName portName, SOAPMessageContextImpl msgContext);
+   protected abstract boolean callRequestHandlerChain(QName portName);
 
-   protected abstract boolean callResponseHandlerChain(QName portName, SOAPMessageContextImpl msgContext);
+   protected abstract boolean callResponseHandlerChain(QName portName);
 
    /** Call invokation goes as follows:
     *
@@ -219,8 +217,7 @@
       OperationMetaData opMetaData = getOperationMetaData();
 
       // Associate a message context with the current thread
-      SOAPMessageContextImpl msgContext = new SOAPMessageContextImpl();
-      MessageContextAssociation.pushMessageContext(msgContext);
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
       msgContext.setOperationMetaData(opMetaData);
 
       // copy properties to the message context
@@ -245,7 +242,7 @@
          // Call the request handlers
          QName portName = epMetaData.getQName();
 
-         if (callRequestHandlerChain(portName, msgContext))
+         if (callRequestHandlerChain(portName))
          {
             String targetAddress = getTargetEndpointAddress();
             
@@ -301,7 +298,7 @@
          if (oneway == false)
          {
             // Call the response handlers
-            callResponseHandlerChain(portName, msgContext);
+            callResponseHandlerChain(portName);
 
             // unbind the return values
             SOAPMessage resMessage = msgContext.getMessage();
@@ -336,7 +333,7 @@
 
    protected abstract Map<String, Object> getResponseContext();
 
-   private void syncMessageProperties(Map<String, Object> props, MessageContext msgContext)
+   private void syncMessageProperties(Map<String, Object> props, SOAPMessageContextBase msgContext)
    {
       Iterator it = msgContext.getPropertyNames();
       while (it.hasNext())

Modified: trunk/src/main/java/org/jboss/ws/eventing/EventingEndpointBase.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/eventing/EventingEndpointBase.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/eventing/EventingEndpointBase.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -1,5 +1,29 @@
+/*
+ * 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.eventing;
 
+
+// $Id: $ 
+
 import java.net.URI;
 
 import javax.xml.namespace.QName;
@@ -9,10 +33,10 @@
 import javax.xml.ws.addressing.JAXWSAConstants;
 
 import org.jboss.ws.Constants;
+import org.jboss.ws.common.SOAPMessageContextBase;
 import org.jboss.ws.eventing.mgmt.SubscriptionManagerFactory;
 import org.jboss.ws.eventing.mgmt.SubscriptionManagerMBean;
 import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 
 /**
  * @author Heiko Braun, <heiko at openj.net>
@@ -29,7 +53,7 @@
     */
    protected static AddressingProperties getAddrProperties()
    {
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
       AddressingProperties inProps = (AddressingProperties)msgContext.getProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
       assertAddrProperties(inProps);
       return inProps;

Modified: trunk/src/main/java/org/jboss/ws/eventing/SubscriptionManagerEndpointImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/eventing/SubscriptionManagerEndpointImpl.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/eventing/SubscriptionManagerEndpointImpl.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -23,24 +23,29 @@
 
 // $Id$
 
-import org.jboss.util.xml.DOMUtils;
-import org.jboss.ws.Constants;
-import org.jboss.ws.eventing.element.*;
-import org.jboss.ws.eventing.mgmt.SubscriptionError;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
-import org.w3c.dom.Element;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.rmi.RemoteException;
+import java.util.Date;
 
 import javax.xml.namespace.QName;
 import javax.xml.rpc.soap.SOAPFaultException;
 import javax.xml.ws.addressing.AddressingProperties;
 import javax.xml.ws.addressing.JAXWSAConstants;
 import javax.xml.ws.addressing.ReferenceParameters;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.rmi.RemoteException;
-import java.util.Date;
 
+import org.jboss.util.xml.DOMUtils;
+import org.jboss.ws.Constants;
+import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.eventing.element.RenewRequest;
+import org.jboss.ws.eventing.element.RenewResponse;
+import org.jboss.ws.eventing.element.StatusRequest;
+import org.jboss.ws.eventing.element.StatusResponse;
+import org.jboss.ws.eventing.element.UnsubscribeRequest;
+import org.jboss.ws.eventing.mgmt.SubscriptionError;
+import org.jboss.ws.soap.MessageContextAssociation;
+import org.w3c.dom.Element;
+
 /**
  * SubscriptionManager endpoint implementation.<br>
  * Delegates to {@link org.jboss.ws.eventing.mgmt.SubscriptionManager}
@@ -131,7 +136,7 @@
    private URI retrieveSubscriptionId()
    {
       URI subscriptionId = null;
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
       AddressingProperties addrProps = (AddressingProperties)msgContext.getProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
 
       if (null == addrProps)

Deleted: trunk/src/main/java/org/jboss/ws/handler/ClientHandlerChain.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/handler/ClientHandlerChain.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/handler/ClientHandlerChain.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -1,50 +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.handler;
-
-// $Id$
-
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.rpc.handler.MessageContext;
-
-/**
- * Represents a list of handlers. All elements in the
- * HandlerChain are of the type javax.xml.rpc.handler.Handler.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 06-May-2004
- */
-public class ClientHandlerChain extends HandlerChainBaseImpl
-{
-   public ClientHandlerChain(List infos, Set roles)
-   {
-      super(infos, roles);
-   }
-   
-   public boolean handleResponse(MessageContext msgContext)
-   {
-      boolean doNext = super.handleResponse(msgContext);
-      return doNext;
-   }
-}

Deleted: trunk/src/main/java/org/jboss/ws/handler/HandlerChainBaseImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/handler/HandlerChainBaseImpl.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/handler/HandlerChainBaseImpl.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -1,673 +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.handler;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
-import javax.xml.rpc.handler.Handler;
-import javax.xml.rpc.handler.HandlerChain;
-import javax.xml.rpc.handler.HandlerInfo;
-import javax.xml.rpc.handler.MessageContext;
-import javax.xml.rpc.handler.soap.SOAPMessageContext;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeaderElement;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.soap.SOAPPart;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.xml.DOMWriter;
-import org.jboss.ws.Constants;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.soap.SOAPEnvelopeImpl;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
-import org.jboss.ws.soap.SOAPMessageImpl;
-
-/**
- * Represents a list of handlers. All elements in the
- * HandlerChain are of the type javax.xml.rpc.handler.Handler.
- * <p/>
- * Abstracts the policy and mechanism for the invocation of the registered handlers.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 06-May-2004
- */
-public abstract class HandlerChainBaseImpl implements HandlerChain
-{
-   private static Logger log = Logger.getLogger(HandlerChainBaseImpl.class);
-
-   public static final int STATE_DOES_NOT_EXIST = 0;
-   public static final int STATE_CREATED = 1;
-   public static final int STATE_READY = 2;
-   public static final int STATE_DESTROYED = 3;
-
-   // The List<Entry> objects
-   protected List<HandlerEntry> handlers = new ArrayList<HandlerEntry>();
-   // The roles associated with the handler chain
-   protected Set<String> roles = new HashSet<String>();
-   // The index of the first handler that returned false during processing
-   protected int falseIndex = -1;
-   // The state of this handler chain
-   protected int state;
-
-   /**
-    * Constructs a handler chain with the given handlers infos
-    */
-   public HandlerChainBaseImpl(List infos, Set roles)
-   {
-      log.debug("Create a handler chain for roles: " + roles);
-      addHandlersToChain(infos, roles);
-   }
-
-   /** Get the list of handler infos
-    */
-   public List<HandlerInfo> getHandlerInfos()
-   {
-      List<HandlerInfo> list = new ArrayList<HandlerInfo>();
-      for (int i = 0; i < handlers.size(); i++)
-      {
-         HandlerEntry entry = (HandlerEntry)handlers.get(i);
-         list.add(entry.info);
-      }
-      return list;
-   }
-
-   /**
-    * Initialize the a handler chain with the given handlers infos
-    *
-    * @throws javax.xml.rpc.JAXRPCException If any error during initialization
-    */
-   private void addHandlersToChain(List infos, Set roleSet)
-   {
-      try
-      {
-         if (infos != null)
-         {
-            for (int i = 0; i < infos.size(); i++)
-            {
-               HandlerInfo info = (HandlerInfo)infos.get(i);
-               HandlerWrapper handler = new HandlerWrapper((Handler)info.getHandlerClass().newInstance());
-               handlers.add(new HandlerEntry(handler, info));
-            }
-         }
-         if (roleSet != null)
-         {
-            roles.addAll(roleSet);
-         }
-      }
-      catch (RuntimeException rte)
-      {
-         throw rte;
-      }
-      catch (Exception ex)
-      {
-         throw new JAXRPCException("Cannot initialize handler chain", ex);
-      }
-
-      // set state to created
-      state = STATE_CREATED;
-   }
-
-   /**
-    * Get the state of this handler chain
-    */
-   public int getState()
-   {
-      return state;
-   }
-
-   /**
-    * Initializes the configuration for a HandlerChain.
-    *
-    * @param config Configuration for the initialization of this handler chain
-    * @throws javax.xml.rpc.JAXRPCException If any error during initialization
-    */
-   public void init(Map config)
-   {
-      log.debug("init: [config=" + config + "]");
-      for (int i = 0; i < handlers.size(); i++)
-      {
-         HandlerEntry entry = (HandlerEntry)handlers.get(i);
-         entry.handler.init(entry.info);
-      }
-
-      // set state to ready
-      state = STATE_READY;
-   }
-
-   /**
-    * Indicates the end of lifecycle for a HandlerChain.
-    *
-    * @throws javax.xml.rpc.JAXRPCException If any error during destroy
-    */
-   public void destroy()
-   {
-      log.debug("destroy");
-      for (int i = 0; i < handlers.size(); i++)
-      {
-         HandlerEntry entry = (HandlerEntry)handlers.get(i);
-         entry.handler.destroy();
-      }
-      handlers.clear();
-
-      // set state to destroyed
-      state = STATE_DESTROYED;
-   }
-
-   /**
-    * Gets SOAP actor roles registered for this HandlerChain at this SOAP node. The returned array includes the
-    * special SOAP actor next.
-    *
-    * @return SOAP Actor roles as URIs
-    */
-   public String[] getRoles()
-   {
-      String[] arr = new String[roles.size()];
-      roles.toArray(arr);
-      return arr;
-   }
-
-   /**
-    * Sets SOAP Actor roles for this HandlerChain. This specifies the set of roles in which this HandlerChain is to act
-    * for the SOAP message processing at this SOAP node. These roles assumed by a HandlerChain must be invariant during
-    * the processing of an individual SOAP message through the HandlerChain.
-    * <p/>
-    * A HandlerChain always acts in the role of the special SOAP actor next. Refer to the SOAP specification for the
-    * URI name for this special SOAP actor. There is no need to set this special role using this method.
-    *
-    * @param soapActorNames URIs for SOAP actor name
-    */
-   public void setRoles(String[] soapActorNames)
-   {
-      List<String> newRoles = Arrays.asList(soapActorNames);
-      log.debug("setRoles: " + newRoles);
-
-      roles.clear();
-      roles.addAll(newRoles);
-   }
-
-   /**
-    * Initiates the request processing for this handler chain.
-    *
-    * @param msgContext MessageContext parameter provides access to the request SOAP message.
-    * @return Returns true if all handlers in chain have been processed. Returns false if a handler in the chain returned false from its handleRequest method.
-    * @throws javax.xml.rpc.JAXRPCException if any processing error happens
-    */
-   public boolean handleRequest(MessageContext msgContext)
-   {
-      boolean doNext = true;
-
-      if (handlers.size() > 0)
-      {
-         log.debug("Enter: handleRequest");
-
-         // Replace handlers that did not survive the previous call
-         replaceDirtyHandlers();
-
-         int handlerIndex = 0;
-         Handler currHandler = null;
-         try
-         {
-            for (; doNext && handlerIndex < handlers.size(); handlerIndex++)
-            {
-               String lastMessageTrace = null;
-               if (log.isTraceEnabled())
-               {
-                  SOAPMessageContextImpl msgCtx = (SOAPMessageContextImpl)msgContext;
-                  SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
-                  lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
-               }
-
-               currHandler = ((HandlerEntry)handlers.get(handlerIndex)).getHandler();
-               log.debug("Handle request: " + currHandler);
-               doNext = currHandler.handleRequest(msgContext);
-
-               if (log.isTraceEnabled())
-               {
-                  SOAPMessageContextImpl msgCtx = (SOAPMessageContextImpl)msgContext;
-                  SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
-                  lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
-               }
-            }
-         }
-         catch (RuntimeException e)
-         {
-            log.error("RuntimeException in request handler", e);
-            doNext = false;
-            throw e;
-         }
-         finally
-         {
-            // we start at this index in the response chain
-            if (doNext == false)
-               falseIndex = (handlerIndex - 1);
-
-            log.debug("Exit: handleRequest with status: " + doNext);
-         }
-      }
-
-      return doNext;
-   }
-
-   /**
-    * Initiates the response processing for this handler chain.
-    * <p/>
-    * In this implementation, the response handler chain starts processing from the same Handler
-    * instance (that returned false) and goes backward in the execution sequence.
-    *
-    * @return Returns true if all handlers in chain have been processed.
-    *         Returns false if a handler in the chain returned false from its handleResponse method.
-    * @throws javax.xml.rpc.JAXRPCException if any processing error happens
-    */
-   public boolean handleResponse(MessageContext msgContext)
-   {
-      boolean doNext = true;
-
-      if (handlers.size() > 0)
-      {
-         log.debug("Enter: handleResponse");
-
-         int handlerIndex = handlers.size() - 1;
-         if (falseIndex != -1)
-            handlerIndex = falseIndex;
-
-         Handler currHandler = null;
-         try
-         {
-            for (; doNext && handlerIndex >= 0; handlerIndex--)
-            {
-               String lastMessageTrace = null;
-               if (log.isTraceEnabled())
-               {
-                  SOAPMessageContextImpl msgCtx = (SOAPMessageContextImpl)msgContext;
-                  SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
-                  lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
-               }
-
-               currHandler = ((HandlerEntry)handlers.get(handlerIndex)).getHandler();
-               log.debug("Handle response: " + currHandler);
-               doNext = currHandler.handleResponse(msgContext);
-
-               if (log.isTraceEnabled())
-               {
-                  SOAPMessageContextImpl msgCtx = (SOAPMessageContextImpl)msgContext;
-                  SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
-                  lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
-               }
-            }
-         }
-         catch (RuntimeException rte)
-         {
-            log.error("RuntimeException in response handler", rte);
-            doNext = false;
-            throw rte;
-         }
-         finally
-         {
-            // we start at this index in the fault chain
-            if (doNext == false)
-               falseIndex = (handlerIndex - 1);
-
-            log.debug("Exit: handleResponse with status: " + doNext);
-         }
-      }
-
-      return doNext;
-   }
-
-   /**
-    * Initiates the SOAP fault processing for this handler chain.
-    * <p/>
-    * In this implementation, the fault handler chain starts processing from the same Handler
-    * instance (that returned false) and goes backward in the execution sequence.
-    *
-    * @return Returns true if all handlers in chain have been processed.
-    *         Returns false if a handler in the chain returned false from its handleFault method.
-    * @throws javax.xml.rpc.JAXRPCException if any processing error happens
-    */
-   public boolean handleFault(MessageContext msgContext)
-   {
-      boolean doNext = true;
-
-      if (handlers.size() > 0)
-      {
-         log.debug("Enter: handleFault");
-         
-         try
-         {
-            int handlerIndex = handlers.size() - 1;
-            if (falseIndex != -1)
-               handlerIndex = falseIndex;
-
-            Handler currHandler = null;
-            for (; doNext && handlerIndex >= 0; handlerIndex--)
-            {
-               currHandler = ((HandlerEntry)handlers.get(handlerIndex)).getHandler();
-               log.debug("Handle fault: " + currHandler);
-               doNext = currHandler.handleFault(msgContext);
-            }
-         }
-         finally
-         {
-            log.debug("Exit: handleFault with status: " + doNext);
-         }
-      }
-
-      return doNext;
-   }
-
-   /**
-    * Trace the SOAPPart, do nothing if the String representation is equal to the last one.
-    */
-   protected String traceSOAPPart(SOAPPart soapPart, String lastMessageTrace)
-   {
-      try
-      {
-         SOAPEnvelopeImpl soapEnv = (SOAPEnvelopeImpl)soapPart.getEnvelope();
-         String envString = DOMWriter.printNode(soapEnv, true);
-         if (envString.equals(lastMessageTrace) == false)
-         {
-            log.debug(envString);
-            lastMessageTrace = envString;
-         }
-         return lastMessageTrace;
-      }
-      catch (SOAPException e)
-      {
-         log.error("Cannot get SOAPEnvelope", e);
-         return null;
-      }
-   }
-
-   /**
-    * Replace handlers that did not survive the previous call
-    */
-   protected void replaceDirtyHandlers()
-   {
-      for (int i = 0; i < handlers.size(); i++)
-      {
-         HandlerEntry entry = (HandlerEntry)handlers.get(i);
-         if (entry.handler.getState() == HandlerWrapper.DOES_NOT_EXIST)
-         {
-            log.debug("Replacing dirty handler: " + entry.handler);
-            try
-            {
-               HandlerWrapper handler = new HandlerWrapper((Handler)entry.info.getHandlerClass().newInstance());
-               entry.handler = handler;
-               handler.init(entry.info);
-            }
-            catch (RuntimeException rte)
-            {
-               throw rte;
-            }
-            catch (Exception ex)
-            {
-               log.error("Cannot create handler instance for: " + entry.info, ex);
-            }
-         }
-      }
-   }
-
-   /**
-    * Get the handler at the requested position
-    */
-   protected Handler getHandlerAt(int pos)
-   {
-      if (pos < 0 || handlers.size() <= pos)
-         throw new IllegalArgumentException("No handler at position: " + pos);
-
-      HandlerEntry entry = (HandlerEntry)handlers.get(pos);
-      return entry.handler;
-   }
-
-   /**
-    * R1027 A RECEIVER MUST generate a "soap:MustUnderstand" fault when a
-    * message contains a mandatory header block (i.e., one that has a
-    * soap:mustUnderstand attribute with the value "1") targeted at the
-    * receiver (via soap:actor) that the receiver does not understand.
-    */
-   public static void checkMustUnderstand(SOAPMessageContextImpl msgContext, String[] roles)
-   {
-      SOAPHeaderElement mustUnderstandHeaderElement = null;
-      List roleList = (roles != null ? Arrays.asList(roles) : new ArrayList());
-      try
-      {
-         SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
-         
-         // A SOAPHeaderElement is possibly bound to the endpoint operation
-         // in order to check that we need a the opMetaData
-         OperationMetaData opMetaData = msgContext.getOperationMetaData();
-         if (opMetaData == null)
-         {
-            // The security handler must have decrypted the incomming message
-            // before the dispatch target operation can be known 
-            EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
-            opMetaData = soapMessage.getOperationMetaData(epMetaData);
-         }         
-         
-         SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
-         if (soapEnvelope != null && soapEnvelope.getHeader() != null)
-         {
-            Iterator it = soapEnvelope.getHeader().examineAllHeaderElements();
-            while (it.hasNext() && mustUnderstandHeaderElement == null)
-            {
-               SOAPHeaderElement soapHeaderElement = (SOAPHeaderElement)it.next();
-               Name name = soapHeaderElement.getElementName();
-               QName xmlName = new QName(name.getURI(), name.getLocalName());
-               
-               ParameterMetaData paramMetaData = (opMetaData != null ? opMetaData.getParameter(xmlName) : null);
-               boolean isBoundHeader = (paramMetaData != null && paramMetaData.isInHeader());
-               
-               if (soapHeaderElement.getMustUnderstand() && isBoundHeader == false)
-               {
-                  String actor = soapHeaderElement.getActor();
-                  boolean noActor = (actor == null || actor.length() == 0);
-                  boolean nextActor = Constants.URI_SOAP11_NEXT_ACTOR.equals(actor);
-                  if (noActor || nextActor || roleList.contains(actor))
-                  {
-                     mustUnderstandHeaderElement = soapHeaderElement;
-                  }
-               }
-            }
-         }
-      }
-      catch (SOAPException ex)
-      {
-         log.error("Cannot check mustUnderstand for headers", ex);
-      }
-
-      if (mustUnderstandHeaderElement != null)
-      {
-         QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
-         String faultString = "Unprocessed 'mustUnderstand' header element: " + mustUnderstandHeaderElement.getElementName();
-         throw new SOAPFaultException(faultCode, faultString, null, null);
-      }
-   }
-
-   /**
-    * An entry in the handler list
-    */
-   private class HandlerEntry
-   {
-      private HandlerWrapper handler;
-      private HandlerInfo info;
-
-      public HandlerEntry(HandlerWrapper handler, HandlerInfo info)
-      {
-         this.handler = handler;
-         this.info = info;
-      }
-
-      public Handler getHandler()
-      {
-         return handler;
-      }
-
-      public HandlerInfo getInfo()
-      {
-         return info;
-      }
-   }
-
-   // java.util.List interface ****************************************************************************************
-
-   public boolean remove(Object o)
-   {
-      return handlers.remove(o);
-   }
-
-   public boolean containsAll(Collection c)
-   {
-      return handlers.containsAll(c);
-   }
-
-   public boolean removeAll(Collection c)
-   {
-      return handlers.removeAll(c);
-   }
-
-   public boolean retainAll(Collection c)
-   {
-      return handlers.retainAll(c);
-   }
-
-   public int hashCode()
-   {
-      return handlers.hashCode();
-   }
-
-   public boolean equals(Object o)
-   {
-      return handlers.equals(o);
-   }
-
-   public Iterator iterator()
-   {
-      return handlers.iterator();
-   }
-
-   public List subList(int fromIndex, int toIndex)
-   {
-      return handlers.subList(fromIndex, toIndex);
-   }
-
-   public ListIterator listIterator()
-   {
-      return handlers.listIterator();
-   }
-
-   public ListIterator listIterator(int index)
-   {
-      return handlers.listIterator(index);
-   }
-
-   public int size()
-   {
-      return handlers.size();
-   }
-
-   public void clear()
-   {
-      handlers.clear();
-   }
-
-   public boolean isEmpty()
-   {
-      return handlers.isEmpty();
-   }
-
-   public Object[] toArray()
-   {
-      return handlers.toArray();
-   }
-
-   public Object get(int index)
-   {
-      return handlers.get(index);
-   }
-
-   public Object remove(int index)
-   {
-      return handlers.remove(index);
-   }
-
-   public void add(int index, Object element)
-   {
-      handlers.add(index, (HandlerEntry)element);
-   }
-
-   public int indexOf(Object elem)
-   {
-      return handlers.indexOf(elem);
-   }
-
-   public int lastIndexOf(Object elem)
-   {
-      return handlers.lastIndexOf(elem);
-   }
-
-   public boolean add(Object o)
-   {
-      return handlers.add((HandlerEntry)o);
-   }
-
-   public boolean contains(Object elem)
-   {
-      return handlers.contains(elem);
-   }
-
-   public boolean addAll(int index, Collection c)
-   {
-      return handlers.addAll(index, c);
-   }
-
-   public boolean addAll(Collection c)
-   {
-      return handlers.addAll(c);
-   }
-
-   public Object set(int index, Object element)
-   {
-      return handlers.set(index, (HandlerEntry)element);
-   }
-
-   public Object[] toArray(Object[] a)
-   {
-      return handlers.toArray(a);
-   }
-}

Deleted: trunk/src/main/java/org/jboss/ws/handler/HandlerWrapper.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/handler/HandlerWrapper.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/handler/HandlerWrapper.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -1,201 +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.handler;
-
-// $Id$
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
-import javax.xml.rpc.handler.Handler;
-import javax.xml.rpc.handler.HandlerInfo;
-import javax.xml.rpc.handler.MessageContext;
-import javax.xml.rpc.soap.SOAPFaultException;
-
-import org.jboss.logging.Logger;
-
-/**
- * A wrapper arround a {@link javax.xml.rpc.handler.Handler} that takes care of its lifecycle.
- *
- * @author thomas.diesler at jboss.org
- */
-public class HandlerWrapper implements Handler
-{
-   private static Logger log = Logger.getLogger(HandlerWrapper.class);
-
-   public final static int DOES_NOT_EXIST = 0;
-   public final static int METHOD_READY = 1;
-
-   // The states as string
-   private static String[] stateNames = new String[]{"DOES_NOT_EXIST", "METHOD_READY"};
-
-   // The handler to delegate to
-   private Handler delegate;
-   // The handler state
-   private int state;
-
-   /**
-    * Delegate to the given handler
-    */
-   public HandlerWrapper(Handler handler)
-   {
-      delegate = handler;
-      state = DOES_NOT_EXIST; // this is somewhat a lie ;-)
-   }
-
-   /**
-    * Get the current state
-    */
-   public int getState()
-   {
-      return state;
-   }
-
-   /**
-    * Get the current state as string
-    */
-   public String getStateAsString()
-   {
-      return stateNames[state];
-   }
-
-   /**
-    * Gets the header blocks processed by this Handler instance.
-    */
-   public QName[] getHeaders()
-   {
-      return delegate.getHeaders();
-   }
-
-   /**
-    * The init method enables the Handler instance to initialize itself.
-    */
-   public void init(HandlerInfo config) throws JAXRPCException
-   {
-      log.debug("init: " + delegate);
-      delegate.init(config);
-      state = METHOD_READY;
-   }
-
-   /**
-    * The destroy method indicates the end of lifecycle for a Handler instance.
-    */
-   public void destroy() throws JAXRPCException
-   {
-      log.debug("destroy: " + delegate);
-      state = DOES_NOT_EXIST;
-      delegate.destroy();
-   }
-
-   /**
-    * The handleRequest method processes the request message.
-    */
-   public boolean handleRequest(MessageContext msgContext) throws JAXRPCException, SOAPFaultException
-   {
-      if (state == DOES_NOT_EXIST)
-      {
-         log.warn("Handler is in state DOES_NOT_EXIST, skipping Handler.handleRequest for: " + delegate);
-         return true;
-      }
-
-      try
-      {
-         return delegate.handleRequest(msgContext);
-      }
-      catch (RuntimeException e)
-      {
-         return handleRuntimeException(e);
-      }
-   }
-
-   /**
-    * The handleResponse method processes the response SOAP message.
-    */
-   public boolean handleResponse(MessageContext msgContext)
-   {
-      if (state == DOES_NOT_EXIST)
-      {
-         log.warn("Handler is in state DOES_NOT_EXIST, skipping Handler.handleResponse for: " + delegate);
-         return true;
-      }
-
-      try
-      {
-         return delegate.handleResponse(msgContext);
-      }
-      catch (RuntimeException e)
-      {
-         return handleRuntimeException(e);
-      }
-   }
-
-   /**
-    * The handleFault method processes the SOAP faults based on the SOAP message processing model.
-    */
-   public boolean handleFault(MessageContext msgContext)
-   {
-      if (state == DOES_NOT_EXIST)
-      {
-         log.warn("Handler is in state DOES_NOT_EXIST, skipping Handler.handleFault for: " + delegate);
-         return true;
-      }
-
-      try
-      {
-         return delegate.handleFault(msgContext);
-      }
-      catch (RuntimeException e)
-      {
-         return handleRuntimeException(e);
-      }
-   }
-
-   /**
-    * As defined by JAX-RPC, a RuntimeException(other than SOAPFaultException) thrown from any method of
-    * the Handler results in the destroymethod being invoked and transition to the “Does Not Exist” state.
-    */
-   private boolean handleRuntimeException(RuntimeException e)
-   {
-      if ((e instanceof SOAPFaultException) == false)
-      {
-         log.warn("RuntimeException in handler method, transition to DOES_NOT_EXIST");
-         destroy();
-      }
-
-      throw e;
-   }
-
-   /**
-    * Returns a hash code value for the object.
-    */
-   public int hashCode()
-   {
-      return delegate.hashCode();
-   }
-
-   /**
-    * Returns a string representation of the object.
-    */
-   public String toString()
-   {
-      return "[state=" + getStateAsString() + ",handler=" + delegate + "]";
-   }
-}

Deleted: trunk/src/main/java/org/jboss/ws/handler/MessageContextImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/handler/MessageContextImpl.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/handler/MessageContextImpl.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -1,109 +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.handler;
-
-// $Id$
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-import javax.xml.rpc.handler.MessageContext;
-
-/**
- * The message context that is processed by a handler
- * in the handle method.
- * <p/>
- * Provides methods to manage a property set.
- * MessageContext properties enable handlers in a handler chain to share
- * processing related state.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 06-May-2004
- */
-public class MessageContextImpl implements MessageContext
-{
-   public static final String SERVLET_CONTEXT = "javax.xml.ws.servlet.context";
-   public static final String SERVLET_REQUEST = "javax.xml.ws.servlet.request";
-   public static final String SERVLET_RESPONSE = "javax.xml.ws.servlet.response";
-   public static final String SERVLET_SESSION = "javax.xml.ws.servlet.session";
-
-   // The map of the properties
-   private HashMap<String, Object> props = new HashMap<String, Object>();
-
-   /**
-    * Returns true if the MessageContext contains a property with the specified name.
-    *
-    * @param name Name of the property whose presense is to be tested
-    * @return Returns true if the MessageContext contains the property; otherwise false
-    */
-   public boolean containsProperty(String name)
-   {
-      return props.containsKey(name);
-   }
-
-   /**
-    * Gets the value of a specific property from the MessageContext
-    *
-    * @param name Name of the property whose value is to be retrieved
-    * @return Value of the property
-    * @throws IllegalArgumentException if an illegal property name is specified
-    */
-   public Object getProperty(String name)
-   {
-      return props.get(name);
-   }
-
-   /**
-    * Returns an Iterator view of the names of the properties in this MessageContext
-    *
-    * @return Iterator for the property names
-    */
-   public Iterator getPropertyNames()
-   {
-      return props.keySet().iterator();
-   }
-
-   /**
-    * Removes a property (name-value pair) from the MessageContext
-    *
-    * @param name Name of the property to be removed
-    * @throws IllegalArgumentException if an illegal property name is specified
-    */
-   public void removeProperty(String name)
-   {
-      props.remove(name);
-   }
-
-   /**
-    * Sets the name and value of a property associated with the MessageContext.
-    * If the MessageContext contains a value of the same property, the old value is replaced.
-    *
-    * @param name  Name of the property associated with the MessageContext
-    * @param value Value of the property
-    * @throws IllegalArgumentException      If some aspect of the property is prevents it from being stored in the context
-    * @throws UnsupportedOperationException If this method is not supported.
-    */
-   public void setProperty(String name, Object value)
-   {
-      props.put(name, value);
-   }
-}

Deleted: trunk/src/main/java/org/jboss/ws/handler/ServerHandlerChain.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/handler/ServerHandlerChain.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/handler/ServerHandlerChain.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -1,62 +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.handler;
-
-// $Id$
-
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.rpc.handler.MessageContext;
-
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
-
-/**
- * Represents a list of handlers. All elements in the
- * HandlerChain are of the type javax.xml.rpc.handler.Handler.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 06-May-2004
- */
-public class ServerHandlerChain extends HandlerChainBaseImpl
-{
-   // The required type of the handler
-   private HandlerType type;
-   
-   public ServerHandlerChain(List infos, Set roles, HandlerType type)
-   {
-      super(infos, roles);
-      this.type = type;
-   }
-
-   public boolean handleRequest(MessageContext msgContext)
-   {
-      boolean doNext = super.handleRequest(msgContext);
-      return doNext;
-   }
-
-   public boolean handleResponse(MessageContext msgContext)
-   {
-      boolean doNext = super.handleResponse(msgContext);
-      return doNext;
-   }
-}

Modified: trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInterceptor.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInterceptor.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInterceptor.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -23,7 +23,6 @@
 
 // $Id$
 
-import javax.xml.rpc.handler.MessageContext;
 import javax.xml.soap.SOAPMessage;
 
 import org.jboss.ejb.plugins.AbstractInterceptor;
@@ -33,9 +32,9 @@
 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.metadata.OperationMetaData;
 import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 
 /**
  * This Interceptor does the ws4ee handler processing.
@@ -58,7 +57,7 @@
    public Object invoke(final Invocation mi) throws Exception
    {
       // If no msgContext, it's not for us
-      MessageContext msgContext = (MessageContext)mi.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
+      SOAPMessageContextBase msgContext = (SOAPMessageContextBase)mi.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
       if (msgContext == null)
       {
          return getNext().invoke(mi);
@@ -95,7 +94,7 @@
                // Bind the response message
                BindingProvider bindingProvider = BindingProviderRegistry.getDefaultProvider();
                SOAPMessage resMessage = bindingProvider.bindResponseMessage(opMetaData, epInv);
-               ((SOAPMessageContextImpl)msgContext).setMessage(resMessage);
+               msgContext.setMessage(resMessage);
             }
             
             // call the response handlers

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-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerEJB21.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -27,10 +27,8 @@
 import java.security.Principal;
 
 import javax.management.MBeanServer;
-import javax.xml.rpc.ServiceException;
-import javax.xml.rpc.handler.HandlerChain;
+import javax.management.ObjectName;
 import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.SOAPMessage;
 
 import org.jboss.ejb.EjbModule;
 import org.jboss.ejb.Interceptor;
@@ -44,8 +42,7 @@
 import org.jboss.security.SecurityAssociation;
 import org.jboss.ws.WSException;
 import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.handler.HandlerChainBaseImpl;
-import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
+import org.jboss.ws.common.SOAPMessageContextBase;
 import org.jboss.ws.metadata.ServerEndpointMetaData;
 import org.jboss.ws.metadata.EndpointMetaData.Type;
 import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
@@ -53,8 +50,8 @@
 import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
 import org.jboss.ws.server.ServiceEndpointInfo;
 import org.jboss.ws.server.ServiceEndpointInvoker;
+import org.jboss.ws.server.ServiceEndpointInvokerBase;
 import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 import org.jboss.ws.utils.ObjectNameFactory;
 
 /**
@@ -63,13 +60,14 @@
  * @author Thomas.Diesler at jboss.org
  * @since 19-Jan-2005
  */
-public class ServiceEndpointInvokerEJB21 extends ServiceEndpointInvoker 
+public class ServiceEndpointInvokerEJB21 extends ServiceEndpointInvokerBase implements ServiceEndpointInvoker 
 {
    // provide logging
    private Logger log = Logger.getLogger(ServiceEndpointInvokerEJB21.class);
 
    private String jndiName;
    private MBeanServer server;
+   private ObjectName objectName;
 
    public ServiceEndpointInvokerEJB21()
    {
@@ -77,8 +75,11 @@
    }
 
    /** Initialize the service endpoint */
-   public void initServiceEndpoint(ServiceEndpointInfo seInfo) throws ServiceException
+   @Override
+   public void initServiceEndpoint(ServiceEndpointInfo seInfo) 
    {
+      super.initServiceEndpoint(seInfo);
+      
       ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
       String ejbName = epMetaData.getLinkName();
       if (ejbName == null)
@@ -138,10 +139,10 @@
 
    /** Load the SEI implementation bean if necessary 
     */
-   public Class loadServiceEndpoint(ServiceEndpointInfo seInfo) throws ServiceException
+   public Class loadServiceEndpoint(ServiceEndpointInfo seInfo) 
    {
       if (server.isRegistered(objectName) == false)
-         throw new ServiceException("Cannot find service endpoint target: " + objectName);
+         throw new WSException("Cannot find service endpoint target: " + objectName);
 
       return null;
    }
@@ -161,7 +162,7 @@
       Principal principal = SecurityAssociation.getPrincipal();
       Object credential = SecurityAssociation.getCredential();
 
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
 
       // invoke on the container
       try
@@ -170,6 +171,7 @@
          Method method = epInv.getJavaMethod();
          Object[] args = epInv.getRequestPayload();
          Invocation inv = new Invocation(null, method, args, null, principal, credential);
+         
          inv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
          inv.setValue(InvocationKey.SOAP_MESSAGE, msgContext.getMessage());
          inv.setType(InvocationType.SERVICE_ENDPOINT);
@@ -188,27 +190,6 @@
       }
    }
 
-   protected boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
-   {
-      if (type == HandlerType.PRE)
-         return super.callRequestHandlerChain(seInfo, type);
-      else return true;
-   }
-
-   protected boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
-   {
-      if (type == HandlerType.PRE)
-         return super.callResponseHandlerChain(seInfo, type);
-      else return true;
-   }
-
-   protected boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex)
-   {
-      if (type == HandlerType.PRE)
-         return super.callFaultHandlerChain(seInfo, type, ex);
-      else return true;
-   }
-
    /** Create an instance of the SEI implementation bean if necessary */
    public void destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl)
    {
@@ -216,7 +197,7 @@
    }
 
    // The ServiceEndpointInterceptor calls the methods in this callback
-   public static class HandlerCallback
+   public class HandlerCallback
    {
       private ServiceEndpointInfo seInfo;
 
@@ -227,62 +208,17 @@
 
       public boolean callRequestHandlerChain(HandlerType type)
       {
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
-
-         boolean status = true;
-         String[] roles = null;
-
-         HandlerChain handlerChain = null;
-         if (type == HandlerType.PRE)
-            handlerChain = seInfo.getPreHandlerChain();
-         else if (type == HandlerType.JAXRPC)
-            handlerChain = seInfo.getJaxRpcHandlerChain();
-         else if (type == HandlerType.POST)
-            handlerChain = seInfo.getPostHandlerChain();
-
-         if (handlerChain != null)
-         {
-            roles = handlerChain.getRoles();
-            status = handlerChain.handleRequest(msgContext);
-         }
-
-         // BP-1.0 R1027
-         if (type == HandlerType.POST)
-            HandlerChainBaseImpl.checkMustUnderstand(msgContext, roles);
-
-         return status;
+         return delegate.callRequestHandlerChain(seInfo, type);
       }
 
       public boolean callResponseHandlerChain(HandlerType type)
       {
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
-
-         HandlerChain handlerChain = null;
-         if (type == HandlerType.PRE)
-            handlerChain = seInfo.getPreHandlerChain();
-         else if (type == HandlerType.JAXRPC)
-            handlerChain = seInfo.getJaxRpcHandlerChain();
-         else if (type == HandlerType.POST)
-            handlerChain = seInfo.getPostHandlerChain();
-
-         return (handlerChain != null ? handlerChain.handleResponse(msgContext) : true);
+         return delegate.callResponseHandlerChain(seInfo, type);
       }
 
       public boolean callFaultHandlerChain(HandlerType type, Exception ex)
       {
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
-         SOAPMessage faultMessage = SOAPFaultExceptionHelper.exceptionToFaultMessage(ex);
-         msgContext.setMessage(faultMessage);
-
-         HandlerChain handlerChain = null;
-         if (type == HandlerType.PRE)
-            handlerChain = seInfo.getPreHandlerChain();
-         else if (type == HandlerType.JAXRPC)
-            handlerChain = seInfo.getJaxRpcHandlerChain();
-         else if (type == HandlerType.POST)
-            handlerChain = seInfo.getPostHandlerChain();
-
-         return (handlerChain != null ? handlerChain.handleFault(msgContext) : true);
+         return delegate.callFaultHandlerChain(seInfo, type, ex);
       }
    }
 }

Modified: trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerEJB3.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerEJB3.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerEJB3.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -26,7 +26,7 @@
 import java.lang.reflect.Method;
 
 import javax.management.MBeanServer;
-import javax.xml.rpc.ServiceException;
+import javax.management.ObjectName;
 import javax.xml.rpc.soap.SOAPFaultException;
 
 import org.jboss.aop.Dispatcher;
@@ -38,6 +38,7 @@
 import org.jboss.ws.deployment.UnifiedDeploymentInfo;
 import org.jboss.ws.server.ServiceEndpointInfo;
 import org.jboss.ws.server.ServiceEndpointInvoker;
+import org.jboss.ws.server.ServiceEndpointInvokerBase;
 import org.jboss.ws.utils.ObjectNameFactory;
 
 /**
@@ -46,12 +47,13 @@
  * @author Thomas.Diesler at jboss.org
  * @since 23-Jul-2005
  */
-public class ServiceEndpointInvokerEJB3 extends ServiceEndpointInvoker
+public class ServiceEndpointInvokerEJB3 extends ServiceEndpointInvokerBase implements ServiceEndpointInvoker
 {
    // provide logging
    private Logger log = Logger.getLogger(ServiceEndpointInvokerEJB3.class);
 
    private MBeanServer server;
+   private ObjectName objectName;
 
    public ServiceEndpointInvokerEJB3()
    {
@@ -59,8 +61,11 @@
    }
    
    /** Initialize the service endpoint */
-   public void initServiceEndpoint(ServiceEndpointInfo seInfo) throws ServiceException
+   @Override
+   public void initServiceEndpoint(ServiceEndpointInfo seInfo) 
    {
+      super.initServiceEndpoint(seInfo);
+      
       String ejbName = seInfo.getServerEndpointMetaData().getLinkName();
       UnifiedDeploymentInfo udi = seInfo.getUnifiedDeploymentInfo();
       String nameStr = "jboss.j2ee:name=" + ejbName + ",service=EJB3,jar=" + udi.shortName;
@@ -74,10 +79,10 @@
    
    /** Load the SEI implementation bean if necessary 
     */
-   public Class loadServiceEndpoint(ServiceEndpointInfo seInfo) throws ServiceException
+   public Class loadServiceEndpoint(ServiceEndpointInfo seInfo)
    {
       if (server.isRegistered(objectName) == false)
-         throw new ServiceException("Cannot find service endpoint target: " + objectName);
+         throw new WSException("Cannot find service endpoint target: " + objectName);
       
       return null;
    }

Modified: trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerMDB.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerMDB.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerMDB.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -25,13 +25,13 @@
 
 import java.lang.reflect.Method;
 
-import javax.xml.rpc.ServiceException;
 import javax.xml.rpc.soap.SOAPFaultException;
 
 import org.jboss.logging.Logger;
 import org.jboss.ws.binding.EndpointInvocation;
 import org.jboss.ws.server.ServiceEndpointInfo;
 import org.jboss.ws.server.ServiceEndpointInvoker;
+import org.jboss.ws.server.ServiceEndpointInvokerBase;
 import org.jboss.ws.utils.ThreadLocalAssociation;
 
 /**
@@ -40,19 +40,14 @@
  * @author Thomas.Diesler at jboss.org
  * @since 21-Mar-2006
  */
-public class ServiceEndpointInvokerMDB extends ServiceEndpointInvoker
+public class ServiceEndpointInvokerMDB extends ServiceEndpointInvokerBase implements ServiceEndpointInvoker
 {
    // provide logging
    private Logger log = Logger.getLogger(ServiceEndpointInvokerMDB.class);
 
-   /** Initialize the service endpoint */
-   public void initServiceEndpoint(ServiceEndpointInfo seInfo) throws ServiceException
-   {
-   }
-
    /** Load the SEI implementation bean if necessary
     */
-   public Class loadServiceEndpoint(ServiceEndpointInfo seInfo) throws ServiceException, ClassNotFoundException
+   public Class loadServiceEndpoint(ServiceEndpointInfo seInfo) throws ClassNotFoundException
    {
       return null;
    }

Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -47,8 +47,9 @@
 import org.jboss.logging.Logger;
 import org.jboss.ws.Constants;
 import org.jboss.ws.binding.UnboundHeader;
-import org.jboss.ws.client.CommonClient;
-import org.jboss.ws.handler.HandlerChainBaseImpl;
+import org.jboss.ws.common.CommonClient;
+import org.jboss.ws.jaxrpc.handler.HandlerChainBaseImpl;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
 import org.jboss.ws.jbossxb.JBossXBDeserializerFactory;
 import org.jboss.ws.jbossxb.JBossXBSerializerFactory;
 import org.jboss.ws.metadata.EndpointMetaData;
@@ -57,7 +58,7 @@
 import org.jboss.ws.metadata.ServiceMetaData;
 import org.jboss.ws.metadata.TypesMetaData;
 import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
+import org.jboss.ws.soap.MessageContextAssociation;
 import org.jboss.ws.utils.JavaUtils;
 
 /** Provides support for the dynamic invocation of a service endpoint.
@@ -536,23 +537,30 @@
       // Check or generate the the schema if this call is unconfigured
       generateOrUpdateSchemas(opMetaData);
 
+      // Associate a message context with the current thread
+      SOAPMessageContextJAXRPC msgContext = new SOAPMessageContextJAXRPC();
+      MessageContextAssociation.pushMessageContext(msgContext);
+      
       Object retObj = super.invoke(opName, inputParams, unboundHeaders, oneway);
       return retObj;
    }
 
    @Override
-   protected boolean callRequestHandlerChain(QName portName, SOAPMessageContextImpl msgContext)
+   protected boolean callRequestHandlerChain(QName portName)
    {
+      SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
       HandlerChain handlerChain = jaxrpcService.getHandlerChain(portName);
       return (handlerChain != null ? handlerChain.handleRequest(msgContext) : true);
    }
 
    @Override
-   protected boolean callResponseHandlerChain(QName portName, SOAPMessageContextImpl msgContext)
+   protected boolean callResponseHandlerChain(QName portName)
    {
       boolean status = true;
       String[] roles = null;
 
+      SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
+      
       HandlerChain handlerChain = jaxrpcService.getHandlerChain(portName);
       if (handlerChain != null)
       {

Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/HandlerRegistryImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/HandlerRegistryImpl.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/HandlerRegistryImpl.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -34,7 +34,7 @@
 import javax.xml.rpc.handler.HandlerInfo;
 import javax.xml.rpc.handler.HandlerRegistry;
 
-import org.jboss.ws.handler.ClientHandlerChain;
+import org.jboss.ws.jaxrpc.handler.ClientHandlerChain;
 
 /** 
  * Provides support for the programmatic configuration of

Added: trunk/src/main/java/org/jboss/ws/jaxrpc/InvokerDelegateJAXRPC.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/InvokerDelegateJAXRPC.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/InvokerDelegateJAXRPC.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -0,0 +1,340 @@
+/*
+ * 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 endpointContext) 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, endpointContext, 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);
+      }
+   }
+
+}


Property changes on: trunk/src/main/java/org/jboss/ws/jaxrpc/InvokerDelegateJAXRPC.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Deleted: trunk/src/main/java/org/jboss/ws/jaxrpc/JAXRPCSerializationContext.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/JAXRPCSerializationContext.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/JAXRPCSerializationContext.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -1,127 +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 javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.TypesMetaData;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
-import org.jboss.ws.utils.JavaUtils;
-
-/**
- * The serialization context for JAXRPC endpoints/clients
- * 
- * @author Thomas.Diesler at jboss.org
- * @since 04-Dec-2004
- */
-public class JAXRPCSerializationContext extends SerializationContext
-{
-   // provide logging
-   private static final Logger log = Logger.getLogger(JAXRPCSerializationContext.class);
-
-   // XML mapping from jaxrpc-mapping.xml
-   private JavaWsdlMapping jaxrpcMapping;
-
-   public JavaWsdlMapping getJavaWsdlMapping()
-   {
-      if (jaxrpcMapping == null)
-      {
-         log.debug("Generate jaxrpcMapping from typeMapping");
-
-         jaxrpcMapping = new JavaWsdlMapping();
-         for (QName xmlType : getTypeMapping().getRegisteredXmlTypes())
-         {
-            String nsURI = xmlType.getNamespaceURI();
-            if (!Constants.NS_SCHEMA_XSD.equals(nsURI) && !Constants.NS_ATTACHMENT_MIME_TYPE.equals(nsURI))
-            {
-               Class javaType = getTypeMapping().getJavaType(xmlType);
-               String javaTypeName = javaType.getName();
-
-               Class componentType = javaType;
-               while (componentType.isArray())
-                  componentType = componentType.getComponentType();
-
-               if (JavaUtils.isPrimitive(componentType))
-                  componentType = JavaUtils.getWrapperType(componentType);
-
-               Package packageObject = componentType.getPackage();
-               String packageName = (packageObject != null) ? packageObject.getName() : "";
-               String packageType = jaxrpcMapping.getPackageNameForNamespaceURI(nsURI);
-               if (packageName.equals(packageType) == false)
-               {
-                  PackageMapping packageMapping = new PackageMapping(jaxrpcMapping);
-                  packageMapping.setNamespaceURI(nsURI);
-                  packageMapping.setPackageType(packageName);
-                  jaxrpcMapping.addPackageMapping(packageMapping);
-                  log.debug("Add package mapping: " + packageMapping);
-               }
-
-               // Do not add mappings for array types
-               if (javaType.isArray())
-                  continue;
-
-               JavaXmlTypeMapping xmlTypeMapping = jaxrpcMapping.getTypeMappingForQName(xmlType);
-               if (xmlTypeMapping == null)
-               {
-                  xmlTypeMapping = new JavaXmlTypeMapping(jaxrpcMapping);
-                  xmlTypeMapping.setQNameScope("complexType");
-                  xmlTypeMapping.setJavaType(javaTypeName);
-                  xmlTypeMapping.setRootTypeQName(xmlType);
-                  jaxrpcMapping.addJavaXmlTypeMappings(xmlTypeMapping);
-                  log.debug("Add type mapping: " + xmlTypeMapping);
-               }
-            }
-         }
-      }
-      return jaxrpcMapping;
-   }
-
-   public void setJavaWsdlMapping(JavaWsdlMapping jaxrpcMapping)
-   {
-      this.jaxrpcMapping = jaxrpcMapping;
-   }
-
-   public XSModel getXsModel()
-   {
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
-      if (msgContext == null)
-         throw new WSException("MessageContext not available");
-
-      OperationMetaData opMetaData = msgContext.getOperationMetaData();
-      ServiceMetaData serviceMetaData = opMetaData.getEndpointMetaData().getServiceMetaData();
-      TypesMetaData typesMetaData = serviceMetaData.getTypesMetaData();
-      return typesMetaData.getSchemaModel();
-   }
-}

Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/SOAPFaultExceptionHelper.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/SOAPFaultExceptionHelper.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/SOAPFaultExceptionHelper.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -53,6 +53,7 @@
 import org.jboss.ws.binding.SerializerSupport;
 import org.jboss.ws.jaxrpc.encoding.DeserializerFactoryBase;
 import org.jboss.ws.jaxrpc.encoding.SerializerFactoryBase;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
 import org.jboss.ws.metadata.FaultMetaData;
 import org.jboss.ws.metadata.OperationMetaData;
 import org.jboss.ws.soap.MessageContextAssociation;
@@ -60,7 +61,6 @@
 import org.jboss.ws.soap.NameImpl;
 import org.jboss.ws.soap.SOAPEnvelopeImpl;
 import org.jboss.ws.soap.SOAPFactoryImpl;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 import org.jboss.xb.binding.NamespaceRegistry;
 import org.w3c.dom.Element;
 
@@ -99,7 +99,7 @@
 
       SOAPFaultException faultEx = new SOAPFaultException(faultCode, faultString, faultActor, detail);
 
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
       if (detail != null && msgContext != null)
       {
          SerializationContext serContext = msgContext.getSerializationContext();
@@ -230,7 +230,7 @@
       {
          Class javaType = faultCause.getClass();
 
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+         SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
          SerializationContext serContext = msgContext.getSerializationContext();
          TypeMapping typeMapping = serContext.getTypeMapping();
 

Copied: trunk/src/main/java/org/jboss/ws/jaxrpc/SerializationContextJAXRPC.java (from rev 643, trunk/src/main/java/org/jboss/ws/jaxrpc/JAXRPCSerializationContext.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/JAXRPCSerializationContext.java	2006-07-30 12:25:17 UTC (rev 643)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/SerializationContextJAXRPC.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -0,0 +1,127 @@
+/*
+ * 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 javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSModel;
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.TypesMetaData;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping;
+import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.utils.JavaUtils;
+
+/**
+ * The serialization context for JAXRPC endpoints/clients
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 04-Dec-2004
+ */
+public class SerializationContextJAXRPC extends SerializationContext
+{
+   // provide logging
+   private static final Logger log = Logger.getLogger(SerializationContextJAXRPC.class);
+
+   // XML mapping from jaxrpc-mapping.xml
+   private JavaWsdlMapping jaxrpcMapping;
+
+   public JavaWsdlMapping getJavaWsdlMapping()
+   {
+      if (jaxrpcMapping == null)
+      {
+         log.debug("Generate jaxrpcMapping from typeMapping");
+
+         jaxrpcMapping = new JavaWsdlMapping();
+         for (QName xmlType : getTypeMapping().getRegisteredXmlTypes())
+         {
+            String nsURI = xmlType.getNamespaceURI();
+            if (!Constants.NS_SCHEMA_XSD.equals(nsURI) && !Constants.NS_ATTACHMENT_MIME_TYPE.equals(nsURI))
+            {
+               Class javaType = getTypeMapping().getJavaType(xmlType);
+               String javaTypeName = javaType.getName();
+
+               Class componentType = javaType;
+               while (componentType.isArray())
+                  componentType = componentType.getComponentType();
+
+               if (JavaUtils.isPrimitive(componentType))
+                  componentType = JavaUtils.getWrapperType(componentType);
+
+               Package packageObject = componentType.getPackage();
+               String packageName = (packageObject != null) ? packageObject.getName() : "";
+               String packageType = jaxrpcMapping.getPackageNameForNamespaceURI(nsURI);
+               if (packageName.equals(packageType) == false)
+               {
+                  PackageMapping packageMapping = new PackageMapping(jaxrpcMapping);
+                  packageMapping.setNamespaceURI(nsURI);
+                  packageMapping.setPackageType(packageName);
+                  jaxrpcMapping.addPackageMapping(packageMapping);
+                  log.debug("Add package mapping: " + packageMapping);
+               }
+
+               // Do not add mappings for array types
+               if (javaType.isArray())
+                  continue;
+
+               JavaXmlTypeMapping xmlTypeMapping = jaxrpcMapping.getTypeMappingForQName(xmlType);
+               if (xmlTypeMapping == null)
+               {
+                  xmlTypeMapping = new JavaXmlTypeMapping(jaxrpcMapping);
+                  xmlTypeMapping.setQNameScope("complexType");
+                  xmlTypeMapping.setJavaType(javaTypeName);
+                  xmlTypeMapping.setRootTypeQName(xmlType);
+                  jaxrpcMapping.addJavaXmlTypeMappings(xmlTypeMapping);
+                  log.debug("Add type mapping: " + xmlTypeMapping);
+               }
+            }
+         }
+      }
+      return jaxrpcMapping;
+   }
+
+   public void setJavaWsdlMapping(JavaWsdlMapping jaxrpcMapping)
+   {
+      this.jaxrpcMapping = jaxrpcMapping;
+   }
+
+   public XSModel getXsModel()
+   {
+      SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
+      if (msgContext == null)
+         throw new WSException("MessageContext not available");
+
+      OperationMetaData opMetaData = msgContext.getOperationMetaData();
+      ServiceMetaData serviceMetaData = opMetaData.getEndpointMetaData().getServiceMetaData();
+      TypesMetaData typesMetaData = serviceMetaData.getTypesMetaData();
+      return typesMetaData.getSchemaModel();
+   }
+}

Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPDeserializer.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPDeserializer.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPDeserializer.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -34,8 +34,8 @@
 import org.jboss.ws.binding.BindingException;
 import org.jboss.ws.binding.DeserializerSupport;
 import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.common.SOAPMessageContextBase;
 import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 import org.jboss.ws.soap.SOAPMessageImpl;
 
 /**
@@ -55,7 +55,7 @@
       
       try
       {
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+         SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
          SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
          AttachmentPart part = soapMessage.getAttachmentByContentId(cid);
          if (part == null)

Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPSerializer.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPSerializer.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPSerializer.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -33,8 +33,8 @@
 import org.jboss.ws.binding.BindingException;
 import org.jboss.ws.binding.SerializationContext;
 import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.common.SOAPMessageContextBase;
 import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 import org.jboss.ws.soap.SOAPMessageImpl;
 import org.jboss.ws.soap.attachment.MimeConstants;
 import org.jboss.xb.binding.NamespaceRegistry;
@@ -65,7 +65,7 @@
       StringBuilder xopInclude = new StringBuilder("<" + Constants.PREFIX_XOP + ":Include ");
       xopInclude.append("xmlns:" + Constants.PREFIX_XOP + "='" + Constants.NS_XOP + "' ");
       
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
       SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
       
       String cid = soapMessage.getCidGenerator().generateFromName(xmlName.getLocalPart());

Copied: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/ClientHandlerChain.java (from rev 643, trunk/src/main/java/org/jboss/ws/handler/ClientHandlerChain.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/handler/ClientHandlerChain.java	2006-07-30 12:25:17 UTC (rev 643)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/handler/ClientHandlerChain.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -0,0 +1,51 @@
+/*
+* 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.handler;
+
+// $Id$
+
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.rpc.handler.MessageContext;
+
+
+/**
+ * Represents a list of handlers. All elements in the
+ * HandlerChain are of the type javax.xml.rpc.handler.Handler.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 06-May-2004
+ */
+public class ClientHandlerChain extends HandlerChainBaseImpl
+{
+   public ClientHandlerChain(List infos, Set roles)
+   {
+      super(infos, roles);
+   }
+   
+   public boolean handleResponse(MessageContext msgContext)
+   {
+      boolean doNext = super.handleResponse(msgContext);
+      return doNext;
+   }
+}


Property changes on: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/ClientHandlerChain.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Copied: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerChainBaseImpl.java (from rev 643, trunk/src/main/java/org/jboss/ws/handler/HandlerChainBaseImpl.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/handler/HandlerChainBaseImpl.java	2006-07-30 12:25:17 UTC (rev 643)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerChainBaseImpl.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -0,0 +1,670 @@
+/*
+* 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.handler;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.JAXRPCException;
+import javax.xml.rpc.handler.Handler;
+import javax.xml.rpc.handler.HandlerChain;
+import javax.xml.rpc.handler.HandlerInfo;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPPart;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.xml.DOMWriter;
+import org.jboss.ws.Constants;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.soap.SOAPEnvelopeImpl;
+import org.jboss.ws.soap.SOAPMessageImpl;
+
+/**
+ * Represents a list of handlers. All elements in the
+ * HandlerChain are of the type javax.xml.rpc.handler.Handler.
+ * <p/>
+ * Abstracts the policy and mechanism for the invocation of the registered handlers.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 06-May-2004
+ */
+public abstract class HandlerChainBaseImpl implements HandlerChain
+{
+   private static Logger log = Logger.getLogger(HandlerChainBaseImpl.class);
+
+   public static final int STATE_DOES_NOT_EXIST = 0;
+   public static final int STATE_CREATED = 1;
+   public static final int STATE_READY = 2;
+   public static final int STATE_DESTROYED = 3;
+
+   // The List<Entry> objects
+   protected List<HandlerEntry> handlers = new ArrayList<HandlerEntry>();
+   // The roles associated with the handler chain
+   protected Set<String> roles = new HashSet<String>();
+   // The index of the first handler that returned false during processing
+   protected int falseIndex = -1;
+   // The state of this handler chain
+   protected int state;
+
+   /**
+    * Constructs a handler chain with the given handlers infos
+    */
+   public HandlerChainBaseImpl(List infos, Set roles)
+   {
+      log.debug("Create a handler chain for roles: " + roles);
+      addHandlersToChain(infos, roles);
+   }
+
+   /** Get the list of handler infos
+    */
+   public List<HandlerInfo> getHandlerInfos()
+   {
+      List<HandlerInfo> list = new ArrayList<HandlerInfo>();
+      for (int i = 0; i < handlers.size(); i++)
+      {
+         HandlerEntry entry = (HandlerEntry)handlers.get(i);
+         list.add(entry.info);
+      }
+      return list;
+   }
+
+   /**
+    * Initialize the a handler chain with the given handlers infos
+    *
+    * @throws javax.xml.rpc.JAXRPCException If any error during initialization
+    */
+   private void addHandlersToChain(List infos, Set roleSet)
+   {
+      try
+      {
+         if (infos != null)
+         {
+            for (int i = 0; i < infos.size(); i++)
+            {
+               HandlerInfo info = (HandlerInfo)infos.get(i);
+               HandlerWrapper handler = new HandlerWrapper((Handler)info.getHandlerClass().newInstance());
+               handlers.add(new HandlerEntry(handler, info));
+            }
+         }
+         if (roleSet != null)
+         {
+            roles.addAll(roleSet);
+         }
+      }
+      catch (RuntimeException rte)
+      {
+         throw rte;
+      }
+      catch (Exception ex)
+      {
+         throw new JAXRPCException("Cannot initialize handler chain", ex);
+      }
+
+      // set state to created
+      state = STATE_CREATED;
+   }
+
+   /**
+    * Get the state of this handler chain
+    */
+   public int getState()
+   {
+      return state;
+   }
+
+   /**
+    * Initializes the configuration for a HandlerChain.
+    *
+    * @param config Configuration for the initialization of this handler chain
+    * @throws javax.xml.rpc.JAXRPCException If any error during initialization
+    */
+   public void init(Map config)
+   {
+      log.debug("init: [config=" + config + "]");
+      for (int i = 0; i < handlers.size(); i++)
+      {
+         HandlerEntry entry = (HandlerEntry)handlers.get(i);
+         entry.handler.init(entry.info);
+      }
+
+      // set state to ready
+      state = STATE_READY;
+   }
+
+   /**
+    * Indicates the end of lifecycle for a HandlerChain.
+    *
+    * @throws javax.xml.rpc.JAXRPCException If any error during destroy
+    */
+   public void destroy()
+   {
+      log.debug("destroy");
+      for (int i = 0; i < handlers.size(); i++)
+      {
+         HandlerEntry entry = (HandlerEntry)handlers.get(i);
+         entry.handler.destroy();
+      }
+      handlers.clear();
+
+      // set state to destroyed
+      state = STATE_DESTROYED;
+   }
+
+   /**
+    * Gets SOAP actor roles registered for this HandlerChain at this SOAP node. The returned array includes the
+    * special SOAP actor next.
+    *
+    * @return SOAP Actor roles as URIs
+    */
+   public String[] getRoles()
+   {
+      String[] arr = new String[roles.size()];
+      roles.toArray(arr);
+      return arr;
+   }
+
+   /**
+    * Sets SOAP Actor roles for this HandlerChain. This specifies the set of roles in which this HandlerChain is to act
+    * for the SOAP message processing at this SOAP node. These roles assumed by a HandlerChain must be invariant during
+    * the processing of an individual SOAP message through the HandlerChain.
+    * <p/>
+    * A HandlerChain always acts in the role of the special SOAP actor next. Refer to the SOAP specification for the
+    * URI name for this special SOAP actor. There is no need to set this special role using this method.
+    *
+    * @param soapActorNames URIs for SOAP actor name
+    */
+   public void setRoles(String[] soapActorNames)
+   {
+      List<String> newRoles = Arrays.asList(soapActorNames);
+      log.debug("setRoles: " + newRoles);
+
+      roles.clear();
+      roles.addAll(newRoles);
+   }
+
+   /**
+    * Initiates the request processing for this handler chain.
+    *
+    * @param msgContext MessageContext parameter provides access to the request SOAP message.
+    * @return Returns true if all handlers in chain have been processed. Returns false if a handler in the chain returned false from its handleRequest method.
+    * @throws javax.xml.rpc.JAXRPCException if any processing error happens
+    */
+   public boolean handleRequest(MessageContext msgContext)
+   {
+      boolean doNext = true;
+
+      if (handlers.size() > 0)
+      {
+         log.debug("Enter: handleRequest");
+
+         // Replace handlers that did not survive the previous call
+         replaceDirtyHandlers();
+
+         int handlerIndex = 0;
+         Handler currHandler = null;
+         try
+         {
+            for (; doNext && handlerIndex < handlers.size(); handlerIndex++)
+            {
+               String lastMessageTrace = null;
+               if (log.isTraceEnabled())
+               {
+                  SOAPMessageContextJAXRPC msgCtx = (SOAPMessageContextJAXRPC)msgContext;
+                  SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
+                  lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+               }
+
+               currHandler = ((HandlerEntry)handlers.get(handlerIndex)).getHandler();
+               log.debug("Handle request: " + currHandler);
+               doNext = currHandler.handleRequest(msgContext);
+
+               if (log.isTraceEnabled())
+               {
+                  SOAPMessageContextJAXRPC msgCtx = (SOAPMessageContextJAXRPC)msgContext;
+                  SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
+                  lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+               }
+            }
+         }
+         catch (RuntimeException e)
+         {
+            log.error("RuntimeException in request handler", e);
+            doNext = false;
+            throw e;
+         }
+         finally
+         {
+            // we start at this index in the response chain
+            if (doNext == false)
+               falseIndex = (handlerIndex - 1);
+
+            log.debug("Exit: handleRequest with status: " + doNext);
+         }
+      }
+
+      return doNext;
+   }
+
+   /**
+    * Initiates the response processing for this handler chain.
+    * <p/>
+    * In this implementation, the response handler chain starts processing from the same Handler
+    * instance (that returned false) and goes backward in the execution sequence.
+    *
+    * @return Returns true if all handlers in chain have been processed.
+    *         Returns false if a handler in the chain returned false from its handleResponse method.
+    * @throws javax.xml.rpc.JAXRPCException if any processing error happens
+    */
+   public boolean handleResponse(MessageContext msgContext)
+   {
+      boolean doNext = true;
+
+      if (handlers.size() > 0)
+      {
+         log.debug("Enter: handleResponse");
+
+         int handlerIndex = handlers.size() - 1;
+         if (falseIndex != -1)
+            handlerIndex = falseIndex;
+
+         Handler currHandler = null;
+         try
+         {
+            for (; doNext && handlerIndex >= 0; handlerIndex--)
+            {
+               String lastMessageTrace = null;
+               if (log.isTraceEnabled())
+               {
+                  SOAPMessageContextJAXRPC msgCtx = (SOAPMessageContextJAXRPC)msgContext;
+                  SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
+                  lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+               }
+
+               currHandler = ((HandlerEntry)handlers.get(handlerIndex)).getHandler();
+               log.debug("Handle response: " + currHandler);
+               doNext = currHandler.handleResponse(msgContext);
+
+               if (log.isTraceEnabled())
+               {
+                  SOAPMessageContextJAXRPC msgCtx = (SOAPMessageContextJAXRPC)msgContext;
+                  SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
+                  lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+               }
+            }
+         }
+         catch (RuntimeException rte)
+         {
+            log.error("RuntimeException in response handler", rte);
+            doNext = false;
+            throw rte;
+         }
+         finally
+         {
+            // we start at this index in the fault chain
+            if (doNext == false)
+               falseIndex = (handlerIndex - 1);
+
+            log.debug("Exit: handleResponse with status: " + doNext);
+         }
+      }
+
+      return doNext;
+   }
+
+   /**
+    * Initiates the SOAP fault processing for this handler chain.
+    * <p/>
+    * In this implementation, the fault handler chain starts processing from the same Handler
+    * instance (that returned false) and goes backward in the execution sequence.
+    *
+    * @return Returns true if all handlers in chain have been processed.
+    *         Returns false if a handler in the chain returned false from its handleFault method.
+    * @throws javax.xml.rpc.JAXRPCException if any processing error happens
+    */
+   public boolean handleFault(MessageContext msgContext)
+   {
+      boolean doNext = true;
+
+      if (handlers.size() > 0)
+      {
+         log.debug("Enter: handleFault");
+         
+         try
+         {
+            int handlerIndex = handlers.size() - 1;
+            if (falseIndex != -1)
+               handlerIndex = falseIndex;
+
+            Handler currHandler = null;
+            for (; doNext && handlerIndex >= 0; handlerIndex--)
+            {
+               currHandler = ((HandlerEntry)handlers.get(handlerIndex)).getHandler();
+               log.debug("Handle fault: " + currHandler);
+               doNext = currHandler.handleFault(msgContext);
+            }
+         }
+         finally
+         {
+            log.debug("Exit: handleFault with status: " + doNext);
+         }
+      }
+
+      return doNext;
+   }
+
+   /**
+    * Trace the SOAPPart, do nothing if the String representation is equal to the last one.
+    */
+   protected String traceSOAPPart(SOAPPart soapPart, String lastMessageTrace)
+   {
+      try
+      {
+         SOAPEnvelopeImpl soapEnv = (SOAPEnvelopeImpl)soapPart.getEnvelope();
+         String envString = DOMWriter.printNode(soapEnv, true);
+         if (envString.equals(lastMessageTrace) == false)
+         {
+            log.debug(envString);
+            lastMessageTrace = envString;
+         }
+         return lastMessageTrace;
+      }
+      catch (SOAPException e)
+      {
+         log.error("Cannot get SOAPEnvelope", e);
+         return null;
+      }
+   }
+
+   /**
+    * Replace handlers that did not survive the previous call
+    */
+   protected void replaceDirtyHandlers()
+   {
+      for (int i = 0; i < handlers.size(); i++)
+      {
+         HandlerEntry entry = (HandlerEntry)handlers.get(i);
+         if (entry.handler.getState() == HandlerWrapper.DOES_NOT_EXIST)
+         {
+            log.debug("Replacing dirty handler: " + entry.handler);
+            try
+            {
+               HandlerWrapper handler = new HandlerWrapper((Handler)entry.info.getHandlerClass().newInstance());
+               entry.handler = handler;
+               handler.init(entry.info);
+            }
+            catch (RuntimeException rte)
+            {
+               throw rte;
+            }
+            catch (Exception ex)
+            {
+               log.error("Cannot create handler instance for: " + entry.info, ex);
+            }
+         }
+      }
+   }
+
+   /**
+    * Get the handler at the requested position
+    */
+   protected Handler getHandlerAt(int pos)
+   {
+      if (pos < 0 || handlers.size() <= pos)
+         throw new IllegalArgumentException("No handler at position: " + pos);
+
+      HandlerEntry entry = (HandlerEntry)handlers.get(pos);
+      return entry.handler;
+   }
+
+   /**
+    * R1027 A RECEIVER MUST generate a "soap:MustUnderstand" fault when a
+    * message contains a mandatory header block (i.e., one that has a
+    * soap:mustUnderstand attribute with the value "1") targeted at the
+    * receiver (via soap:actor) that the receiver does not understand.
+    */
+   public static void checkMustUnderstand(SOAPMessageContextJAXRPC msgContext, String[] roles)
+   {
+      SOAPHeaderElement mustUnderstandHeaderElement = null;
+      List roleList = (roles != null ? Arrays.asList(roles) : new ArrayList());
+      try
+      {
+         SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
+         
+         // A SOAPHeaderElement is possibly bound to the endpoint operation
+         // in order to check that we need a the opMetaData
+         OperationMetaData opMetaData = msgContext.getOperationMetaData();
+         if (opMetaData == null)
+         {
+            // The security handler must have decrypted the incomming message
+            // before the dispatch target operation can be known 
+            EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
+            opMetaData = soapMessage.getOperationMetaData(epMetaData);
+         }         
+         
+         SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
+         if (soapEnvelope != null && soapEnvelope.getHeader() != null)
+         {
+            Iterator it = soapEnvelope.getHeader().examineAllHeaderElements();
+            while (it.hasNext() && mustUnderstandHeaderElement == null)
+            {
+               SOAPHeaderElement soapHeaderElement = (SOAPHeaderElement)it.next();
+               Name name = soapHeaderElement.getElementName();
+               QName xmlName = new QName(name.getURI(), name.getLocalName());
+               
+               ParameterMetaData paramMetaData = (opMetaData != null ? opMetaData.getParameter(xmlName) : null);
+               boolean isBoundHeader = (paramMetaData != null && paramMetaData.isInHeader());
+               
+               if (soapHeaderElement.getMustUnderstand() && isBoundHeader == false)
+               {
+                  String actor = soapHeaderElement.getActor();
+                  boolean noActor = (actor == null || actor.length() == 0);
+                  boolean nextActor = Constants.URI_SOAP11_NEXT_ACTOR.equals(actor);
+                  if (noActor || nextActor || roleList.contains(actor))
+                  {
+                     mustUnderstandHeaderElement = soapHeaderElement;
+                  }
+               }
+            }
+         }
+      }
+      catch (SOAPException ex)
+      {
+         log.error("Cannot check mustUnderstand for headers", ex);
+      }
+
+      if (mustUnderstandHeaderElement != null)
+      {
+         QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
+         String faultString = "Unprocessed 'mustUnderstand' header element: " + mustUnderstandHeaderElement.getElementName();
+         throw new SOAPFaultException(faultCode, faultString, null, null);
+      }
+   }
+
+   /**
+    * An entry in the handler list
+    */
+   private class HandlerEntry
+   {
+      private HandlerWrapper handler;
+      private HandlerInfo info;
+
+      public HandlerEntry(HandlerWrapper handler, HandlerInfo info)
+      {
+         this.handler = handler;
+         this.info = info;
+      }
+
+      public Handler getHandler()
+      {
+         return handler;
+      }
+
+      public HandlerInfo getInfo()
+      {
+         return info;
+      }
+   }
+
+   // java.util.List interface ****************************************************************************************
+
+   public boolean remove(Object o)
+   {
+      return handlers.remove(o);
+   }
+
+   public boolean containsAll(Collection c)
+   {
+      return handlers.containsAll(c);
+   }
+
+   public boolean removeAll(Collection c)
+   {
+      return handlers.removeAll(c);
+   }
+
+   public boolean retainAll(Collection c)
+   {
+      return handlers.retainAll(c);
+   }
+
+   public int hashCode()
+   {
+      return handlers.hashCode();
+   }
+
+   public boolean equals(Object o)
+   {
+      return handlers.equals(o);
+   }
+
+   public Iterator iterator()
+   {
+      return handlers.iterator();
+   }
+
+   public List subList(int fromIndex, int toIndex)
+   {
+      return handlers.subList(fromIndex, toIndex);
+   }
+
+   public ListIterator listIterator()
+   {
+      return handlers.listIterator();
+   }
+
+   public ListIterator listIterator(int index)
+   {
+      return handlers.listIterator(index);
+   }
+
+   public int size()
+   {
+      return handlers.size();
+   }
+
+   public void clear()
+   {
+      handlers.clear();
+   }
+
+   public boolean isEmpty()
+   {
+      return handlers.isEmpty();
+   }
+
+   public Object[] toArray()
+   {
+      return handlers.toArray();
+   }
+
+   public Object get(int index)
+   {
+      return handlers.get(index);
+   }
+
+   public Object remove(int index)
+   {
+      return handlers.remove(index);
+   }
+
+   public void add(int index, Object element)
+   {
+      handlers.add(index, (HandlerEntry)element);
+   }
+
+   public int indexOf(Object elem)
+   {
+      return handlers.indexOf(elem);
+   }
+
+   public int lastIndexOf(Object elem)
+   {
+      return handlers.lastIndexOf(elem);
+   }
+
+   public boolean add(Object o)
+   {
+      return handlers.add((HandlerEntry)o);
+   }
+
+   public boolean contains(Object elem)
+   {
+      return handlers.contains(elem);
+   }
+
+   public boolean addAll(int index, Collection c)
+   {
+      return handlers.addAll(index, c);
+   }
+
+   public boolean addAll(Collection c)
+   {
+      return handlers.addAll(c);
+   }
+
+   public Object set(int index, Object element)
+   {
+      return handlers.set(index, (HandlerEntry)element);
+   }
+
+   public Object[] toArray(Object[] a)
+   {
+      return handlers.toArray(a);
+   }
+}


Property changes on: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerChainBaseImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Copied: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerWrapper.java (from rev 643, trunk/src/main/java/org/jboss/ws/handler/HandlerWrapper.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/handler/HandlerWrapper.java	2006-07-30 12:25:17 UTC (rev 643)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerWrapper.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -0,0 +1,201 @@
+/*
+* 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.handler;
+
+// $Id$
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.JAXRPCException;
+import javax.xml.rpc.handler.Handler;
+import javax.xml.rpc.handler.HandlerInfo;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.soap.SOAPFaultException;
+
+import org.jboss.logging.Logger;
+
+/**
+ * A wrapper arround a {@link javax.xml.rpc.handler.Handler} that takes care of its lifecycle.
+ *
+ * @author thomas.diesler at jboss.org
+ */
+public class HandlerWrapper implements Handler
+{
+   private static Logger log = Logger.getLogger(HandlerWrapper.class);
+
+   public final static int DOES_NOT_EXIST = 0;
+   public final static int METHOD_READY = 1;
+
+   // The states as string
+   private static String[] stateNames = new String[]{"DOES_NOT_EXIST", "METHOD_READY"};
+
+   // The handler to delegate to
+   private Handler delegate;
+   // The handler state
+   private int state;
+
+   /**
+    * Delegate to the given handler
+    */
+   public HandlerWrapper(Handler handler)
+   {
+      delegate = handler;
+      state = DOES_NOT_EXIST; // this is somewhat a lie ;-)
+   }
+
+   /**
+    * Get the current state
+    */
+   public int getState()
+   {
+      return state;
+   }
+
+   /**
+    * Get the current state as string
+    */
+   public String getStateAsString()
+   {
+      return stateNames[state];
+   }
+
+   /**
+    * Gets the header blocks processed by this Handler instance.
+    */
+   public QName[] getHeaders()
+   {
+      return delegate.getHeaders();
+   }
+
+   /**
+    * The init method enables the Handler instance to initialize itself.
+    */
+   public void init(HandlerInfo config) throws JAXRPCException
+   {
+      log.debug("init: " + delegate);
+      delegate.init(config);
+      state = METHOD_READY;
+   }
+
+   /**
+    * The destroy method indicates the end of lifecycle for a Handler instance.
+    */
+   public void destroy() throws JAXRPCException
+   {
+      log.debug("destroy: " + delegate);
+      state = DOES_NOT_EXIST;
+      delegate.destroy();
+   }
+
+   /**
+    * The handleRequest method processes the request message.
+    */
+   public boolean handleRequest(MessageContext msgContext) throws JAXRPCException, SOAPFaultException
+   {
+      if (state == DOES_NOT_EXIST)
+      {
+         log.warn("Handler is in state DOES_NOT_EXIST, skipping Handler.handleRequest for: " + delegate);
+         return true;
+      }
+
+      try
+      {
+         return delegate.handleRequest(msgContext);
+      }
+      catch (RuntimeException e)
+      {
+         return handleRuntimeException(e);
+      }
+   }
+
+   /**
+    * The handleResponse method processes the response SOAP message.
+    */
+   public boolean handleResponse(MessageContext msgContext)
+   {
+      if (state == DOES_NOT_EXIST)
+      {
+         log.warn("Handler is in state DOES_NOT_EXIST, skipping Handler.handleResponse for: " + delegate);
+         return true;
+      }
+
+      try
+      {
+         return delegate.handleResponse(msgContext);
+      }
+      catch (RuntimeException e)
+      {
+         return handleRuntimeException(e);
+      }
+   }
+
+   /**
+    * The handleFault method processes the SOAP faults based on the SOAP message processing model.
+    */
+   public boolean handleFault(MessageContext msgContext)
+   {
+      if (state == DOES_NOT_EXIST)
+      {
+         log.warn("Handler is in state DOES_NOT_EXIST, skipping Handler.handleFault for: " + delegate);
+         return true;
+      }
+
+      try
+      {
+         return delegate.handleFault(msgContext);
+      }
+      catch (RuntimeException e)
+      {
+         return handleRuntimeException(e);
+      }
+   }
+
+   /**
+    * As defined by JAX-RPC, a RuntimeException(other than SOAPFaultException) thrown from any method of
+    * the Handler results in the destroymethod being invoked and transition to the �Does Not Exist� state.
+    */
+   private boolean handleRuntimeException(RuntimeException e)
+   {
+      if ((e instanceof SOAPFaultException) == false)
+      {
+         log.warn("RuntimeException in handler method, transition to DOES_NOT_EXIST");
+         destroy();
+      }
+
+      throw e;
+   }
+
+   /**
+    * Returns a hash code value for the object.
+    */
+   public int hashCode()
+   {
+      return delegate.hashCode();
+   }
+
+   /**
+    * Returns a string representation of the object.
+    */
+   public String toString()
+   {
+      return "[state=" + getStateAsString() + ",handler=" + delegate + "]";
+   }
+}


Property changes on: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerWrapper.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -0,0 +1,109 @@
+/*
+ * 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.handler;
+
+// $Id$
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.xml.rpc.handler.MessageContext;
+
+/**
+ * The message context that is processed by a handler
+ * in the handle method.
+ * <p/>
+ * Provides methods to manage a property set.
+ * MessageContext properties enable handlers in a handler chain to share
+ * processing related state.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 06-May-2004
+ */
+public class MessageContextJAXRPC implements MessageContext
+{
+   public static final String SERVLET_CONTEXT = "javax.xml.ws.servlet.context";
+   public static final String SERVLET_REQUEST = "javax.xml.ws.servlet.request";
+   public static final String SERVLET_RESPONSE = "javax.xml.ws.servlet.response";
+   public static final String SERVLET_SESSION = "javax.xml.ws.servlet.session";
+
+   // The map of the properties
+   private HashMap<String, Object> props = new HashMap<String, Object>();
+
+   /**
+    * Returns true if the MessageContext contains a property with the specified name.
+    *
+    * @param name Name of the property whose presense is to be tested
+    * @return Returns true if the MessageContext contains the property; otherwise false
+    */
+   public boolean containsProperty(String name)
+   {
+      return props.containsKey(name);
+   }
+
+   /**
+    * Gets the value of a specific property from the MessageContext
+    *
+    * @param name Name of the property whose value is to be retrieved
+    * @return Value of the property
+    * @throws IllegalArgumentException if an illegal property name is specified
+    */
+   public Object getProperty(String name)
+   {
+      return props.get(name);
+   }
+
+   /**
+    * Returns an Iterator view of the names of the properties in this MessageContext
+    *
+    * @return Iterator for the property names
+    */
+   public Iterator getPropertyNames()
+   {
+      return props.keySet().iterator();
+   }
+
+   /**
+    * Removes a property (name-value pair) from the MessageContext
+    *
+    * @param name Name of the property to be removed
+    * @throws IllegalArgumentException if an illegal property name is specified
+    */
+   public void removeProperty(String name)
+   {
+      props.remove(name);
+   }
+
+   /**
+    * Sets the name and value of a property associated with the MessageContext.
+    * If the MessageContext contains a value of the same property, the old value is replaced.
+    *
+    * @param name  Name of the property associated with the MessageContext
+    * @param value Value of the property
+    * @throws IllegalArgumentException      If some aspect of the property is prevents it from being stored in the context
+    * @throws UnsupportedOperationException If this method is not supported.
+    */
+   public void setProperty(String name, Object value)
+   {
+      props.put(name, value);
+   }
+}


Property changes on: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/SOAPMessageContextJAXRPC.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/handler/SOAPMessageContextJAXRPC.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/handler/SOAPMessageContextJAXRPC.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -0,0 +1,158 @@
+/*
+ * 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.handler;
+
+// $Id$
+
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.jaxrpc.SerializationContextJAXRPC;
+import org.jboss.ws.jaxws.SerializationContextJAXWS;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.EndpointMetaData.Type;
+import org.jboss.ws.soap.SOAPEnvelopeImpl;
+import org.jboss.xb.binding.NamespaceRegistry;
+
+/**
+ * Provides access to the SOAP message for either RPC request or response.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 14-Dec-2004
+ */
+public class SOAPMessageContextJAXRPC extends MessageContextJAXRPC implements SOAPMessageContext, SOAPMessageContextBase
+{
+   // The current SOAPMessage, maybe a request or response message
+   private SOAPMessage soapMessage;
+   // The operation for this message ctx
+   private EndpointMetaData epMetaData;
+   // The operation for this message ctx
+   private OperationMetaData opMetaData;
+   // The serialization context for this message ctx
+   private SerializationContext serContext;
+
+   /** Default constuctor
+    */
+   public SOAPMessageContextJAXRPC()
+   {
+   }
+
+   /** Gets the SOAPMessage from this message context
+    *
+    * @return Returns the SOAPMessage; returns null if no SOAPMessage is present in this message context
+    */
+   public SOAPMessage getMessage()
+   {
+      return soapMessage;
+   }
+
+   /** Sets the SOAPMessage in this message context
+    *
+    * @param message SOAP message
+    * @throws javax.xml.rpc.JAXRPCException If any error during the setting of the SOAPMessage in this message context
+    * @throws UnsupportedOperationException - If this operation is not supported
+    */
+   public void setMessage(SOAPMessage message)
+   {
+      this.soapMessage = message;
+   }
+
+   /**
+    * Gets the SOAP actor roles associated with an execution of the HandlerChain and its contained Handler instances.
+    * Note that SOAP actor roles apply to the SOAP node and are managed using HandlerChain.setRoles and HandlerChain.getRoles.
+    * Handler instances in the HandlerChain use this information about the SOAP actor roles to process the SOAP header blocks.
+    * Note that the SOAP actor roles are invariant during the processing of SOAP message through the HandlerChain.
+    *
+    * @return Array of URIs for SOAP actor roles
+    */
+   public String[] getRoles()
+   {
+      return new String[0];
+   }
+
+   public EndpointMetaData getEndpointMetaData()
+   {
+      if (epMetaData == null && opMetaData != null)
+         epMetaData = opMetaData.getEndpointMetaData();
+
+      return epMetaData;
+   }
+
+   public void setEndpointMetaData(EndpointMetaData epMetaData)
+   {
+      this.epMetaData = epMetaData;
+   }
+
+   public OperationMetaData getOperationMetaData()
+   {
+      return opMetaData;
+   }
+
+   public void setOperationMetaData(OperationMetaData opMetaData)
+   {
+      this.opMetaData = opMetaData;
+   }
+
+   /** Get or create the serialization context
+    */
+   public SerializationContext getSerializationContext()
+   {
+      if (serContext == null)
+      {
+         EndpointMetaData epMetaData = getEndpointMetaData();
+         ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
+
+         SerializationContextJAXRPC jaxrpcContext = new SerializationContextJAXRPC();
+         jaxrpcContext.setTypeMapping(serviceMetaData.getTypeMapping());
+         jaxrpcContext.setJavaWsdlMapping(serviceMetaData.getJavaWsdlMapping());
+         serContext = jaxrpcContext;
+      }
+
+      serContext.setNamespaceRegistry(getNamespaceRegistry());
+      return serContext;
+   }
+
+   /** Get the namespace registry from the current SOAPEnvelope
+    */
+   public NamespaceRegistry getNamespaceRegistry()
+   {
+      if (soapMessage == null)
+         throw new WSException("Cannot obtain NamespaceRegistry, because there is no SOAPMessage associated with this context");
+
+      try
+      {
+         SOAPEnvelopeImpl soapEnv = (SOAPEnvelopeImpl)soapMessage.getSOAPPart().getEnvelope();
+         NamespaceRegistry nsRegistry = soapEnv.getNamespaceRegistry();
+         return nsRegistry;
+      }
+      catch (SOAPException e)
+      {
+         throw new WSException("Cannot get SOAPEnvelope: " + e);
+      }
+   }
+}


Property changes on: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/SOAPMessageContextJAXRPC.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Copied: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/ServerHandlerChain.java (from rev 643, trunk/src/main/java/org/jboss/ws/handler/ServerHandlerChain.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/handler/ServerHandlerChain.java	2006-07-30 12:25:17 UTC (rev 643)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/handler/ServerHandlerChain.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -0,0 +1,62 @@
+/*
+* 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.handler;
+
+// $Id$
+
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.rpc.handler.MessageContext;
+
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
+
+/**
+ * Represents a list of handlers. All elements in the
+ * HandlerChain are of the type javax.xml.rpc.handler.Handler.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 06-May-2004
+ */
+public class ServerHandlerChain extends HandlerChainBaseImpl
+{
+   // The required type of the handler
+   private HandlerType type;
+   
+   public ServerHandlerChain(List infos, Set roles, HandlerType type)
+   {
+      super(infos, roles);
+      this.type = type;
+   }
+
+   public boolean handleRequest(MessageContext msgContext)
+   {
+      boolean doNext = super.handleRequest(msgContext);
+      return doNext;
+   }
+
+   public boolean handleResponse(MessageContext msgContext)
+   {
+      boolean doNext = super.handleResponse(msgContext);
+      return doNext;
+   }
+}


Property changes on: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/ServerHandlerChain.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Deleted: trunk/src/main/java/org/jboss/ws/jaxws/JAXWSSerializationContext.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/JAXWSSerializationContext.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/jaxws/JAXWSSerializationContext.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -1,40 +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 org.jboss.logging.Logger;
-import org.jboss.ws.binding.SerializationContext;
-
-/**
- * The serialization context for JAXWS endpoints/clients
- * 
- * @author Thomas.Diesler at jboss.org
- * @since 03-Jul-2006
- */
-public class JAXWSSerializationContext extends SerializationContext
-{
-   // provide logging
-   private static final Logger log = Logger.getLogger(JAXWSSerializationContext.class);
-
-}

Copied: trunk/src/main/java/org/jboss/ws/jaxws/SerializationContextJAXWS.java (from rev 643, trunk/src/main/java/org/jboss/ws/jaxws/JAXWSSerializationContext.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/JAXWSSerializationContext.java	2006-07-30 12:25:17 UTC (rev 643)
+++ trunk/src/main/java/org/jboss/ws/jaxws/SerializationContextJAXWS.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -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.jaxws;
+
+// $Id$
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.binding.SerializationContext;
+
+/**
+ * The serialization context for JAXWS endpoints/clients
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 03-Jul-2006
+ */
+public class SerializationContextJAXWS extends SerializationContext
+{
+   // provide logging
+   private static final Logger log = Logger.getLogger(SerializationContextJAXWS.class);
+
+}

Modified: trunk/src/main/java/org/jboss/ws/jaxws/client/JAXWSClient.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/client/JAXWSClient.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/jaxws/client/JAXWSClient.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -30,9 +30,10 @@
 import javax.xml.ws.Binding;
 import javax.xml.ws.BindingProvider;
 
-import org.jboss.ws.client.CommonClient;
+import org.jboss.ws.common.CommonClient;
+import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
 import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
+import org.jboss.ws.soap.MessageContextAssociation;
 
 /** 
  * Provides support for the dynamic invocation of a service endpoint.
@@ -51,19 +52,23 @@
    }
 
    @Override
-   protected boolean callRequestHandlerChain(QName portName, SOAPMessageContextImpl msgContext)
+   protected boolean callRequestHandlerChain(QName portName)
    {
       return true;
    }
 
    @Override
-   protected boolean callResponseHandlerChain(QName portName, SOAPMessageContextImpl msgContext)
+   protected boolean callResponseHandlerChain(QName portName)
    {
       return true;
    }
 
    public Object invoke(QName opName, Object[] args) throws RemoteException
    {
+      // Associate a message context with the current thread
+      SOAPMessageContextJAXWS msgContext = new SOAPMessageContextJAXWS();
+      MessageContextAssociation.pushMessageContext(msgContext);
+      
       Object retObj = invoke(opName, args, null, false);
       return retObj;
    }

Deleted: trunk/src/main/java/org/jboss/ws/jaxws/handler/MessageContextImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/handler/MessageContextImpl.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/jaxws/handler/MessageContextImpl.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -1,121 +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.handler;
-
-// $Id: MessageContextImpl.java 275 2006-05-04 21:36:29Z jason.greene at jboss.com $
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.ws.handler.MessageContext;
-
-
-/**
- * The interface MessageContext abstracts the message context that is processed by a handler in the handle  method.
- * 
- * The MessageContext interface provides methods to manage a property set. 
- * MessageContext properties enable handlers in a handler chain to share processing related state.
- * 
- * @author Thomas.Diesler at jboss.org
- * @since 25-Jul-2006
- */
-public class MessageContextImpl implements MessageContext
-{
-   // The map of the properties
-   private HashMap<String, Object> props = new HashMap<String, Object>();
-   // The map of property scopes
-   private HashMap<String, Scope> scopes = new HashMap<String, Scope>();
-
-   /** Sets the scope of a property. */
-   public void setScope(String key, Scope scope)
-   {
-      scopes.put(key, scope);
-   }
-
-   /** Gets the scope of a property. */
-   public Scope getScope(String key)
-   {
-      return scopes.get(key);
-   }
-
-   public int size()
-   {
-      return props.size();
-   }
-
-   public boolean isEmpty()
-   {
-      return props.isEmpty();
-   }
-
-   public boolean containsKey(Object key)
-   {
-      return props.containsKey(key);
-   }
-
-   public boolean containsValue(Object value)
-   {
-      return props.containsValue(value);
-   }
-
-   public Object get(Object key)
-   {
-      return props.get(key);
-   }
-
-   public Object put(String key, Object value)
-   {
-      return props.put(key, value);
-   }
-
-   public Object remove(Object key)
-   {
-      return props.remove(key);
-   }
-
-   public void putAll(Map<? extends String, ? extends Object> srcMap)
-   {
-      props.putAll(srcMap);
-   }
-
-   public void clear()
-   {
-      props.clear();
-   }
-
-   public Set<String> keySet()
-   {
-      return props.keySet();
-   }
-
-   public Collection<Object> values()
-   {
-      return props.values();
-   }
-
-   public Set<Entry<String, Object>> entrySet()
-   {
-      return props.entrySet();
-   }
-}

Copied: trunk/src/main/java/org/jboss/ws/jaxws/handler/MessageContextJAXWS.java (from rev 643, trunk/src/main/java/org/jboss/ws/jaxws/handler/MessageContextImpl.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/handler/MessageContextImpl.java	2006-07-30 12:25:17 UTC (rev 643)
+++ trunk/src/main/java/org/jboss/ws/jaxws/handler/MessageContextJAXWS.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -0,0 +1,121 @@
+/*
+ * 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.handler;
+
+// $Id: MessageContextImpl.java 275 2006-05-04 21:36:29Z jason.greene at jboss.com $
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.ws.handler.MessageContext;
+
+
+/**
+ * The interface MessageContext abstracts the message context that is processed by a handler in the handle  method.
+ * 
+ * The MessageContext interface provides methods to manage a property set. 
+ * MessageContext properties enable handlers in a handler chain to share processing related state.
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Jul-2006
+ */
+public class MessageContextJAXWS implements MessageContext
+{
+   // The map of the properties
+   private HashMap<String, Object> props = new HashMap<String, Object>();
+   // The map of property scopes
+   private HashMap<String, Scope> scopes = new HashMap<String, Scope>();
+
+   /** Sets the scope of a property. */
+   public void setScope(String key, Scope scope)
+   {
+      scopes.put(key, scope);
+   }
+
+   /** Gets the scope of a property. */
+   public Scope getScope(String key)
+   {
+      return scopes.get(key);
+   }
+
+   public int size()
+   {
+      return props.size();
+   }
+
+   public boolean isEmpty()
+   {
+      return props.isEmpty();
+   }
+
+   public boolean containsKey(Object key)
+   {
+      return props.containsKey(key);
+   }
+
+   public boolean containsValue(Object value)
+   {
+      return props.containsValue(value);
+   }
+
+   public Object get(Object key)
+   {
+      return props.get(key);
+   }
+
+   public Object put(String key, Object value)
+   {
+      return props.put(key, value);
+   }
+
+   public Object remove(Object key)
+   {
+      return props.remove(key);
+   }
+
+   public void putAll(Map<? extends String, ? extends Object> srcMap)
+   {
+      props.putAll(srcMap);
+   }
+
+   public void clear()
+   {
+      props.clear();
+   }
+
+   public Set<String> keySet()
+   {
+      return props.keySet();
+   }
+
+   public Collection<Object> values()
+   {
+      return props.values();
+   }
+
+   public Set<Entry<String, Object>> entrySet()
+   {
+      return props.entrySet();
+   }
+}

Deleted: trunk/src/main/java/org/jboss/ws/jaxws/handler/SOAPMessageContextImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/handler/SOAPMessageContextImpl.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/jaxws/handler/SOAPMessageContextImpl.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -1,142 +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.handler;
-
-// $Id: MessageContextImpl.java 275 2006-05-04 21:36:29Z jason.greene at jboss.com $
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.namespace.QName;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPHeaderElement;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-/**
- * The interface SOAPMessageContext provides access to the SOAP message for either RPC request or response. 
- * The javax.xml.soap.SOAPMessage specifies the standard Java API for the representation of a SOAP 1.1 message with attachments.
- * 
- * @author Thomas.Diesler at jboss.org
- * @since 25-Jul-2006
- */
-public class SOAPMessageContextImpl extends MessageContextImpl implements SOAPMessageContext
-{
-   // The SOAPMessage in this message context
-   private SOAPMessage soapMessage;
-   // The SOAP actor roles 
-   private Set<URI> roles = new HashSet<URI>();
-
-   /** Default ctor */
-   public SOAPMessageContextImpl()
-   {
-   }
-
-   /** SOAP actor roles are invariant during the processing of SOAP message through the handler chain. */
-   public SOAPMessageContextImpl(Set<URI> roles)
-   {
-      if (roles != null)
-         this.roles = roles;
-   }
-
-   /**
-    * Gets the SOAPMessage from this message context. 
-    * Modifications to the returned SOAPMessage change the message in-place, there is no need to susequently call setMessage.
-    */
-   public SOAPMessage getMessage()
-   {
-      return soapMessage;
-   }
-
-   /**
-    * Sets the SOAPMessage in this message context
-    */
-   public void setMessage(SOAPMessage soapMessage)
-   {
-      this.soapMessage = soapMessage;
-   }
-
-   /** 
-    * Gets headers that have a particular qualified name from the message in the message context. 
-    * Note that a SOAP message can contain multiple headers with the same qualified name.
-    */
-   public Object[] getHeaders(QName qname, JAXBContext context, boolean allRoles)
-   {
-      List<Object> headers = new ArrayList<Object>();
-
-      if (soapMessage != null)
-      {
-         try
-         {
-            SOAPHeader soapHeader = soapMessage.getSOAPHeader();
-            Iterator<SOAPHeaderElement> headerElements = soapHeader.examineAllHeaderElements();
-            while (headerElements.hasNext())
-            {
-               SOAPHeaderElement hElement = headerElements.next();
-               Name hName = hElement.getElementName();
-               if (qname.equals(new QName(hName.getURI(), hName.getLocalName())))
-               {
-                  URI actor = new URI(hElement.getActor());
-                  if (roles.contains(actor) || allRoles)
-                  {
-                     headers.add(hElement);
-
-                     // FIXME
-                     // SOAPMessageContext.getHeaders should return unmarshalled objects
-                     // http://jira.jboss.org/jira/browse/JBWS-1105
-                  }
-               }
-            }
-         }
-         catch (RuntimeException rte)
-         {
-            throw rte;
-         }
-         catch (Exception ex)
-         {
-            throw new WebServiceException("Cannot get headers", ex);
-         }
-      }
-
-      Object[] arr = new Object[headers.size()];
-      headers.toArray(arr);
-      return arr;
-   }
-
-   /**
-    * Gets the SOAP actor roles associated with an execution of the handler chain. 
-    * Note that SOAP actor roles apply to the SOAP node and are managed using SOAPBinding.setRoles and SOAPBinding.getRoles. 
-    * Handler instances in the handler chain use this information about the SOAP actor roles to process the SOAP header blocks. 
-    * Note that the SOAP actor roles are invariant during the processing of SOAP message through the handler chain.
-    */
-   public Set<URI> getRoles()
-   {
-      return roles;
-   }
-}

Copied: trunk/src/main/java/org/jboss/ws/jaxws/handler/SOAPMessageContextJAXWS.java (from rev 643, trunk/src/main/java/org/jboss/ws/jaxws/handler/SOAPMessageContextImpl.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/handler/SOAPMessageContextImpl.java	2006-07-30 12:25:17 UTC (rev 643)
+++ trunk/src/main/java/org/jboss/ws/jaxws/handler/SOAPMessageContextJAXWS.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -0,0 +1,246 @@
+/*
+ * 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.handler;
+
+// $Id: MessageContextImpl.java 275 2006-05-04 21:36:29Z jason.greene at jboss.com $
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.binding.SerializationContext;
+import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.jaxrpc.SerializationContextJAXRPC;
+import org.jboss.ws.jaxws.SerializationContextJAXWS;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.EndpointMetaData.Type;
+import org.jboss.ws.soap.SOAPEnvelopeImpl;
+import org.jboss.xb.binding.NamespaceRegistry;
+
+/**
+ * The interface SOAPMessageContext provides access to the SOAP message for either RPC request or response. 
+ * The javax.xml.soap.SOAPMessage specifies the standard Java API for the representation of a SOAP 1.1 message with attachments.
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Jul-2006
+ */
+public class SOAPMessageContextJAXWS extends MessageContextJAXWS implements SOAPMessageContext, SOAPMessageContextBase
+{
+   // The SOAPMessage in this message context
+   private SOAPMessage soapMessage;
+   // The operation for this message ctx
+   private EndpointMetaData epMetaData;
+   // The operation for this message ctx
+   private OperationMetaData opMetaData;
+   // The SOAP actor roles 
+   private Set<URI> roles = new HashSet<URI>();
+   // The serialization context for this message ctx
+   private SerializationContext serContext;
+
+   /** Default ctor */
+   public SOAPMessageContextJAXWS()
+   {
+   }
+
+   /** SOAP actor roles are invariant during the processing of SOAP message through the handler chain. */
+   public SOAPMessageContextJAXWS(Set<URI> roles)
+   {
+      if (roles != null)
+         this.roles = roles;
+   }
+
+   /**
+    * Gets the SOAPMessage from this message context. 
+    * Modifications to the returned SOAPMessage change the message in-place, there is no need to susequently call setMessage.
+    */
+   public SOAPMessage getMessage()
+   {
+      return soapMessage;
+   }
+
+   /**
+    * Sets the SOAPMessage in this message context
+    */
+   public void setMessage(SOAPMessage soapMessage)
+   {
+      this.soapMessage = soapMessage;
+   }
+
+   /** 
+    * Gets headers that have a particular qualified name from the message in the message context. 
+    * Note that a SOAP message can contain multiple headers with the same qualified name.
+    */
+   public Object[] getHeaders(QName qname, JAXBContext context, boolean allRoles)
+   {
+      List<Object> headers = new ArrayList<Object>();
+
+      if (soapMessage != null)
+      {
+         try
+         {
+            SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+            Iterator<SOAPHeaderElement> headerElements = soapHeader.examineAllHeaderElements();
+            while (headerElements.hasNext())
+            {
+               SOAPHeaderElement hElement = headerElements.next();
+               Name hName = hElement.getElementName();
+               if (qname.equals(new QName(hName.getURI(), hName.getLocalName())))
+               {
+                  URI actor = new URI(hElement.getActor());
+                  if (roles.contains(actor) || allRoles)
+                  {
+                     headers.add(hElement);
+
+                     // FIXME
+                     // SOAPMessageContext.getHeaders should return unmarshalled objects
+                     // http://jira.jboss.org/jira/browse/JBWS-1105
+                  }
+               }
+            }
+         }
+         catch (RuntimeException rte)
+         {
+            throw rte;
+         }
+         catch (Exception ex)
+         {
+            throw new WebServiceException("Cannot get headers", ex);
+         }
+      }
+
+      Object[] arr = new Object[headers.size()];
+      headers.toArray(arr);
+      return arr;
+   }
+
+   /**
+    * Gets the SOAP actor roles associated with an execution of the handler chain. 
+    * Note that SOAP actor roles apply to the SOAP node and are managed using SOAPBinding.setRoles and SOAPBinding.getRoles. 
+    * Handler instances in the handler chain use this information about the SOAP actor roles to process the SOAP header blocks. 
+    * Note that the SOAP actor roles are invariant during the processing of SOAP message through the handler chain.
+    */
+   public Set<URI> getRoles()
+   {
+      return roles;
+   }
+
+   public EndpointMetaData getEndpointMetaData()
+   {
+      if (epMetaData == null && opMetaData != null)
+         epMetaData = opMetaData.getEndpointMetaData();
+
+      return epMetaData;
+   }
+
+   public void setEndpointMetaData(EndpointMetaData epMetaData)
+   {
+      this.epMetaData = epMetaData;
+   }
+
+   public OperationMetaData getOperationMetaData()
+   {
+      return opMetaData;
+   }
+
+   public void setOperationMetaData(OperationMetaData opMetaData)
+   {
+      this.opMetaData = opMetaData;
+   }
+
+   /** Get or create the serialization context
+    */
+   public SerializationContext getSerializationContext()
+   {
+      if (serContext == null)
+      {
+         EndpointMetaData epMetaData = getEndpointMetaData();
+         ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
+
+         SerializationContextJAXWS jaxwsContext = new SerializationContextJAXWS();
+         jaxwsContext.setTypeMapping(serviceMetaData.getTypeMapping());
+         serContext = jaxwsContext;
+      }
+
+      serContext.setNamespaceRegistry(getNamespaceRegistry());
+      return serContext;
+   }
+
+   /** Get the namespace registry from the current SOAPEnvelope
+    */
+   public NamespaceRegistry getNamespaceRegistry()
+   {
+      if (soapMessage == null)
+         throw new WSException("Cannot obtain NamespaceRegistry, because there is no SOAPMessage associated with this context");
+
+      try
+      {
+         SOAPEnvelopeImpl soapEnv = (SOAPEnvelopeImpl)soapMessage.getSOAPPart().getEnvelope();
+         NamespaceRegistry nsRegistry = soapEnv.getNamespaceRegistry();
+         return nsRegistry;
+      }
+      catch (SOAPException e)
+      {
+         throw new WSException("Cannot get SOAPEnvelope: " + e);
+      }
+   }
+   
+   public boolean containsProperty(String name)
+   {
+      return containsKey(name);
+   }
+
+   public Object getProperty(String name)
+   {
+      return get(name);
+   }
+
+   public Iterator getPropertyNames()
+   {
+      return keySet().iterator();
+   }
+
+   public void removeProperty(String name)
+   {
+      remove(name);
+   }
+
+   public void setProperty(String name, Object value)
+   {
+      put(name, value);
+   }
+}

Modified: trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializer.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializer.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBDeserializer.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -32,7 +32,7 @@
 import org.jboss.ws.binding.BindingException;
 import org.jboss.ws.binding.ComplexTypeDeserializer;
 import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.jaxrpc.JAXRPCSerializationContext;
+import org.jboss.ws.jaxrpc.SerializationContextJAXRPC;
 import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
 
 /**
@@ -73,7 +73,7 @@
       log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]");
 
       // Expect the specific JAXRPC serialization context
-      JAXRPCSerializationContext jaxrpcContext = (JAXRPCSerializationContext)serContext;
+      SerializationContextJAXRPC jaxrpcContext = (SerializationContextJAXRPC)serContext;
 
       Object value = null;
       String typeName = xmlType.getLocalPart();

Modified: trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializer.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializer.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSerializer.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -34,7 +34,7 @@
 import org.jboss.ws.binding.BindingException;
 import org.jboss.ws.binding.ComplexTypeSerializer;
 import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.jaxrpc.JAXRPCSerializationContext;
+import org.jboss.ws.jaxrpc.SerializationContextJAXRPC;
 import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
 import org.w3c.dom.NamedNodeMap;
 
@@ -78,7 +78,7 @@
       log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]");
 
       // Expect the specific JAXRPC serialization context
-      JAXRPCSerializationContext jaxrpcContext = (JAXRPCSerializationContext)serContext;
+      SerializationContextJAXRPC jaxrpcContext = (SerializationContextJAXRPC)serContext;
       
       try
       {

Modified: trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBUnmarshallerImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBUnmarshallerImpl.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBUnmarshallerImpl.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -29,13 +29,13 @@
 import javax.xml.namespace.QName;
 
 import org.jboss.ws.WSException;
+import org.jboss.ws.common.SOAPMessageContextBase;
 import org.jboss.ws.metadata.EndpointMetaData;
 import org.jboss.ws.metadata.OperationMetaData;
 import org.jboss.ws.metadata.ServiceMetaData;
 import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
 import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
 import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 import org.jboss.xb.binding.JBossXBException;
 import org.jboss.xb.binding.UnmarshallerFactory;
 import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
@@ -103,7 +103,7 @@
       QName xmlType = (QName)getProperty(JBossXBConstants.JBXB_TYPE_QNAME);
 
       // Get the eagerly initialized SchameBinding from the ServiceMetaData
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
       if (msgContext != null)
       {
          OperationMetaData opMetaData = msgContext.getOperationMetaData();

Modified: trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -369,6 +369,11 @@
       jaxrpcHandlers.add(handler);
    }
 
+   public void clearHandlers()
+   {
+      jaxrpcHandlers.clear();
+   }
+
    public List<UnifiedHandlerMetaData> getHandlers(HandlerType type)
    {
       if (type == HandlerType.PRE || type == HandlerType.POST)

Modified: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -38,7 +38,7 @@
 {
    private static final long serialVersionUID = 8000854586742278995L;
 
-   public enum HandlerType {PRE, JAXRPC, POST, ALL};
+   public enum HandlerType {PRE, JAXRPC, JAXWS, POST, ALL};
    
    // The required <handler-name> element
    private String handlerName;

Modified: trunk/src/main/java/org/jboss/ws/metadata/wsdl/NCName.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/wsdl/NCName.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/NCName.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -30,7 +30,7 @@
 
 /**
  * The value space of the wsdls:NCName type is the subset of the value space of the wsdls:Token type
- * consisting of tokens that do not contain the space (#x20) and ’:’ characters.
+ * consisting of tokens that do not contain the space (#x20) and ':' characters.
  *
  * @author Thomas.Diesler at jboss.org
  * @since 10-Oct-2004

Modified: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLImport.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLImport.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLImport.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -48,7 +48,7 @@
     * NOT match the actual value of the enclosing WSDL document targetNamespace attribute
     * information item. If the import statement results in the import of a WSDL document then the actual value
     * of the namespace attribute information item MUST be identical to the actual value of the imported
-    * WSDL document’s targetNamespace attribute information item. */
+    * WSDL document's targetNamespace attribute information item. */
    private String namespace;
 
    /** The OPTIONAL location attribute information item is of type xs:anyURI . Its actual value is the location of

Modified: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInfault.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInfault.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInfault.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -40,7 +40,7 @@
    private WSDLInterfaceOperation wsdlInterfaceOperation;
 
    /** A REQUIRED reference to an Interface Fault component in the {faults} property of the parent
-    * Interface Operation component’s parent Interface component. Identifying the Interface Fault
+    * Interface Operation component's parent Interface component. Identifying the Interface Fault
     * component therefore indirectly defines the actual content or payload of the fault message.
     */
    private QName ref;

Modified: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutfault.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutfault.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutfault.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -40,7 +40,7 @@
    private WSDLInterfaceOperation wsdlInterfaceOperation;
 
    /** A REQUIRED reference to an Interface Fault component in the {faults} property of the parent
-    * Interface Operation component’s parent Interface component. Identifying the Interface Fault
+    * Interface Operation component's parent Interface component. Identifying the Interface Fault
     * component therefore indirectly defines the actual content or payload of the fault message.
     */
    private QName ref;

Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -28,17 +28,9 @@
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.net.URL;
-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.HandlerInfo;
-import javax.xml.rpc.server.ServletEndpointContext;
 import javax.xml.rpc.soap.SOAPFaultException;
 import javax.xml.soap.MimeHeaders;
 import javax.xml.soap.SOAPEnvelope;
@@ -47,19 +39,16 @@
 import org.jboss.logging.Logger;
 import org.jboss.util.xml.DOMWriter;
 import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
 import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.handler.ServerHandlerChain;
+import org.jboss.ws.common.SOAPMessageContextBase;
 import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
 import org.jboss.ws.metadata.EndpointMetaData;
 import org.jboss.ws.metadata.ServerEndpointMetaData;
 import org.jboss.ws.metadata.UnifiedMetaData;
-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.soap.MessageContextAssociation;
 import org.jboss.ws.soap.MessageFactoryImpl;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 import org.jboss.ws.soap.SOAPMessageImpl;
 import org.w3c.dom.Document;
 
@@ -154,20 +143,26 @@
    /**
     * Handle a request to this web service endpoint
     */
-   public SOAPMessage handleRequest(HeaderSource headerSource, ServletEndpointContext context, InputStream inputStream) throws BindingException
+   public SOAPMessage handleRequest(HeaderSource headerSource, Object context, InputStream inputStream) throws BindingException
    {
       boolean popMessageContext = false;
 
       // Associate a message context with the current thread if the caller has not done so already
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+      ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
       if (msgContext == null)
       {
-         msgContext = new SOAPMessageContextImpl();
+         if (epMetaData.getType() == EndpointMetaData.Type.JAXRPC)
+         {
+            msgContext = new SOAPMessageContextJAXRPC();
+         }
+         else
+         {
+            msgContext = new SOAPMessageContextJAXWS();
+         }
          MessageContextAssociation.pushMessageContext(msgContext);
          popMessageContext = true;
       }
-
-      ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
       msgContext.setEndpointMetaData(epMetaData);
 
       long beginProcessing = 0;
@@ -185,14 +180,6 @@
          log.debug("BEGIN handleRequest: " + seInfo.getServiceEndpointID());
          beginProcessing = seMetrics.processRequestMessage();
 
-         // Initialize the handler chain
-         if (seInfo.getJaxRpcHandlerChain() == null)
-         {
-            initHandlerChain(HandlerType.PRE);
-            initHandlerChain(HandlerType.JAXRPC);
-            initHandlerChain(HandlerType.POST);
-         }
-
          MessageFactoryImpl msgFactory = new MessageFactoryImpl();
          msgFactory.setServiceMode(epMetaData.getServiceMode());
          msgFactory.setStyle(epMetaData.getStyle());
@@ -299,68 +286,6 @@
    }
 
    /**
-    * Init the handler chain
-    */
-   private void initHandlerChain(HandlerType type)
-   {
-      Set<String> handlerRoles = new HashSet<String>();
-      List<HandlerInfo> infos = 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);
-         infos.add(info);
-      }
-
-      initHandlerChain(infos, handlerRoles, type);
-   }
-
-   public void initHandlerChain(List<HandlerInfo> infos, Set<String> handlerRoles, HandlerType type)
-   {
-      log.debug("Init handler chain with [" + infos.size() + "] handlers");
-
-      ServerHandlerChain handlerChain = new ServerHandlerChain(infos, handlerRoles, type);
-      if (type == HandlerType.PRE)
-         seInfo.setPreHandlerChain(handlerChain);
-      else if (type == HandlerType.JAXRPC)
-         seInfo.setJaxRpcHandlerChain(handlerChain);
-      else if (type == HandlerType.POST)
-         seInfo.setPostHandlerChain(handlerChain);
-
-      if (handlerChain.getState() == ServerHandlerChain.STATE_CREATED)
-      {
-         // what is the config for a handler chain?
-         handlerChain.init(null);
-      }
-   }
-
-   /**
     * Returns a string representation of the object.
     */
    public String toString()

Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInfo.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInfo.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInfo.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -28,7 +28,6 @@
 import org.jboss.ws.WSException;
 import org.jboss.ws.deployment.UnifiedDeploymentInfo;
 import org.jboss.ws.deployment.UnifiedDeploymentInfo.DeploymentType;
-import org.jboss.ws.handler.ServerHandlerChain;
 import org.jboss.ws.metadata.ServerEndpointMetaData;
 import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
 import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
@@ -57,12 +56,6 @@
    private ServerEndpointMetaData sepMetaData;
    // The service endpoint invoker
    private ServiceEndpointInvoker seInvoker;
-   // This endpoints handler chain
-   private ServerHandlerChain preHandlerChain;
-   // This endpoints handler chain
-   private ServerHandlerChain jaxrpcHandlerChain;
-   // This endpoints handler chain
-   private ServerHandlerChain postHandlerChain;
    // The current state of the endpoint
    private ServiceEndpoint.State state;
 
@@ -125,36 +118,6 @@
       return type;
    }
 
-   public ServerHandlerChain getPreHandlerChain()
-   {
-      return preHandlerChain;
-   }
-
-   public void setPreHandlerChain(ServerHandlerChain preHandlerChain)
-   {
-      this.preHandlerChain = preHandlerChain;
-   }
-
-   public ServerHandlerChain getJaxRpcHandlerChain()
-   {
-      return jaxrpcHandlerChain;
-   }
-
-   public void setJaxRpcHandlerChain(ServerHandlerChain handlerChain)
-   {
-      this.jaxrpcHandlerChain = handlerChain;
-   }
-
-   public ServerHandlerChain getPostHandlerChain()
-   {
-      return postHandlerChain;
-   }
-
-   public void setPostHandlerChain(ServerHandlerChain postHandlerChain)
-   {
-      this.postHandlerChain = postHandlerChain;
-   }
-
    public ServiceEndpointInvoker getInvoker()
    {
       return seInvoker;

Deleted: trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInterceptor.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInterceptor.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInterceptor.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -1,41 +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 org.jboss.ejb.plugins.AbstractInterceptor;
-import org.jboss.invocation.Invocation;
-
-/**
- * Retained for backwrd compatibility with jboss-4.0.4.GA
- * 
- * @author Thomas.Diesler at jboss.org
- * @since 21-Sep-2005
- */
-public class ServiceEndpointInterceptor extends AbstractInterceptor
-{
-   public Object invoke(final Invocation mi) throws Exception
-   {
-      return getNext().invoke(mi);
-   }
-}

Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -23,305 +23,32 @@
 
 // $Id$
 
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import javax.management.MBeanException;
-import javax.management.ObjectName;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ServiceException;
-import javax.xml.rpc.handler.HandlerChain;
-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.binding.BindingProvider;
-import org.jboss.ws.binding.BindingProviderRegistry;
 import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.handler.HandlerChainBaseImpl;
-import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
-import org.jboss.ws.soap.SOAPMessageImpl;
-import org.jboss.ws.utils.JavaUtils;
 
 /** An implementation of handles invocations on the endpoint
  *
  * @author Thomas.Diesler at jboss.org
  * @since 19-Jan-2005
  */
-public abstract class ServiceEndpointInvoker
+public interface ServiceEndpointInvoker
 {
-   // provide logging
-   private static Logger log = Logger.getLogger(ServiceEndpointInvoker.class);
-
-   protected ObjectName objectName;
-
    /** Initialize the service endpoint */
-   public abstract void initServiceEndpoint(ServiceEndpointInfo seInfo) throws ServiceException;
+   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 abstract Class loadServiceEndpoint(ServiceEndpointInfo seInfo) throws ServiceException, ClassNotFoundException;
+   public Class loadServiceEndpoint(ServiceEndpointInfo seInfo) throws ClassNotFoundException;
 
    /** Create the instance of the SEI implementation bean if necessary */
-   public abstract Object createServiceEndpoint(ServiceEndpointInfo seInfo, Object endpointContext, Class seiImplClass) throws IllegalAccessException,
-         InstantiationException, ServiceException;
+   public Object createServiceEndpoint(ServiceEndpointInfo seInfo, Object context, Class seiImplClass) throws IllegalAccessException, InstantiationException;
 
-   /** Invoke the the service endpoint */
-   public SOAPMessage invoke(ServiceEndpointInfo seInfo, Object endpointContext) throws Exception
-   {
-      SOAPMessageContextImpl 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, endpointContext, 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 = 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
-      {
-         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();
-      Class[] paramTypes = seiMethod.getParameterTypes();
-      for (int i = 0; i < paramTypes.length; i++)
-      {
-         Class paramType = paramTypes[i];
-         if (JavaUtils.isPrimitive(paramType) == false)
-         {
-            String paramTypeName = paramType.getName();
-            paramType = JavaUtils.loadJavaType(paramTypeName);
-            paramTypes[i] = paramType;
-         }
-      }
-
-      Method implMethod = implClass.getMethod(methodName, paramTypes);
-      return implMethod;
-   }
-
-   protected boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
-   {
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
-
-      boolean status = true;
-      String[] roles = null;
-
-      HandlerChain handlerChain = null;
-      if (type == HandlerType.PRE)
-         handlerChain = seInfo.getPreHandlerChain();
-      else if (type == HandlerType.JAXRPC)
-         handlerChain = seInfo.getJaxRpcHandlerChain();
-      else if (type == HandlerType.POST)
-         handlerChain = seInfo.getPostHandlerChain();
-      
-      if (handlerChain != null)
-      {
-         roles = handlerChain.getRoles();
-         status = handlerChain.handleRequest(msgContext);
-      }
-
-      // BP-1.0 R1027
-      if (type == HandlerType.POST)
-         HandlerChainBaseImpl.checkMustUnderstand(msgContext, roles);
-      
-      return status;
-   }
-
-   protected boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
-   {
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
-      
-      HandlerChain handlerChain = null;
-      if (type == HandlerType.PRE)
-         handlerChain = seInfo.getPreHandlerChain();
-      else if (type == HandlerType.JAXRPC)
-         handlerChain = seInfo.getJaxRpcHandlerChain();
-      else if (type == HandlerType.POST)
-         handlerChain = seInfo.getPostHandlerChain();
-      
-      return (handlerChain != null ? handlerChain.handleResponse(msgContext) : true);
-   }
-
-   protected boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex)
-   {
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
-
-      HandlerChain handlerChain = null;
-      if (type == HandlerType.PRE)
-         handlerChain = seInfo.getPreHandlerChain();
-      else if (type == HandlerType.JAXRPC)
-         handlerChain = seInfo.getJaxRpcHandlerChain();
-      else if (type == HandlerType.POST)
-         handlerChain = seInfo.getPostHandlerChain();
-      
-      return (handlerChain != null ? handlerChain.handleFault(msgContext) : true);
-   }
-
    /** Invoke the instance of the SEI implementation bean */
-   public abstract void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl, EndpointInvocation epInv) throws SOAPFaultException;
+   public void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl, EndpointInvocation epInv);
 
    /** Destroy the instance of the SEI implementation bean if necessary */
-   public abstract void destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl);
-
-   /** handle invokation exceptions */
-   protected 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 void destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl);
 }

Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvokerJSE.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvokerJSE.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvokerJSE.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -1,24 +1,24 @@
 /*
-* 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.
-*/
+ * 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$
@@ -34,8 +34,6 @@
 import org.jboss.ws.WSException;
 import org.jboss.ws.binding.EndpointInvocation;
 import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.server.ServiceEndpointInfo;
-import org.jboss.ws.server.ServiceEndpointInvoker;
 
 /**
  * Handles invocations on JSE endpoints.
@@ -43,17 +41,11 @@
  * @author Thomas.Diesler at jboss.org
  * @since 19-Jan-2005
  */
-public class ServiceEndpointInvokerJSE extends ServiceEndpointInvoker
+public class ServiceEndpointInvokerJSE extends ServiceEndpointInvokerBase implements ServiceEndpointInvoker
 {
    // provide logging
    private Logger log = Logger.getLogger(ServiceEndpointInvokerJSE.class);
 
-   /** Initialize the service endpoint */
-   public void initServiceEndpoint(ServiceEndpointInfo seInfo) throws ServiceException
-   {
-      // nothing to do
-   }
-   
    /** Load the SEI implementation bean if necessary */
    public Class loadServiceEndpoint(ServiceEndpointInfo seInfo) throws ClassNotFoundException
    {
@@ -65,18 +57,24 @@
    }
 
    /** Create an instance of the SEI implementation bean if necessary */
-   public Object createServiceEndpoint(ServiceEndpointInfo seInfo, Object endpointContext, Class seiImplClass) throws IllegalAccessException,
-         InstantiationException, ServiceException
+   public Object createServiceEndpoint(ServiceEndpointInfo seInfo, Object sepContext, Class seiImplClass) throws IllegalAccessException, InstantiationException
    {
       Object seiImpl = seiImplClass.newInstance();
       if (seiImpl instanceof ServiceLifecycle)
       {
-         if ((endpointContext instanceof ServletEndpointContext) == false)
-            throw new WSException("Invalid endpoint context: " + endpointContext); 
-            
-         ServiceLifecycle serviceLifecycle = ((ServiceLifecycle)seiImpl);
-         ServletEndpointContext servletEndpointContext = (ServletEndpointContext)endpointContext;
-         serviceLifecycle.init(servletEndpointContext);
+         try
+         {
+            if ((sepContext instanceof ServletEndpointContext) == false)
+               throw new WSException("Invalid endpoint context: " + sepContext);
+
+            ServiceLifecycle serviceLifecycle = ((ServiceLifecycle)seiImpl);
+            ServletEndpointContext servletEndpointContext = (ServletEndpointContext)sepContext;
+            serviceLifecycle.init(servletEndpointContext);
+         }
+         catch (ServiceException ex)
+         {
+            throw new WSException(ex);
+         }
       }
       return seiImpl;
    }

Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -44,8 +44,6 @@
 import javax.management.MBeanServerFactory;
 import javax.management.ObjectName;
 import javax.servlet.http.HttpServletResponse;
-import javax.xml.rpc.handler.HandlerInfo;
-import javax.xml.rpc.handler.soap.SOAPMessageContext;
 import javax.xml.soap.SOAPEnvelope;
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPMessage;
@@ -56,13 +54,17 @@
 import org.jboss.logging.Logger;
 import org.jboss.ws.WSException;
 import org.jboss.ws.addressing.AddressingConstantsImpl;
-import org.jboss.ws.handler.MessageContextImpl;
-import org.jboss.ws.handler.ServerHandlerChain;
+import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.jaxrpc.handler.MessageContextJAXRPC;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.metadata.EndpointMetaData;
 import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.EndpointMetaData.Type;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
 import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
 import org.jboss.ws.soap.MessageContextAssociation;
 import org.jboss.ws.soap.SOAPConnectionImpl;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 import org.jboss.ws.utils.ThreadLocalAssociation;
 
 /**
@@ -329,30 +331,43 @@
 
    public void processSOAPRequest(ObjectName sepID, InputStream inStream, OutputStream outStream, Object context) throws Exception
    {
-      // Associate a message context with the current thread
-      SOAPMessageContextImpl msgContext = new SOAPMessageContextImpl();
-      MessageContextAssociation.pushMessageContext(msgContext);
+      ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
+      if (wsEndpoint == null)
+         throw new WSException("Cannot obtain endpoint for: " + sepID);
 
+      // Get the type of the endpoint
+      Type type = wsEndpoint.getServiceEndpointInfo().getServerEndpointMetaData().getType();
+
       ServletHeaderSource headerSource = null;
-      ServletEndpointContextImpl sepContext = null;
-      if (context instanceof ServletEndpointContextImpl)
+      HttpServletResponse httpResponse = null;
+      
+      // Associate a message context with the current thread
+      SOAPMessageContextBase msgContext;
+      if (type == EndpointMetaData.Type.JAXRPC)
       {
-         sepContext = (ServletEndpointContextImpl)context;
-         msgContext.setProperty(MessageContextImpl.SERVLET_CONTEXT, sepContext);
-         msgContext.setProperty(MessageContextImpl.SERVLET_REQUEST, sepContext.getHttpServletRequest());
-         msgContext.setProperty(MessageContextImpl.SERVLET_RESPONSE, sepContext.getHttpServletResponse());
-         msgContext.setProperty(MessageContextImpl.SERVLET_SESSION, sepContext.getHttpSession());
-
-         headerSource = new ServletHeaderSource(sepContext.getHttpServletRequest(), sepContext.getHttpServletResponse());
+         msgContext = new SOAPMessageContextJAXRPC();
+         if (context instanceof ServletEndpointContextImpl)
+         {
+            ServletEndpointContextImpl sepContext = (ServletEndpointContextImpl)context;
+            httpResponse = sepContext.getHttpServletResponse();
+            
+            msgContext.setProperty(MessageContextJAXRPC.SERVLET_CONTEXT, sepContext);
+            msgContext.setProperty(MessageContextJAXRPC.SERVLET_REQUEST, sepContext.getHttpServletRequest());
+            msgContext.setProperty(MessageContextJAXRPC.SERVLET_RESPONSE, httpResponse);
+            msgContext.setProperty(MessageContextJAXRPC.SERVLET_SESSION, sepContext.getHttpSession());
+            
+            headerSource = new ServletHeaderSource(sepContext.getHttpServletRequest(), httpResponse);
+         }
       }
+      else
+      {
+         msgContext = new SOAPMessageContextJAXWS();
+      }
+      MessageContextAssociation.pushMessageContext(msgContext);
 
       try
       {
-         ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
-         if (wsEndpoint == null)
-            throw new WSException("Cannot obtain endpoint for: " + sepID);
-
-         SOAPMessage resMessage = wsEndpoint.handleRequest(headerSource, sepContext, inStream);
+         SOAPMessage resMessage = wsEndpoint.handleRequest(headerSource, context, inStream);
          SOAPPart part = resMessage.getSOAPPart();
          if (part == null)
             throw new SOAPException("Cannot obtain SOAPPart from response message");
@@ -364,9 +379,9 @@
          // by a null envelope.
          SOAPEnvelope soapEnv = part.getEnvelope();
          boolean isFault = soapEnv != null && soapEnv.getBody().getFault() != null;
-         if (isFault)
+         if (isFault && httpResponse != null)
          {
-            sepContext.getHttpServletResponse().setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+            httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
          }
 
          sendResponse(outStream, msgContext, isFault);
@@ -384,7 +399,7 @@
       }
    }
 
-   private void sendResponse(OutputStream outputStream, SOAPMessageContext msgContext, boolean isFault) throws SOAPException, IOException
+   private void sendResponse(OutputStream outputStream, SOAPMessageContextBase msgContext, boolean isFault) throws SOAPException, IOException
    {
       SOAPMessage soapMessage = msgContext.getMessage();
       String wsaTo = null;
@@ -460,35 +475,42 @@
 
    /** Get the list of HandlerInfos associated with a given service endpoint
     */
-   public List<HandlerInfo> getHandlerInfos(ObjectName sepID)
+   public List<UnifiedHandlerMetaData> getHandlerMetaData(ObjectName sepID)
    {
       ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
       if (wsEndpoint == null)
          throw new WSException("Cannot find service endpoint: " + sepID);
 
-      List<HandlerInfo> handlerInfos = null;
+      List<UnifiedHandlerMetaData> handlers = null;
       if (wsEndpoint != null)
       {
-         ServerHandlerChain handlerChain = wsEndpoint.getServiceEndpointInfo().getJaxRpcHandlerChain();
-         handlerInfos = handlerChain.getHandlerInfos();
+         ServerEndpointMetaData sepMetaData = wsEndpoint.getServiceEndpointInfo().getServerEndpointMetaData();
+         handlers = sepMetaData.getHandlers(HandlerType.ALL);
       }
-      return handlerInfos;
+      return handlers;
    }
 
    /**
     * Dynamically change the list of handlers associated with a given service endpoint
     * The endpoint is expected to be in STOPED state
     */
-   public void setHandlerInfos(ObjectName sepID, List<HandlerInfo> infos)
+   public void setHandlerMetaData(ObjectName sepID, List<UnifiedHandlerMetaData> handlers)
    {
       ServiceEndpoint wsEndpoint = getServiceEndpointByID(sepID);
       if (wsEndpoint == null)
          throw new WSException("Cannot find service endpoint: " + sepID);
 
-      if (wsEndpoint.getServiceEndpointInfo().getState() != ServiceEndpoint.State.STOPED)
+      ServiceEndpointInfo sepInfo = wsEndpoint.getServiceEndpointInfo();
+      if (sepInfo.getState() != ServiceEndpoint.State.STOPED)
          throw new WSException("Endpoint expected to be in STOPED state");
 
-      wsEndpoint.initHandlerChain(infos, null, HandlerType.JAXRPC);
+      ServerEndpointMetaData sepMetaData = wsEndpoint.getServiceEndpointInfo().getServerEndpointMetaData();
+      
+      sepMetaData.clearHandlers();
+      for (UnifiedHandlerMetaData handlerMetaData : handlers)
+      {
+         sepMetaData.addHandler(handlerMetaData);
+      }
    }
 
    /** Create a service endpoint

Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerMBean.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerMBean.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerMBean.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -24,8 +24,8 @@
 import java.util.List;
 
 import javax.management.ObjectName;
-import javax.xml.rpc.handler.HandlerInfo;
 
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
 import org.jboss.ws.utils.ObjectNameFactory;
 
 /**
@@ -49,8 +49,8 @@
    boolean isAlwaysModifySOAPAddress();
    void setAlwaysModifySOAPAddress(boolean modify);
 
-   List<HandlerInfo> getHandlerInfos(ObjectName sepID);
-   void setHandlerInfos(ObjectName sepID, List<HandlerInfo> infos);
+   public List<UnifiedHandlerMetaData> getHandlerMetaData(ObjectName sepID);
+   public void setHandlerMetaData(ObjectName sepID, List<UnifiedHandlerMetaData> handlers);
 
    void startServiceEndpoint(ObjectName sepID) throws Exception;
    void stopServiceEndpoint(ObjectName sepID) throws Exception;

Modified: trunk/src/main/java/org/jboss/ws/server/ServletEndpointContextImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServletEndpointContextImpl.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/server/ServletEndpointContextImpl.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -59,7 +59,7 @@
 
    public MessageContext getMessageContext()
    {
-      return MessageContextAssociation.peekMessageContext();
+      return (MessageContext)MessageContextAssociation.peekMessageContext();
    }
 
    public ServletContext getServletContext()

Modified: trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -26,6 +26,7 @@
 import java.util.Stack;
 
 import org.jboss.logging.Logger;
+import org.jboss.ws.common.SOAPMessageContextBase;
 import org.jboss.ws.utils.ThreadLocalAssociation;
 
 /**
@@ -39,10 +40,10 @@
    // provide logging
    private static Logger log = Logger.getLogger(MessageContextAssociation.class);
   
-   public static SOAPMessageContextImpl popMessageContext()
+   public static SOAPMessageContextBase popMessageContext()
    {
-      SOAPMessageContextImpl msgContext = null;
-      Stack<SOAPMessageContextImpl> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
+      SOAPMessageContextBase msgContext = null;
+      Stack<SOAPMessageContextBase> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
       if (stack != null && stack.isEmpty() == false)
       {
          msgContext = stack.pop();
@@ -51,10 +52,10 @@
       return msgContext;
    }
 
-   public static SOAPMessageContextImpl peekMessageContext()
+   public static SOAPMessageContextBase peekMessageContext()
    {
-      SOAPMessageContextImpl msgContext = null;
-      Stack<SOAPMessageContextImpl> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
+      SOAPMessageContextBase msgContext = null;
+      Stack<SOAPMessageContextBase> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
       if (stack != null && stack.isEmpty() == false)
       {
          msgContext = stack.peek();
@@ -63,13 +64,13 @@
       return msgContext;
    }
 
-   public static void pushMessageContext(SOAPMessageContextImpl msgContext)
+   public static void pushMessageContext(SOAPMessageContextBase msgContext)
    {
       log.debug("pushMessageContext: " + msgContext);
-      Stack<SOAPMessageContextImpl> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
+      Stack<SOAPMessageContextBase> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
       if (stack == null)
       {
-         stack = new Stack<SOAPMessageContextImpl>();
+         stack = new Stack<SOAPMessageContextBase>();
          ThreadLocalAssociation.localMsgContextAssoc().set(stack);
       }
       stack.push(msgContext);

Modified: trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -42,6 +42,7 @@
 
 import org.jboss.logging.Logger;
 import org.jboss.ws.Constants;
+import org.jboss.ws.common.SOAPMessageContextBase;
 import org.jboss.ws.jaxrpc.Style;
 import org.jboss.ws.soap.attachment.MimeConstants;
 import org.jboss.ws.soap.attachment.MultipartRelatedDecoder;
@@ -87,7 +88,7 @@
    {
       if (style == null)
       {
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+         SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
          if (msgContext != null && msgContext.getOperationMetaData() != null)
          {
             style = msgContext.getOperationMetaData().getStyle();

Modified: trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -21,6 +21,17 @@
  */
 package org.jboss.ws.soap;
 
+import java.io.ByteArrayInputStream;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.JAXRPCException;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+
 import org.jboss.logging.Logger;
 import org.jboss.util.xml.DOMUtils;
 import org.jboss.util.xml.DOMWriter;
@@ -30,23 +41,23 @@
 import org.jboss.ws.binding.DeserializerSupport;
 import org.jboss.ws.binding.SerializationContext;
 import org.jboss.ws.binding.SerializerSupport;
+import org.jboss.ws.common.SOAPMessageContextBase;
 import org.jboss.ws.jaxrpc.TypeMappingImpl;
-import org.jboss.ws.jaxrpc.encoding.*;
+import org.jboss.ws.jaxrpc.encoding.DeserializerFactoryBase;
+import org.jboss.ws.jaxrpc.encoding.NullValueSerializer;
+import org.jboss.ws.jaxrpc.encoding.SerializerFactoryBase;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
 import org.jboss.ws.metadata.ParameterMetaData;
 import org.jboss.ws.utils.JavaUtils;
 import org.jboss.ws.utils.MimeUtils;
-import org.w3c.dom.*;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.TypeInfo;
 
-import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import java.lang.reflect.Array;
-import java.lang.reflect.Method;
-import java.util.Iterator;
-import java.io.ByteArrayInputStream;
-
 /**
  * A SOAPElement that gives access to its content as XML fragment or Java object.
  *
@@ -127,7 +138,7 @@
          Class javaType = getJavaType();
          log.debug("getXMLFragment from Object [xmlType=" + xmlType + ",javaType=" + javaType + "]");
 
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+         SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
          if (msgContext == null)
             throw new WSException("MessageContext not available");
 
@@ -213,7 +224,7 @@
          log.debug("getObjectValue [xmlType=" + xmlType + ",javaType=" + javaType + "]");
          assertContentMapping();
 
-         SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+         SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
          if (msgContext == null)
             throw new WSException("MessageContext not available");
 

Deleted: trunk/src/main/java/org/jboss/ws/soap/SOAPMessageContextImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/SOAPMessageContextImpl.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/soap/SOAPMessageContextImpl.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -1,166 +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.soap;
-
-// $Id$
-
-import javax.xml.rpc.handler.soap.SOAPMessageContext;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.handler.MessageContextImpl;
-import org.jboss.ws.jaxrpc.JAXRPCSerializationContext;
-import org.jboss.ws.jaxws.JAXWSSerializationContext;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.EndpointMetaData.Type;
-import org.jboss.xb.binding.NamespaceRegistry;
-
-/**
- * Provides access to the SOAP message for either RPC request or response.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 14-Dec-2004
- */
-public class SOAPMessageContextImpl extends MessageContextImpl implements SOAPMessageContext
-{
-   // The current SOAPMessage, maybe a request or response message
-   private SOAPMessage soapMessage;
-   // The operation for this message ctx
-   private EndpointMetaData epMetaData;
-   // The operation for this message ctx
-   private OperationMetaData opMetaData;
-   // The serialization context for this message ctx
-   private SerializationContext serContext;
-
-   /** Default constuctor
-    */
-   public SOAPMessageContextImpl()
-   {
-   }
-
-   /** Gets the SOAPMessage from this message context
-    *
-    * @return Returns the SOAPMessage; returns null if no SOAPMessage is present in this message context
-    */
-   public SOAPMessage getMessage()
-   {
-      return soapMessage;
-   }
-
-   /** Sets the SOAPMessage in this message context
-    *
-    * @param message SOAP message
-    * @throws javax.xml.rpc.JAXRPCException If any error during the setting of the SOAPMessage in this message context
-    * @throws UnsupportedOperationException - If this operation is not supported
-    */
-   public void setMessage(SOAPMessage message)
-   {
-      this.soapMessage = message;
-   }
-
-   /**
-    * Gets the SOAP actor roles associated with an execution of the HandlerChain and its contained Handler instances.
-    * Note that SOAP actor roles apply to the SOAP node and are managed using HandlerChain.setRoles and HandlerChain.getRoles.
-    * Handler instances in the HandlerChain use this information about the SOAP actor roles to process the SOAP header blocks.
-    * Note that the SOAP actor roles are invariant during the processing of SOAP message through the HandlerChain.
-    *
-    * @return Array of URIs for SOAP actor roles
-    */
-   public String[] getRoles()
-   {
-      return new String[0];
-   }
-
-   public EndpointMetaData getEndpointMetaData()
-   {
-      if (epMetaData == null && opMetaData != null)
-         epMetaData = opMetaData.getEndpointMetaData();
-
-      return epMetaData;
-   }
-
-   public void setEndpointMetaData(EndpointMetaData epMetaData)
-   {
-      this.epMetaData = epMetaData;
-   }
-
-   public OperationMetaData getOperationMetaData()
-   {
-      return opMetaData;
-   }
-
-   public void setOperationMetaData(OperationMetaData opMetaData)
-   {
-      this.opMetaData = opMetaData;
-   }
-
-   /** Get or create the serialization context
-    */
-   public SerializationContext getSerializationContext()
-   {
-      if (serContext == null)
-      {
-         EndpointMetaData epMetaData = getEndpointMetaData();
-         ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
-
-         if (epMetaData.getType() == Type.JAXWS)
-         {
-            JAXWSSerializationContext jaxwsContext = new JAXWSSerializationContext();
-            jaxwsContext.setTypeMapping(serviceMetaData.getTypeMapping());
-            serContext = jaxwsContext;
-         }         
-         else
-         {
-            JAXRPCSerializationContext jaxrpcContext = new JAXRPCSerializationContext();
-            jaxrpcContext.setTypeMapping(serviceMetaData.getTypeMapping());
-            jaxrpcContext.setJavaWsdlMapping(serviceMetaData.getJavaWsdlMapping());
-            serContext = jaxrpcContext;
-         }         
-      }
-
-      serContext.setNamespaceRegistry(getNamespaceRegistry());
-      return serContext;
-   }
-
-   /** Get the namespace registry from the current SOAPEnvelope
-    */
-   public NamespaceRegistry getNamespaceRegistry()
-   {
-      if (soapMessage == null)
-         throw new WSException("Cannot obtain NamespaceRegistry, because there is no SOAPMessage associated with this context");
-
-      try
-      {
-         SOAPEnvelopeImpl soapEnv = (SOAPEnvelopeImpl)soapMessage.getSOAPPart().getEnvelope();
-         NamespaceRegistry nsRegistry = soapEnv.getNamespaceRegistry();
-         return nsRegistry;
-      }
-      catch (SOAPException e)
-      {
-         throw new WSException("Cannot get SOAPEnvelope: " + e);
-      }
-   }
-}

Modified: trunk/src/main/java/org/jboss/ws/soap/SOAPMessageDispatcher.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/SOAPMessageDispatcher.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/soap/SOAPMessageDispatcher.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -35,6 +35,7 @@
 import javax.xml.ws.addressing.JAXWSAConstants;
 
 import org.jboss.logging.Logger;
+import org.jboss.ws.common.SOAPMessageContextBase;
 import org.jboss.ws.metadata.EndpointMetaData;
 import org.jboss.ws.metadata.OperationMetaData;
 
@@ -56,7 +57,7 @@
       OperationMetaData opMetaData = null;
 
       // Dispatch based on wsa:Action
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
       AddressingProperties inProps = (AddressingProperties)msgContext.getProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
       if (inProps != null && inProps.getAction() != null)
       {

Modified: trunk/src/main/java/org/jboss/ws/utils/ThreadLocalAssociation.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/utils/ThreadLocalAssociation.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/utils/ThreadLocalAssociation.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -1,14 +1,38 @@
+/*
+ * 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.utils;
 
-import org.jboss.ws.soap.SOAPMessageContextImpl;
-import org.jboss.ws.wsse.SecurityStore;
+// $Id: $
 
 import java.util.Stack;
 
+import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.wsse.SecurityStore;
+
 /**
  * Maintain thread locals at a single point.
  *
  * @author Heiko Braun, <heiko at openj.net>
+ * @author Thomas.Diesler at jboss.com
  * @since 10-Apr-2006
  */
 public class ThreadLocalAssociation {
@@ -24,7 +48,7 @@
      * SOAP message context
      * @see org.jboss.ws.soap.MessageContextAssociation
      */
-    private static ThreadLocal<Stack<SOAPMessageContextImpl>> msgContextAssoc = new InheritableThreadLocal<Stack<SOAPMessageContextImpl>>();
+    private static ThreadLocal<Stack<SOAPMessageContextBase>> msgContextAssoc = new InheritableThreadLocal<Stack<SOAPMessageContextBase>>();
 
     /**
      * @see org.jboss.ws.wsse.STRTransform
@@ -35,7 +59,7 @@
         return invokerMDBAssoc;
     }
 
-    public static ThreadLocal<Stack<SOAPMessageContextImpl>> localMsgContextAssoc() {
+    public static ThreadLocal<Stack<SOAPMessageContextBase>> localMsgContextAssoc() {
         return msgContextAssoc;
     }
 

Modified: trunk/src/main/java/org/jboss/ws/wsse/WSSecurityDispatcher.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/wsse/WSSecurityDispatcher.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/wsse/WSSecurityDispatcher.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -36,6 +36,7 @@
 import org.jboss.util.xml.DOMWriter;
 import org.jboss.ws.WSException;
 import org.jboss.ws.jaxrpc.StubExt;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
 import org.jboss.ws.metadata.EndpointMetaData;
 import org.jboss.ws.metadata.OperationMetaData;
 import org.jboss.ws.metadata.wsse.Config;
@@ -49,7 +50,6 @@
 import org.jboss.ws.metadata.wsse.Sign;
 import org.jboss.ws.metadata.wsse.Timestamp;
 import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 import org.jboss.ws.soap.SOAPMessageImpl;
 import org.w3c.dom.Element;
 
@@ -103,7 +103,7 @@
       return new SOAPFaultException(e.getFaultCode(), e.getFaultString(), null, null);
    }
 
-   public static void handleInbound(SOAPMessageContextImpl ctx) throws SOAPException, SOAPFaultException
+   public static void handleInbound(SOAPMessageContextJAXRPC ctx) throws SOAPException, SOAPFaultException
    {
       WSSecurityConfiguration config = getSecurityConfig(ctx);
       SOAPMessageImpl soapMessage = (SOAPMessageImpl)ctx.getMessage();
@@ -174,7 +174,7 @@
       }
    }
 
-   private static WSSecurityConfiguration getSecurityConfig(SOAPMessageContextImpl ctx)
+   private static WSSecurityConfiguration getSecurityConfig(SOAPMessageContextJAXRPC ctx)
    {
       WSSecurityConfiguration config = ctx.getEndpointMetaData().getServiceMetaData().getSecurityConfiguration();
       if (config == null)
@@ -221,7 +221,7 @@
       return operations;
    }
 
-   public static void handleOutbound(SOAPMessageContextImpl ctx) throws SOAPException, SOAPFaultException
+   public static void handleOutbound(SOAPMessageContextJAXRPC ctx) throws SOAPException, SOAPFaultException
    {
       WSSecurityConfiguration config = getSecurityConfig(ctx);
       SOAPMessageImpl soapMessage = (SOAPMessageImpl)ctx.getMessage();

Modified: trunk/src/main/java/org/jboss/ws/wsse/WSSecurityHandler.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/wsse/WSSecurityHandler.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/main/java/org/jboss/ws/wsse/WSSecurityHandler.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -29,9 +29,9 @@
 import javax.xml.soap.SOAPException;
 
 import org.jboss.logging.Logger;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
 import org.jboss.ws.metadata.EndpointMetaData;
 import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 
 /**
  * An abstract JAXRPC handler that delegates to the WSSecurityDispatcher
@@ -55,7 +55,7 @@
       {
          if (getSecurityConfiguration(msgContext) != null)
          {
-            WSSecurityDispatcher.handleInbound((SOAPMessageContextImpl)msgContext);
+            WSSecurityDispatcher.handleInbound((SOAPMessageContextJAXRPC)msgContext);
          }
       }
       catch (SOAPException ex)
@@ -72,7 +72,7 @@
       {
          if (getSecurityConfiguration(msgContext) != null)
          {
-            WSSecurityDispatcher.handleOutbound((SOAPMessageContextImpl)msgContext);
+            WSSecurityDispatcher.handleOutbound((SOAPMessageContextJAXRPC)msgContext);
          }
       }
       catch (SOAPException ex)
@@ -85,7 +85,7 @@
 
    private WSSecurityConfiguration getSecurityConfiguration(MessageContext msgContext)
    {
-      EndpointMetaData epMetaData = ((SOAPMessageContextImpl)msgContext).getEndpointMetaData();
+      EndpointMetaData epMetaData = ((SOAPMessageContextJAXRPC)msgContext).getEndpointMetaData();
       WSSecurityConfiguration securityConfiguration = epMetaData.getServiceMetaData().getSecurityConfiguration();
       if (securityConfiguration == null)
          log.warn("Cannot obtain security configuration");

Modified: trunk/src/test/java/org/jboss/test/ws/benchmark/Address.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/benchmark/Address.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/test/java/org/jboss/test/ws/benchmark/Address.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -9,7 +9,7 @@
 /**
  * A Address.
  * 
- * @author <a href="anders.hedstrom at home.se">Anders Hedström</a>
+ * @author <a href="anders.hedstrom at home.se">Anders Hedstrom</a>
  * @version $Revision$
  */
 public class Address {

Modified: trunk/src/test/java/org/jboss/test/ws/benchmark/BenchmarkService.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/benchmark/BenchmarkService.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/test/java/org/jboss/test/ws/benchmark/BenchmarkService.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -13,7 +13,7 @@
 /**
  * BenchmarkService.
  * 
- * @author <a href="anders.hedstrom at home.se">Anders Hedström</a>
+ * @author <a href="anders.hedstrom at home.se">Anders Hedstrom</a>
  * @version $Revision$
  */
 public interface BenchmarkService extends Remote {

Modified: trunk/src/test/java/org/jboss/test/ws/benchmark/Customer.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/benchmark/Customer.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/test/java/org/jboss/test/ws/benchmark/Customer.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -12,7 +12,7 @@
 /**
  * A Customer.
  * 
- * @author <a href="anders.hedstrom at home.se">Anders Hedström</a>
+ * @author <a href="anders.hedstrom at home.se">Anders Hedstrom</a>
  * @version $Revision$
  */
 public class Customer {

Modified: trunk/src/test/java/org/jboss/test/ws/benchmark/LineItem.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/benchmark/LineItem.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/test/java/org/jboss/test/ws/benchmark/LineItem.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -10,7 +10,7 @@
 /**
  * A LineItem.
  * 
- * @author <a href="anders.hedstrom at home.se">Anders Hedström</a>
+ * @author <a href="anders.hedstrom at home.se">Anders Hedstrom</a>
  * @version $Revision$
  */
 public class LineItem {

Modified: trunk/src/test/java/org/jboss/test/ws/benchmark/Order.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/benchmark/Order.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/test/java/org/jboss/test/ws/benchmark/Order.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -12,7 +12,7 @@
 /**
  * A Order.
  * 
- * @author <a href="anders.hedstrom at home.se">Anders Hedström</a>
+ * @author <a href="anders.hedstrom at home.se">Anders Hedstrom</a>
  * @version $Revision$
  */
 public class Order implements Serializable

Modified: trunk/src/test/java/org/jboss/test/ws/benchmark/OrderBL.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/benchmark/OrderBL.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/test/java/org/jboss/test/ws/benchmark/OrderBL.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -12,7 +12,7 @@
 /**
  * A OrderBL.
  * 
- * @author <a href="anders.hedstrom at home.se">Anders Hedstr�m</a>
+ * @author <a href="anders.hedstrom at home.se">Anders Hedstrom</a>
  * @version $Revision$
  */
 public class OrderBL {

Modified: trunk/src/test/java/org/jboss/test/ws/benchmark/SimpleUserType.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/benchmark/SimpleUserType.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/test/java/org/jboss/test/ws/benchmark/SimpleUserType.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -11,7 +11,7 @@
 /**
  * A SimpleUserType.
  * 
- * @author <a href="anders.hedstrom at home.se">Anders Hedström</a>
+ * @author <a href="anders.hedstrom at home.se">Anders Hedstrom</a>
  * @version $Revision$
  */
 public class SimpleUserType implements Serializable

Modified: trunk/src/test/java/org/jboss/test/ws/benchmark/Synthetic.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/benchmark/Synthetic.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/test/java/org/jboss/test/ws/benchmark/Synthetic.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -11,7 +11,7 @@
 /**
  * A Synthetic.
  * 
- * @author <a href="anders.hedstrom at home.se">Anders Hedström</a>
+ * @author <a href="anders.hedstrom at home.se">Anders Hedstrom</a>
  * @version $Revision$
  */
 public class Synthetic implements Serializable

Modified: trunk/src/test/java/org/jboss/test/ws/binding/SOAPBindingTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/binding/SOAPBindingTestCase.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/test/java/org/jboss/test/ws/binding/SOAPBindingTestCase.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -41,12 +41,13 @@
 import org.jboss.ws.binding.EndpointInvocation;
 import org.jboss.ws.binding.UnboundHeader;
 import org.jboss.ws.binding.soap.JAXRPCBindingProviderSOAP12;
+import org.jboss.ws.common.SOAPMessageContextBase;
 import org.jboss.ws.jaxrpc.CallImpl;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
 import org.jboss.ws.metadata.OperationMetaData;
 import org.jboss.ws.metadata.ParameterMetaData;
 import org.jboss.ws.soap.MessageContextAssociation;
 import org.jboss.ws.soap.MessageFactoryImpl;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 
 /**
  * Test the SOAPBindingProvider
@@ -156,7 +157,7 @@
       opMetaData.getEndpointMetaData().setServiceEndpointInterfaceName(SOAPBindingTestService.class.getName());
 
       // Associate a message context with the current thread
-      SOAPMessageContextImpl messageContext = new SOAPMessageContextImpl();
+      SOAPMessageContextJAXRPC messageContext = new SOAPMessageContextJAXRPC();
       MessageContextAssociation.pushMessageContext(messageContext);
       messageContext.setOperationMetaData(opMetaData);
    }
@@ -240,7 +241,7 @@
       MessageFactory factory = new MessageFactoryImpl();
       SOAPMessage reqMessage = factory.createMessage(null, inputStream);
 
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
       msgContext.setMessage(reqMessage);
 
       EndpointInvocation epInv = bp.unbindRequestMessage(opMetaData, reqMessage);
@@ -266,7 +267,7 @@
       MessageFactory factory = new MessageFactoryImpl();
       SOAPMessage reqMessage = factory.createMessage(null, inputStream);
 
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
       msgContext.setMessage(reqMessage);
 
       BindingProvider bp = new JAXRPCBindingProviderSOAP12();
@@ -288,7 +289,7 @@
       MessageFactory factory = new MessageFactoryImpl();
       SOAPMessage reqMessage = factory.createMessage(null, inputStream);
 
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
       msgContext.setMessage(reqMessage);
 
       BindingProvider bp = new JAXRPCBindingProviderSOAP12();
@@ -329,7 +330,7 @@
       MessageFactory factory = new MessageFactoryImpl();
       SOAPMessage resMessage = factory.createMessage(null, inputStream);
 
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
       msgContext.setMessage(resMessage);
 
       EndpointInvocation epInv = new EndpointInvocation(opMetaData);
@@ -348,7 +349,7 @@
       MessageFactory factory = new MessageFactoryImpl();
       SOAPMessage resMessage = factory.createMessage(null, inputStream);
 
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
       msgContext.setMessage(resMessage);
 
       // Add bound header
@@ -377,7 +378,7 @@
       MessageFactory factory = new MessageFactoryImpl();
       SOAPMessage resMessage = factory.createMessage(null, inputStream);
 
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
       msgContext.setMessage(resMessage);
 
       QName xmlName = new QName("http://somens", "OutHeader");
@@ -404,7 +405,7 @@
       MessageFactory factory = new MessageFactoryImpl();
       SOAPMessage resMessage = factory.createMessage(null, inputStream);
 
-      SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
       msgContext.setMessage(resMessage);
 
       try

Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/context/WebServiceContextTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/context/WebServiceContextTestCase.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/context/WebServiceContextTestCase.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -66,11 +66,11 @@
       Service service = Service.create(wsdlURL, qname);
       EndpointInterface port = (EndpointInterface)service.getPort(EndpointInterface.class);
       
-      System.out.println("FIXME: JBWS-1022");
+      //System.out.println("FIXME: JBWS-1022");
       
-//      String helloWorld = "Hello world!";
-//      Object retObj = port.echo(helloWorld);
-//      assertEquals(helloWorld, retObj);
+      String helloWorld = "Hello world!";
+      Object retObj = port.echo(helloWorld);
+      assertEquals(helloWorld, retObj);
    }
    
 }

Modified: trunk/src/test/java/org/jboss/test/ws/jbossxb/SerializerDeserializerTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jbossxb/SerializerDeserializerTestCase.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/test/java/org/jboss/test/ws/jbossxb/SerializerDeserializerTestCase.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -35,7 +35,7 @@
 import org.jboss.ws.binding.DeserializerSupport;
 import org.jboss.ws.binding.SerializationContext;
 import org.jboss.ws.binding.SerializerSupport;
-import org.jboss.ws.jaxrpc.JAXRPCSerializationContext;
+import org.jboss.ws.jaxrpc.SerializationContextJAXRPC;
 import org.jboss.ws.jaxrpc.TypeMappingImpl;
 import org.jboss.ws.jaxrpc.TypeMappingRegistryImpl;
 import org.jboss.ws.jaxrpc.encoding.DeserializerFactoryBase;
@@ -63,7 +63,7 @@
       TypeMappingRegistry tmRegistry = new TypeMappingRegistryImpl();
       typeMapping = (TypeMappingImpl)tmRegistry.getDefaultTypeMapping();
 
-      serContext = new JAXRPCSerializationContext();
+      serContext = new SerializationContextJAXRPC();
       nsRegistry = new NamespaceRegistry();
 
       serContext.setTypeMapping(typeMapping);

Modified: trunk/src/test/java/org/jboss/test/ws/samples/wsaddressing/StatefulEndpointImpl.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/samples/wsaddressing/StatefulEndpointImpl.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/test/java/org/jboss/test/ws/samples/wsaddressing/StatefulEndpointImpl.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -28,16 +28,15 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.annotation.Resource;
 import javax.jws.WebMethod;
 import javax.jws.WebService;
 import javax.jws.soap.SOAPBinding;
 import javax.jws.soap.SOAPMessageHandler;
 import javax.jws.soap.SOAPMessageHandlers;
 import javax.xml.namespace.QName;
-import javax.xml.rpc.ServiceException;
-import javax.xml.rpc.handler.MessageContext;
-import javax.xml.rpc.server.ServiceLifecycle;
-import javax.xml.rpc.server.ServletEndpointContext;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
 
 import org.jboss.logging.Logger;
 
@@ -53,7 +52,7 @@
    @SOAPMessageHandler(className = "org.jboss.ws.addressing.soap.SOAPServerHandler"),
    @SOAPMessageHandler(className = "org.jboss.test.ws.samples.wsaddressing.ServerHandler")
    })
-public class StatefulEndpointImpl implements StatefulEndpoint, ServiceLifecycle
+public class StatefulEndpointImpl implements StatefulEndpoint
 {
    // provide logging
    private static Logger log = Logger.getLogger(StatefulEndpointImpl.class);
@@ -63,7 +62,9 @@
    // The state map for all clients
    private static Map<String, List<String>> clientStateMap = new HashMap<String, List<String>>();
    
-   private ServletEndpointContext servletEndpointContext;
+   @Resource
+   private WebServiceContext context;
+   
    private String clientid;
    private static List<String> items;
 
@@ -93,8 +94,8 @@
 
    private void initSessionState()
    {
-      MessageContext msgContext = servletEndpointContext.getMessageContext();
-      clientid = (String)msgContext.getProperty("clientid");
+      MessageContext msgContext = context.getMessageContext();
+      clientid = (String)msgContext.get("clientid");
       if (clientid == null)
          throw new IllegalStateException("Cannot obtain clientid");
       
@@ -106,15 +107,4 @@
          clientStateMap.put(clientid, items);
       }
    }
-
-   public void init(Object context) throws ServiceException
-   {
-      log.info("init ServiceLifecycle");
-      servletEndpointContext = (ServletEndpointContext)context;
-   }
-
-   public void destroy()
-   {
-      log.info("destroy ServiceLifecycle");
-   }
 }

Modified: trunk/src/test/java/org/jboss/test/ws/soap/attachment/GenericAttachmentTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/soap/attachment/GenericAttachmentTestCase.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/test/java/org/jboss/test/ws/soap/attachment/GenericAttachmentTestCase.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -45,10 +45,10 @@
 import org.jboss.ws.binding.EndpointInvocation;
 import org.jboss.ws.binding.soap.JAXRPCBindingProviderSOAP12;
 import org.jboss.ws.jaxrpc.CallImpl;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
 import org.jboss.ws.metadata.OperationMetaData;
 import org.jboss.ws.soap.MessageContextAssociation;
 import org.jboss.ws.soap.MessageFactoryImpl;
-import org.jboss.ws.soap.SOAPMessageContextImpl;
 import org.jboss.ws.soap.attachment.MimeConstants;
 
 /**
@@ -140,7 +140,7 @@
       OperationMetaData opMetaData = call.getOperationMetaData();
 
       // Associate a message context with the current thread
-      SOAPMessageContextImpl messageContext = new SOAPMessageContextImpl();
+      SOAPMessageContextJAXRPC messageContext = new SOAPMessageContextJAXRPC();
       MessageContextAssociation.pushMessageContext(messageContext);
       messageContext.setOperationMetaData(opMetaData);
 

Modified: trunk/src/test/java/org/jboss/test/ws/xop/XOPElementRPCTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/xop/XOPElementRPCTestCase.java	2006-08-01 14:23:03 UTC (rev 659)
+++ trunk/src/test/java/org/jboss/test/ws/xop/XOPElementRPCTestCase.java	2006-08-01 16:29:43 UTC (rev 660)
@@ -26,6 +26,7 @@
 import org.jboss.util.xml.DOMWriter;
 import org.jboss.ws.Constants;
 import org.jboss.ws.jaxrpc.Style;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
 import org.jboss.ws.metadata.OperationMetaData;
 import org.jboss.ws.metadata.ParameterMetaData;
 import org.jboss.ws.soap.*;
@@ -75,7 +76,7 @@
       bodyElement.addChildElement(xopElement);
 
       // Setup the message context
-      SOAPMessageContextImpl msgContext = new SOAPMessageContextImpl();
+      SOAPMessageContextJAXRPC msgContext = new SOAPMessageContextJAXRPC();
       MessageContextAssociation.pushMessageContext(msgContext);
       msgContext.setOperationMetaData(opMetaData);
       msgContext.setMessage(soapMessage);




More information about the jboss-svn-commits mailing list