[jboss-svn-commits] JBossWS SVN: r902 - in trunk/src: main/java/org/jboss/ws/addressing/jaxws main/java/org/jboss/ws/binding/soap main/java/org/jboss/ws/common main/java/org/jboss/ws/eventing main/java/org/jboss/ws/integration/jboss main/java/org/jboss/ws/integration/jboss/jms main/java/org/jboss/ws/jaxrpc main/java/org/jboss/ws/jaxrpc/handler main/java/org/jboss/ws/jaxws/client main/java/org/jboss/ws/jaxws/core 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/config/jaxrpc main/java/org/jboss/ws/metadata/config/jaxws main/java/org/jboss/ws/metadata/j2ee main/java/org/jboss/ws/metadata/jsr109 main/java/org/jboss/ws/metadata/jsr181 main/java/org/jboss/ws/server main/java/org/jboss/ws/soap main/java/org/jboss/ws/utils main/java/org/jboss/ws/wsse main/java/org/jboss/ws/wsse/jaxws main/java/org/jboss/ws/xop test/ant test/java/org/jboss/test/ws/binding test/java/org/jboss/test/ws/jaxws/logicalhandler test/ja! va/org/jboss/test/ws/xop test/resources/jaxws/logicalhandler/META-INF test/resources/jaxws/logicalhandler/META-INF/wsdl test/resources/jaxws/logicalhandler/WEB-INF
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Sep 5 16:11:55 EDT 2006
Author: thomas.diesler at jboss.com
Date: 2006-09-05 16:10:19 -0400 (Tue, 05 Sep 2006)
New Revision: 902
Added:
trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalHandlerJAXBTestCase.java
trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalHandlerSourceTestCase.java
trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalJAXBHandler.java
trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalSourceHandler.java
trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointJAXB.java
trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointJAXBImpl.java
trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointSource.java
trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointSourceImpl.java
trunk/src/test/resources/jaxws/logicalhandler/META-INF/jaxws-client-jaxb-handlers.xml
trunk/src/test/resources/jaxws/logicalhandler/META-INF/jaxws-client-source-handlers.xml
trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/jaxws-server-jaxb-handlers.xml
trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/jaxws-server-source-handlers.xml
trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/web-jaxb.xml
trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/web-source.xml
Removed:
trunk/src/main/java/org/jboss/ws/common/SOAPMessageContextBase.java
trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalHandler.java
trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalHandlerTestCase.java
trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpoint.java
trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointBean.java
trunk/src/test/resources/jaxws/logicalhandler/META-INF/jaxws-client-handlers.xml
trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/jaxws-server-handlers.xml
trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/web.xml
Modified:
trunk/src/main/java/org/jboss/ws/addressing/jaxws/WSAddressingServerHandler.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/common/CommonMessageContext.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/ServiceRefMetaDataAdaptor.java
trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java
trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java
trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java
trunk/src/main/java/org/jboss/ws/jaxrpc/SOAPFaultExceptionHelper.java
trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java
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/HandlerDelegateJAXRPC.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/jaxws/client/ClientImpl.java
trunk/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java
trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java
trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java
trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java
trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerDelegateJAXWS.java
trunk/src/main/java/org/jboss/ws/jaxws/handler/LogicalMessageImpl.java
trunk/src/main/java/org/jboss/ws/jaxws/handler/SOAPMessageContextJAXWS.java
trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSupport.java
trunk/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigFactoryJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSHandlerChainsConfigJAXWS.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/jsr109/WebservicesFactory.java
trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java
trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java
trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java
trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.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/soap/MessageContextAssociation.java
trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java
trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.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/jaxws/WSSecurityHandler.java
trunk/src/main/java/org/jboss/ws/xop/XOPContext.java
trunk/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java
trunk/src/test/ant/build-jars.xml
trunk/src/test/java/org/jboss/test/ws/binding/SOAPBindingTestCase.java
trunk/src/test/java/org/jboss/test/ws/xop/XOPElementRPCTestCase.java
trunk/src/test/resources/jaxws/logicalhandler/META-INF/wsdl/TestService.wsdl
Log:
Implement logical jaxws handler with access to jaxb payload
Unbind incoming message before logical handlers are called
Unbind message again after protocol handler changes body payload
Simplify usage of CommonMessageContext
[JBWS-1168] JAXWS handler ordering
merge from userbranch -r901
Modified: trunk/src/main/java/org/jboss/ws/addressing/jaxws/WSAddressingServerHandler.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/addressing/jaxws/WSAddressingServerHandler.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/addressing/jaxws/WSAddressingServerHandler.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -38,7 +38,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.addressing.AddressingConstantsImpl;
import org.jboss.ws.addressing.metadata.AddressingOpMetaExt;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxws.handler.GenericSOAPHandler;
import org.jboss.ws.metadata.OperationMetaData;
@@ -119,7 +119,7 @@
{
// supply the response action
- OperationMetaData opMetaData = ((SOAPMessageContextBase)msgContext).getOperationMetaData();
+ OperationMetaData opMetaData = ((CommonMessageContext)msgContext).getOperationMetaData();
if (!isFault && !opMetaData.isOneWayOperation())
{
Modified: trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderPayload.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderPayload.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderPayload.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -28,6 +28,7 @@
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
@@ -36,7 +37,7 @@
import org.jboss.ws.binding.BindingException;
import org.jboss.ws.binding.EndpointInvocation;
import org.jboss.ws.binding.UnboundHeader;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxws.core.BindingImpl;
import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.metadata.OperationMetaData;
@@ -100,7 +101,7 @@
try
{
- SOAPMessageContextBase 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/common/CommonClient.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/common/CommonClient.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/common/CommonClient.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -26,8 +26,6 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import javax.xml.namespace.QName;
@@ -56,8 +54,10 @@
import org.jboss.ws.metadata.ServiceMetaData;
import org.jboss.ws.metadata.UnifiedMetaData;
import org.jboss.ws.metadata.EndpointMetaData.Type;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
import org.jboss.ws.soap.EndpointInfo;
import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.soap.SOAPBodyImpl;
import org.jboss.ws.soap.SOAPConnectionImpl;
import org.jboss.ws.utils.HolderUtils;
import org.jboss.ws.utils.JavaUtils;
@@ -199,9 +199,9 @@
return epMetaData;
}
- protected abstract boolean callRequestHandlerChain(QName portName);
+ protected abstract boolean callRequestHandlerChain(QName portName, HandlerType type);
- protected abstract boolean callResponseHandlerChain(QName portName);
+ protected abstract boolean callResponseHandlerChain(QName portName, HandlerType type);
protected abstract void setInboundContextProperties();
@@ -225,7 +225,7 @@
OperationMetaData opMetaData = getOperationMetaData();
// Associate a message context with the current thread
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setOperationMetaData(opMetaData);
// copy properties to the message context
@@ -251,8 +251,11 @@
// Call the request handlers
QName portName = epMetaData.getQName();
-
- if (callRequestHandlerChain(portName))
+ boolean handlerPass = callRequestHandlerChain(portName, HandlerType.PRE);
+ handlerPass = handlerPass && callRequestHandlerChain(portName, HandlerType.ENDPOINT);
+ handlerPass = handlerPass && callRequestHandlerChain(portName, HandlerType.POST);
+
+ if (handlerPass)
{
String targetAddress = getTargetEndpointAddress();
@@ -281,13 +284,7 @@
if (targetAddress == null)
throw new WSException("Target endpoint address not set");
- // Setup remoting call properties
- Map<String, Object> callProps = new HashMap<String, Object>();
- callProps.putAll(getRequestContext());
-
- syncMessageProperties(callProps, msgContext);
-
- EndpointInfo epInfo = new EndpointInfo(epMetaData, targetAddress, callProps);
+ EndpointInfo epInfo = new EndpointInfo(epMetaData, targetAddress, getRequestContext());
SOAPMessage resMessage;
if (oneway)
@@ -300,7 +297,7 @@
}
// Associate current message with message context
- msgContext.setMessage(resMessage);
+ msgContext.setSOAPMessage(resMessage);
}
setInboundContextProperties();
@@ -310,12 +307,26 @@
if (oneway == false)
{
// Call the response handlers
- callResponseHandlerChain(portName);
-
+ handlerPass = callResponseHandlerChain(portName, HandlerType.POST);
+
// unbind the return values
- SOAPMessage resMessage = msgContext.getMessage();
- binding.unbindResponseMessage(opMetaData, resMessage, epInv, unboundHeaders);
+ if (handlerPass)
+ {
+ SOAPMessage resMessage = msgContext.getSOAPMessage();
+ binding.unbindResponseMessage(opMetaData, resMessage, epInv, unboundHeaders);
+ }
+
+ handlerPass = handlerPass && callResponseHandlerChain(portName, HandlerType.ENDPOINT);
+ handlerPass = handlerPass && callResponseHandlerChain(portName, HandlerType.PRE);
+ // Check if protocol handlers modified the payload
+ if (((SOAPBodyImpl)reqMessage.getSOAPBody()).isModifiedFromSource())
+ {
+ log.debug("Handler modified body payload, unbind message again");
+ SOAPMessage resMessage = msgContext.getSOAPMessage();
+ binding.unbindResponseMessage(opMetaData, resMessage, epInv, unboundHeaders);
+ }
+
retObj = syncOutputParams(inputParams, epInv);
}
@@ -333,8 +344,7 @@
}
finally
{
- // Snyc context properties with the stub that clients can access them
- syncMessageProperties(getResponseContext(), msgContext);
+ getResponseContext().putAll(msgContext.getProperties());
}
}
@@ -351,17 +361,6 @@
protected abstract Map<String, Object> getResponseContext();
- private void syncMessageProperties(Map<String, Object> props, SOAPMessageContextBase msgContext)
- {
- Iterator it = msgContext.getPropertyNames();
- while (it.hasNext())
- {
- String propName = (String)it.next();
- Object property = msgContext.getProperty(propName);
- props.put(propName, property);
- }
- }
-
/** Synchronize the operation paramters with the call output parameters.
*/
private Object syncOutputParams(Object[] inParams, EndpointInvocation epInv) throws SOAPException
Modified: trunk/src/main/java/org/jboss/ws/common/CommonMessageContext.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/common/CommonMessageContext.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/common/CommonMessageContext.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -27,6 +27,9 @@
import java.util.Iterator;
import java.util.Map;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.ws.binding.SerializationContext;
import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.metadata.OperationMetaData;
import org.jboss.xb.binding.NamespaceRegistry;
@@ -37,12 +40,18 @@
* @author Thomas.Diesler at jboss.org
* @since 1-Sep-2006
*/
-public abstract class CommonMessageContext
+public abstract class CommonMessageContext
{
+ // expandToDOM in the SOAPContentElement should not happen during normal operation
+ // This property should be set the message context when it is ok to do so.
+ public static String ALLOW_EXPAND_TO_DOM = "org.jboss.ws.allow.expand.dom";
+
// The operation for this message ctx
private EndpointMetaData epMetaData;
// The operation for this message ctx
private OperationMetaData opMetaData;
+ // The SOAPMessage in this message context
+ private SOAPMessage soapMessage;
// The map of the properties
protected Map<String, Object> props = new HashMap<String, Object>();
@@ -69,6 +78,24 @@
this.opMetaData = opMetaData;
}
+ public SOAPMessage getSOAPMessage()
+ {
+ return soapMessage;
+ }
+
+ public void setSOAPMessage(SOAPMessage soapMessage)
+ {
+ this.soapMessage = soapMessage;
+ }
+
+ public abstract SerializationContext getSerializationContext();
+
+ /** Gets the namespace registry for this message context */
+ public NamespaceRegistry getNamespaceRegistry()
+ {
+ return getSerializationContext().getNamespaceRegistry();
+ }
+
public Map<String, Object> getProperties()
{
return props;
@@ -119,7 +146,4 @@
{
props.put(name, value);
}
-
- /** Gets the namespace registry for this message context */
- public abstract NamespaceRegistry getNamespaceRegistry();
}
Deleted: trunk/src/main/java/org/jboss/ws/common/SOAPMessageContextBase.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/common/SOAPMessageContextBase.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/common/SOAPMessageContextBase.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -1,74 +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.common;
-
-// $Id$
-
-import java.util.Iterator;
-
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.xb.binding.NamespaceRegistry;
-
-/**
- * Provides access to the SOAP message and WS meta data.
- *
- * Both the JAXRPC and the JAXWS SOAPMessageContext im plement this interface.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 1-Aug-2006
- */
-public interface SOAPMessageContextBase
-{
- // expandToDOM in the SOAPContentElement should not happen during normal operation
- // This property should be set the message context when it is ok to do so.
- String ALLOW_EXPAND_TO_DOM = "org.jboss.ws.allow.expand.dom";
-
- public SOAPMessage getMessage();
-
- public void setMessage(SOAPMessage message);
-
- public EndpointMetaData getEndpointMetaData();
-
- public void setEndpointMetaData(EndpointMetaData epMetaData);
-
- public OperationMetaData getOperationMetaData();
-
- public void setOperationMetaData(OperationMetaData opMetaData);
-
- public SerializationContext getSerializationContext();
-
- public NamespaceRegistry getNamespaceRegistry();
-
- public boolean containsProperty(String name);
-
- public Object getProperty(String name);
-
- public Iterator getPropertyNames();
-
- public void removeProperty(String name);
-
- public void setProperty(String name, Object value);
-}
Modified: trunk/src/main/java/org/jboss/ws/eventing/EventingEndpointBase.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/eventing/EventingEndpointBase.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/eventing/EventingEndpointBase.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -33,7 +33,7 @@
import javax.xml.ws.addressing.JAXWSAConstants;
import org.jboss.ws.Constants;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.eventing.mgmt.SubscriptionManagerFactory;
import org.jboss.ws.eventing.mgmt.SubscriptionManagerMBean;
import org.jboss.ws.soap.MessageContextAssociation;
@@ -53,7 +53,7 @@
*/
protected static AddressingProperties getAddrProperties()
{
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext 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-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/eventing/SubscriptionManagerEndpointImpl.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -36,7 +36,7 @@
import org.jboss.ws.utils.DOMUtils;
import org.jboss.ws.Constants;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.eventing.element.RenewRequest;
import org.jboss.ws.eventing.element.RenewResponse;
import org.jboss.ws.eventing.element.StatusRequest;
@@ -136,7 +136,7 @@
private URI retrieveSubscriptionId()
{
URI subscriptionId = null;
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
AddressingProperties addrProps = (AddressingProperties)msgContext.getProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
if (null == addrProps)
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInterceptor.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInterceptor.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInterceptor.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -30,7 +30,7 @@
import org.jboss.invocation.InvocationKey;
import org.jboss.logging.Logger;
import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxws.core.BindingImpl;
import org.jboss.ws.jaxws.core.BindingProviderImpl;
import org.jboss.ws.metadata.OperationMetaData;
@@ -57,7 +57,7 @@
public Object invoke(final Invocation mi) throws Exception
{
// If no msgContext, it's not for us
- SOAPMessageContextBase msgContext = (SOAPMessageContextBase)mi.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
+ CommonMessageContext msgContext = (CommonMessageContext)mi.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
if (msgContext == null)
{
return getNext().invoke(mi);
@@ -95,7 +95,7 @@
BindingProviderImpl bindingProvider = new BindingProviderImpl(opMetaData.getEndpointMetaData());
BindingImpl binding = (BindingImpl)bindingProvider.getBinding();
SOAPMessage resMessage = (SOAPMessage)binding.bindResponseMessage(opMetaData, epInv);
- msgContext.setMessage(resMessage);
+ msgContext.setSOAPMessage(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-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerEJB21.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -42,7 +42,7 @@
import org.jboss.security.SecurityAssociation;
import org.jboss.ws.WSException;
import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.metadata.ServerEndpointMetaData;
import org.jboss.ws.metadata.EndpointMetaData.Type;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
@@ -162,7 +162,7 @@
Principal principal = SecurityAssociation.getPrincipal();
Object credential = SecurityAssociation.getCredential();
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
// invoke on the container
try
@@ -173,7 +173,7 @@
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.setValue(InvocationKey.SOAP_MESSAGE, msgContext.getSOAPMessage());
inv.setType(InvocationType.SERVICE_ENDPOINT);
// Set the handler callback and endpoint invocation
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerEJB3.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerEJB3.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInvokerEJB3.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -104,7 +104,7 @@
Principal principal = SecurityAssociation.getPrincipal();
Object credential = SecurityAssociation.getCredential();
- SOAPMessageContextBase msgContext = MessageContextAssociation.getMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.getMessageContext();
Invocation inv = new Invocation(null, method, args, null, principal, credential);
inv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceRefMetaDataAdaptor.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceRefMetaDataAdaptor.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss/ServiceRefMetaDataAdaptor.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -35,6 +35,7 @@
import org.jboss.ws.metadata.j2ee.UnifiedInitParamMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedPortComponentRefMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedServiceRefMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
/**
* Build container independent service ref meta data
@@ -67,7 +68,7 @@
ArrayList<UnifiedHandlerMetaData> handlers = new ArrayList<UnifiedHandlerMetaData>();
for (HandlerMetaData hmd : srmd.getHandlers())
{
- UnifiedHandlerMetaData uhmd = new UnifiedHandlerMetaData(null);
+ UnifiedHandlerMetaData uhmd = new UnifiedHandlerMetaData(null, HandlerType.ENDPOINT);
uhmd.setHandlerName(hmd.getHandlerName());
uhmd.setHandlerClass(hmd.getHandlerClass());
Arrays.asList(hmd.getSoapHeaders());
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -33,7 +33,7 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.WSException;
import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.integration.jboss.ServiceEndpointInvokerMDB;
import org.jboss.ws.metadata.ServerEndpointMetaData;
import org.jboss.ws.server.ServiceEndpoint;
@@ -79,7 +79,7 @@
}
// Associate a message context with the current thread
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setEndpointMetaData(sepMetaData);
return sep.handleRequest(null, null, reqMessage);
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -51,7 +51,7 @@
import org.jboss.logging.Logger;
import org.jboss.util.NestedRuntimeException;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.soap.MessageContextAssociation;
@@ -101,7 +101,7 @@
fromName = "topic/" + ((Topic)destination).getTopicName();
// Associate a message context with the current thread
- SOAPMessageContextBase msgContext = new SOAPMessageContextJAXRPC();
+ CommonMessageContext msgContext = new SOAPMessageContextJAXRPC();
MessageContextAssociation.pushMessageContext(msgContext);
try
{
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -57,6 +57,7 @@
import org.jboss.ws.metadata.ParameterMetaData;
import org.jboss.ws.metadata.ServiceMetaData;
import org.jboss.ws.metadata.TypesMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.soap.MessageContextAssociation;
import org.jboss.ws.utils.JavaUtils;
@@ -567,26 +568,26 @@
}
@Override
- protected boolean callRequestHandlerChain(QName portName)
+ protected boolean callRequestHandlerChain(QName portName, HandlerType type)
{
SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
- HandlerChain handlerChain = jaxrpcService.getHandlerChain(portName);
- return (handlerChain != null ? handlerChain.handleRequest(msgContext) : true);
+ HandlerChainBaseImpl handlerChain = (HandlerChainBaseImpl)jaxrpcService.getHandlerChain(portName);
+ return (handlerChain != null ? handlerChain.handleRequest(msgContext, type) : true);
}
@Override
- protected boolean callResponseHandlerChain(QName portName)
+ protected boolean callResponseHandlerChain(QName portName, HandlerType type)
{
boolean status = true;
String[] roles = null;
SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
- HandlerChain handlerChain = jaxrpcService.getHandlerChain(portName);
+ HandlerChainBaseImpl handlerChain = (HandlerChainBaseImpl)jaxrpcService.getHandlerChain(portName);
if (handlerChain != null)
{
roles = handlerChain.getRoles();
- status = handlerChain.handleResponse(msgContext);
+ status = handlerChain.handleResponse(msgContext, type);
}
// BP-1.0 R1027
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/SOAPFaultExceptionHelper.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/SOAPFaultExceptionHelper.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/SOAPFaultExceptionHelper.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -51,7 +51,7 @@
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.common.CommonMessageContext;
import org.jboss.ws.jaxrpc.encoding.DeserializerFactoryBase;
import org.jboss.ws.jaxrpc.encoding.SerializerFactoryBase;
import org.jboss.ws.metadata.FaultMetaData;
@@ -99,7 +99,7 @@
SOAPFaultException faultEx = new SOAPFaultException(faultCode, faultString, faultActor, detail);
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (detail != null && msgContext != null)
{
SerializationContext serContext = msgContext.getSerializationContext();
@@ -207,7 +207,7 @@
{
assertFaultCode(faultEx.getFaultCode());
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
SerializationContext serContext = (msgContext != null ? msgContext.getSerializationContext() : new SerializationContextJAXRPC());
NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -321,6 +321,7 @@
QName[] headerArr = new QName[headers.size()];
headers.toArray(headerArr);
+ hConfig.put(HandlerType.class.getName(), uhmd.getHandlerType());
HandlerInfo info = new HandlerInfo(hClass, hConfig, headerArr);
log.debug("Adding client side handler to endpoint '" + portName + "': " + info);
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/ClientHandlerChain.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/handler/ClientHandlerChain.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/handler/ClientHandlerChain.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -26,9 +26,7 @@
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.
@@ -42,10 +40,4 @@
{
super(infos, roles);
}
-
- public boolean handleResponse(MessageContext msgContext)
- {
- boolean doNext = super.handleResponse(msgContext);
- return doNext;
- }
}
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerChainBaseImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerChainBaseImpl.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerChainBaseImpl.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -48,10 +48,11 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.metadata.OperationMetaData;
import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
import org.jboss.ws.soap.SOAPElementImpl;
import org.jboss.ws.soap.SOAPElementWriter;
import org.jboss.ws.soap.SOAPEnvelopeImpl;
@@ -87,7 +88,7 @@
/**
* Constructs a handler chain with the given handlers infos
*/
- public HandlerChainBaseImpl(List infos, Set<String> roles)
+ public HandlerChainBaseImpl(List<HandlerInfo> infos, Set<String> roles)
{
log.debug("Create a handler chain for roles: " + roles);
addHandlersToChain(infos, roles);
@@ -111,17 +112,17 @@
*
* @throws javax.xml.rpc.JAXRPCException If any error during initialization
*/
- private void addHandlersToChain(List infos, Set<String> roleSet)
+ private void addHandlersToChain(List<HandlerInfo> infos, Set<String> roleSet)
{
try
{
if (infos != null)
{
- for (int i = 0; i < infos.size(); i++)
+ for (HandlerInfo info : infos)
{
- HandlerInfo info = (HandlerInfo)infos.get(i);
HandlerWrapper handler = new HandlerWrapper((Handler)info.getHandlerClass().newInstance());
- handlers.add(new HandlerEntry(handler, info));
+ HandlerType type = (HandlerType)info.getHandlerConfig().get(HandlerType.class.getName());
+ handlers.add(new HandlerEntry(handler, info, type));
}
}
if (roleSet != null)
@@ -231,6 +232,16 @@
*/
public boolean handleRequest(MessageContext msgContext)
{
+ return handleRequestInternal(msgContext, HandlerType.ALL);
+ }
+
+ public boolean handleRequest(MessageContext msgContext, HandlerType type)
+ {
+ return handleRequestInternal(msgContext, type);
+ }
+
+ private boolean handleRequestInternal(MessageContext msgContext, HandlerType type)
+ {
boolean doNext = true;
if (handlers.size() > 0)
@@ -238,7 +249,7 @@
log.debug("Enter: handleRequest");
SOAPMessageContextJAXRPC jaxrpcContext = (SOAPMessageContextJAXRPC)msgContext;
- jaxrpcContext.setProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+ jaxrpcContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
// Replace handlers that did not survive the previous call
replaceDirtyHandlers();
@@ -247,23 +258,27 @@
Handler currHandler = null;
try
{
+ String lastMessageTrace = null;
for (; doNext && handlerIndex < handlers.size(); handlerIndex++)
{
- String lastMessageTrace = null;
- if (log.isTraceEnabled())
+ HandlerEntry handlerEntry = (HandlerEntry)handlers.get(handlerIndex);
+ if (type == HandlerType.ALL || type == handlerEntry.getType())
{
- SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
- }
+ currHandler = handlerEntry.getHandler();
- currHandler = ((HandlerEntry)handlers.get(handlerIndex)).getHandler();
- log.debug("Handle request: " + currHandler);
- doNext = currHandler.handleRequest(msgContext);
+ if (log.isTraceEnabled())
+ {
+ SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ lastMessageTrace = traceSOAPPart("BEFORE handleRequest - " + currHandler, soapPart, lastMessageTrace);
+ }
- if (log.isTraceEnabled())
- {
- SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+ doNext = currHandler.handleRequest(msgContext);
+
+ if (log.isTraceEnabled())
+ {
+ SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ lastMessageTrace = traceSOAPPart("AFTER handleRequest - " + currHandler, soapPart, lastMessageTrace);
+ }
}
}
}
@@ -279,7 +294,7 @@
if (doNext == false)
falseIndex = (handlerIndex - 1);
- jaxrpcContext.removeProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM);
+ jaxrpcContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
log.debug("Exit: handleRequest with status: " + doNext);
}
}
@@ -299,6 +314,16 @@
*/
public boolean handleResponse(MessageContext msgContext)
{
+ return handleResponseInternal(msgContext, HandlerType.ALL);
+ }
+
+ public boolean handleResponse(MessageContext msgContext, HandlerType type)
+ {
+ return handleResponseInternal(msgContext, type);
+ }
+
+ private boolean handleResponseInternal(MessageContext msgContext, HandlerType type)
+ {
boolean doNext = true;
if (handlers.size() > 0)
@@ -306,7 +331,7 @@
log.debug("Enter: handleResponse");
SOAPMessageContextJAXRPC jaxrpcContext = (SOAPMessageContextJAXRPC)msgContext;
- jaxrpcContext.setProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+ jaxrpcContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
int handlerIndex = handlers.size() - 1;
if (falseIndex != -1)
@@ -315,23 +340,27 @@
Handler currHandler = null;
try
{
+ String lastMessageTrace = null;
for (; doNext && handlerIndex >= 0; handlerIndex--)
{
- String lastMessageTrace = null;
- if (log.isTraceEnabled())
+ HandlerEntry handlerEntry = (HandlerEntry)handlers.get(handlerIndex);
+ if (type == HandlerType.ALL || type == handlerEntry.getType())
{
- SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
- }
+ currHandler = handlerEntry.getHandler();
- currHandler = ((HandlerEntry)handlers.get(handlerIndex)).getHandler();
- log.debug("Handle response: " + currHandler);
- doNext = currHandler.handleResponse(msgContext);
+ if (log.isTraceEnabled())
+ {
+ SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ lastMessageTrace = traceSOAPPart("BEFORE handleResponse - " + currHandler, soapPart, lastMessageTrace);
+ }
- if (log.isTraceEnabled())
- {
- SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+ doNext = currHandler.handleResponse(msgContext);
+
+ if (log.isTraceEnabled())
+ {
+ SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ lastMessageTrace = traceSOAPPart("AFTER handleResponse - " + currHandler, soapPart, lastMessageTrace);
+ }
}
}
}
@@ -347,7 +376,7 @@
if (doNext == false)
falseIndex = (handlerIndex - 1);
- jaxrpcContext.removeProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM);
+ jaxrpcContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
log.debug("Exit: handleResponse with status: " + doNext);
}
}
@@ -374,7 +403,7 @@
log.debug("Enter: handleFault");
SOAPMessageContextJAXRPC jaxrpcContext = (SOAPMessageContextJAXRPC)msgContext;
- jaxrpcContext.setProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+ jaxrpcContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
try
{
@@ -392,7 +421,7 @@
}
finally
{
- jaxrpcContext.removeProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM);
+ jaxrpcContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
log.debug("Exit: handleFault with status: " + doNext);
}
}
@@ -400,18 +429,21 @@
return doNext;
}
- /**
- * Trace the SOAPPart, do nothing if the String representation is equal to the last one.
+ /** Trace the SOAPPart, do nothing if the String representation is equal to the last one.
*/
- protected String traceSOAPPart(SOAPPart soapPart, String lastMessageTrace)
+ protected String traceSOAPPart(String logMsg, SOAPPart soapPart, String lastMessageTrace)
{
try
{
SOAPEnvelopeImpl soapEnv = (SOAPEnvelopeImpl)soapPart.getEnvelope();
String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, true);
- if (envStr.equals(lastMessageTrace) == false)
+ if (envStr.equals(lastMessageTrace))
{
- log.debug(envStr);
+ log.trace(logMsg + ": unchanged");
+ }
+ else
+ {
+ log.trace(logMsg + "\n" + envStr);
lastMessageTrace = envStr;
}
return lastMessageTrace;
@@ -535,11 +567,22 @@
{
private HandlerWrapper handler;
private HandlerInfo info;
+ private HandlerType type;
- public HandlerEntry(HandlerWrapper handler, HandlerInfo info)
+ public HandlerEntry(HandlerWrapper handler, HandlerInfo info, HandlerType type)
{
+ if (handler == null || info == null)
+ throw new IllegalStateException("Invalid handler entry");
+
+ if (type == null)
+ {
+ log.debug("Using handler type default: " + HandlerType.ENDPOINT);
+ type = HandlerType.ENDPOINT;
+ }
+
this.handler = handler;
this.info = info;
+ this.type = type;
}
public Handler getHandler()
@@ -551,6 +594,11 @@
{
return info;
}
+
+ public HandlerType getType()
+ {
+ return type;
+ }
}
// java.util.List interface ****************************************************************************************
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -171,6 +171,7 @@
QName[] headerArr = new QName[headers.size()];
headers.toArray(headerArr);
+ hConfig.put(HandlerType.class.getName(), uhmd.getHandlerType());
HandlerInfo info = new HandlerInfo(hClass, hConfig, headerArr);
log.debug("Adding server side handler to service '" + sepMetaData.getQName() + "': " + info);
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/handler/MessageContextJAXRPC.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -24,6 +24,7 @@
// $Id$
import javax.xml.rpc.handler.MessageContext;
+import javax.xml.soap.SOAPMessage;
import org.jboss.ws.binding.SerializationContext;
import org.jboss.ws.common.CommonMessageContext;
@@ -50,9 +51,21 @@
public static final String SERVLET_RESPONSE = "javax.xml.ws.servlet.response";
public static final String SERVLET_SESSION = "javax.xml.ws.servlet.session";
+ // The SOAP message
+ private SOAPMessage message;
// The serialization context for this message ctx
private SerializationContext serContext;
+ public SOAPMessage getMessage()
+ {
+ return message;
+ }
+
+ public void setMessage(SOAPMessage message)
+ {
+ this.message = message;
+ }
+
/** Get or create the serialization context
*/
public SerializationContext getSerializationContext()
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/SOAPMessageContextJAXRPC.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/handler/SOAPMessageContextJAXRPC.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/handler/SOAPMessageContextJAXRPC.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -26,19 +26,14 @@
import javax.xml.rpc.handler.soap.SOAPMessageContext;
import javax.xml.soap.SOAPMessage;
-import org.jboss.ws.common.SOAPMessageContextBase;
-
/**
* 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
+public class SOAPMessageContextJAXRPC extends MessageContextJAXRPC implements SOAPMessageContext
{
- // The current SOAPMessage, maybe a request or response message
- private SOAPMessage soapMessage;
-
/** Default constuctor
*/
public SOAPMessageContextJAXRPC()
@@ -51,7 +46,7 @@
*/
public SOAPMessage getMessage()
{
- return soapMessage;
+ return getSOAPMessage();
}
/** Sets the SOAPMessage in this message context
@@ -62,7 +57,7 @@
*/
public void setMessage(SOAPMessage message)
{
- this.soapMessage = message;
+ setSOAPMessage(message);
}
/**
Modified: trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -35,13 +35,14 @@
import javax.xml.ws.handler.MessageContext;
import org.jboss.ws.common.CommonClient;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxws.core.BindingImpl;
import org.jboss.ws.jaxws.handler.HandlerChainExecutor;
import org.jboss.ws.jaxws.handler.MessageContextJAXWS;
import org.jboss.ws.jaxws.handler.PortInfoImpl;
import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
import org.jboss.ws.soap.MessageContextAssociation;
/**
@@ -75,19 +76,19 @@
}
@Override
- protected boolean callRequestHandlerChain(QName portName)
+ protected boolean callRequestHandlerChain(QName portName, HandlerType type)
{
- List<Handler> handlerChain = getBindingProvider().getBinding().getHandlerChain();
- HandlerChainExecutor executor = new HandlerChainExecutor(epMetaData, handlerChain);
+ BindingImpl binding = (BindingImpl)getBindingProvider().getBinding();
+ HandlerChainExecutor executor = new HandlerChainExecutor(epMetaData, binding.getHandlerChain(type));
MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
return executor.handleRequest(msgContext);
}
@Override
- protected boolean callResponseHandlerChain(QName portName)
+ protected boolean callResponseHandlerChain(QName portName, HandlerType type)
{
- List<Handler> handlerChain = getBindingProvider().getBinding().getHandlerChain();
- HandlerChainExecutor executor = new HandlerChainExecutor(epMetaData, handlerChain);
+ BindingImpl binding = (BindingImpl)getBindingProvider().getBinding();
+ HandlerChainExecutor executor = new HandlerChainExecutor(epMetaData, binding.getHandlerChain(type));
MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
return executor.handleResponse(msgContext);
}
@@ -96,7 +97,7 @@
protected void setInboundContextProperties()
{
// Mark the message context as outbound
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setProperty(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new Boolean(false));
}
@@ -104,7 +105,7 @@
protected void setOutboundContextProperties()
{
// Mark the message context as outbound
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setProperty(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new Boolean(true));
}
@@ -113,6 +114,12 @@
// Associate a message context with the current thread
SOAPMessageContextJAXWS msgContext = new SOAPMessageContextJAXWS();
MessageContextAssociation.pushMessageContext(msgContext);
+
+ // The contents of the request context are used to initialize the message context (see section 9.4.1)
+ // prior to invoking any handlers (see chapter 9) for the outbound message. Each property within the
+ // request context is copied to the message context with a scope of HANDLER.
+ Map<String, Object> reqContext = getBindingProvider().getRequestContext();
+ msgContext.putAll(reqContext);
try
{
Modified: trunk/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -24,6 +24,7 @@
// $Id$
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -36,6 +37,7 @@
import org.jboss.ws.binding.EndpointInvocation;
import org.jboss.ws.binding.UnboundHeader;
import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
/**
* The Binding interface is the base interface for JAX-WS protocol bindings.
@@ -48,7 +50,9 @@
// provide logging
private static Logger log = Logger.getLogger(BindingImpl.class);
- private List<Handler> handlerChain = new ArrayList<Handler>();
+ private List<Handler> preHandlerChain = new ArrayList<Handler>();
+ private List<Handler> jaxwsHandlerChain = new ArrayList<Handler>();
+ private List<Handler> postHandlerChain = new ArrayList<Handler>();
/** On the client side, generate the Object from IN parameters. */
public abstract Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
@@ -63,15 +67,31 @@
public abstract void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
throws BindingException;
+ public List<Handler> getHandlerChain(HandlerType handlerType)
+ {
+ List<Handler> handlerChain = new ArrayList<Handler>();
+
+ if (handlerType == HandlerType.PRE || handlerType == HandlerType.ALL)
+ handlerChain.addAll(preHandlerChain);
+
+ if (handlerType == HandlerType.ENDPOINT || handlerType == HandlerType.ALL)
+ handlerChain.addAll(jaxwsHandlerChain);
+
+ if (handlerType == HandlerType.POST || handlerType == HandlerType.ALL)
+ handlerChain.addAll(postHandlerChain);
+
+ return Collections.unmodifiableList(handlerChain);
+ }
+
public List<Handler> getHandlerChain()
{
- log.debug("getHandlerChain: " + handlerChain);
- return handlerChain;
+ log.debug("getHandlerChain: " + jaxwsHandlerChain);
+ return jaxwsHandlerChain;
}
public void setHandlerChain(List<Handler> handlerChain)
{
log.debug("setHandlerChain: " + handlerChain);
- this.handlerChain = handlerChain;
+ this.jaxwsHandlerChain = handlerChain;
}
}
Modified: trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -37,7 +37,7 @@
import org.jboss.ws.binding.BindingException;
import org.jboss.ws.binding.EndpointInvocation;
import org.jboss.ws.binding.UnboundHeader;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxrpc.Use;
import org.jboss.ws.metadata.OperationMetaData;
import org.jboss.ws.soap.MessageContextAssociation;
@@ -89,7 +89,7 @@
// the soapAction attribute of soapbind:operation is either not present, or
// present with an empty string as its value.
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext.getProperty(Call.SOAPACTION_USE_PROPERTY) != null)
log.info("Ignore Call.SOAPACTION_USE_PROPERTY because of BP-1.0 R2745, R2745");
Modified: trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -57,7 +57,7 @@
import org.jboss.ws.binding.BindingException;
import org.jboss.ws.binding.EndpointInvocation;
import org.jboss.ws.binding.UnboundHeader;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxrpc.ParameterWrapping;
import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
import org.jboss.ws.jaxrpc.Style;
@@ -136,13 +136,13 @@
try
{
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext == null)
throw new WSException("MessageContext not available");
// Associate current message with message context
SOAPMessageImpl reqMessage = (SOAPMessageImpl)createMessage(opMetaData);
- msgContext.setMessage(reqMessage);
+ msgContext.setSOAPMessage(reqMessage);
SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
SOAPBody soapBody = soapEnvelope.getBody();
@@ -258,7 +258,7 @@
// Construct the endpoint invocation object
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext == null)
throw new WSException("MessageContext not available");
@@ -370,13 +370,13 @@
try
{
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext == null)
throw new WSException("MessageContext not available");
// Associate current message with message context
SOAPMessageImpl resMessage = (SOAPMessageImpl)createMessage(opMetaData);
- msgContext.setMessage(resMessage);
+ msgContext.setSOAPMessage(resMessage);
// R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response that contains a SOAP envelope.
// Specifically, the HTTP response entity-body must be empty.
@@ -522,7 +522,7 @@
verifySOAPVersion(opMetaData, soapEnvelope);
// Get the SOAP message context that is associated with the current thread
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext == null)
throw new WSException("MessageContext not available");
@@ -731,7 +731,7 @@
// Make sure we have a prefix on qualified names
if (xmlName.getNamespaceURI().length() > 0)
{
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
xmlName = namespaceRegistry.registerQName(xmlName);
}
@@ -773,8 +773,8 @@
if (paramMetaData.isXOP())
{
log.trace("Add parameter as XOP");
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
soapMessage.setXOPMessage(true);
}
@@ -812,8 +812,8 @@
if (soapArrayName.equals(elName))
{
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- msgContext.setProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ msgContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
try
{
QName compXMLName = paramMetaData.getXmlName();
@@ -827,7 +827,7 @@
}
finally
{
- msgContext.removeProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM);
+ msgContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
}
}
}
@@ -868,7 +868,7 @@
if (paramMetaData.isXOP())
{
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)MessageContextAssociation.peekMessageContext().getMessage();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)MessageContextAssociation.peekMessageContext().getSOAPMessage();
soapMessage.setXOPMessage(true);
}
return soapContentElement;
Modified: trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -34,11 +34,11 @@
import javax.xml.ws.handler.MessageContext;
import org.jboss.logging.Logger;
-import org.jboss.ws.utils.DOMWriter;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxrpc.Style;
import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.soap.SOAPEnvelopeImpl;
+import org.jboss.ws.utils.DOMWriter;
/**
* Executes a list of JAXWS handlers.
@@ -92,30 +92,29 @@
log.debug("Enter: handleRequest");
SOAPMessageContextJAXWS soapContext = (SOAPMessageContextJAXWS)msgContext;
- soapContext.setProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+ soapContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
int handlerIndex = 0;
Handler currHandler = null;
try
{
+ String lastMessageTrace = null;
for (; doNext && handlerIndex < handlers.size(); handlerIndex++)
{
- String lastMessageTrace = null;
+ currHandler = handlers.get(handlerIndex);
+
if (log.isTraceEnabled())
{
SOAPPart soapPart = soapContext.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+ lastMessageTrace = traceSOAPPart("BEFORE handleRequest - " + currHandler, soapPart, lastMessageTrace);
}
- currHandler = handlers.get(handlerIndex);
-
- log.debug("Handle request: " + currHandler);
doNext = handleMessage(currHandler, soapContext);
if (log.isTraceEnabled())
{
SOAPPart soapPart = soapContext.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+ lastMessageTrace = traceSOAPPart("AFTER handleRequest - " + currHandler, soapPart, lastMessageTrace);
}
}
}
@@ -131,7 +130,7 @@
if (doNext == false)
falseIndex = (handlerIndex - 1);
- soapContext.removeProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM);
+ soapContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
log.debug("Exit: handleRequest with status: " + doNext);
}
}
@@ -144,7 +143,7 @@
boolean doNext = true;
SOAPMessageContextJAXWS soapContext = (SOAPMessageContextJAXWS)msgContext;
- soapContext.setProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+ soapContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
if (handlers.size() > 0)
{
@@ -157,24 +156,23 @@
Handler currHandler = null;
try
{
+ String lastMessageTrace = null;
for (; doNext && handlerIndex >= 0; handlerIndex--)
{
- String lastMessageTrace = null;
+ currHandler = handlers.get(handlerIndex);
+
if (log.isTraceEnabled())
{
SOAPPart soapPart = soapContext.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+ lastMessageTrace = traceSOAPPart("BEFORE handleResponse - " + currHandler, soapPart, lastMessageTrace);
}
- currHandler = handlers.get(handlerIndex);
-
- log.debug("Handle response: " + currHandler);
doNext = handleMessage(currHandler, soapContext);
if (log.isTraceEnabled())
{
SOAPPart soapPart = soapContext.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+ lastMessageTrace = traceSOAPPart("AFTER handleResponse - " + currHandler, soapPart, lastMessageTrace);
}
}
}
@@ -190,7 +188,7 @@
if (doNext == false)
falseIndex = (handlerIndex - 1);
- soapContext.removeProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM);
+ soapContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
log.debug("Exit: handleResponse with status: " + doNext);
}
}
@@ -207,29 +205,29 @@
log.debug("Enter: handleFault");
SOAPMessageContextJAXWS soapContext = (SOAPMessageContextJAXWS)msgContext;
- soapContext.setProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+ soapContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
int handlerIndex = 0;
Handler currHandler = null;
try
{
+ String lastMessageTrace = null;
for (; doNext && handlerIndex < handlers.size(); handlerIndex++)
{
- String lastMessageTrace = null;
+ currHandler = handlers.get(handlerIndex);
+
if (log.isTraceEnabled())
{
SOAPPart soapPart = soapContext.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+ lastMessageTrace = traceSOAPPart("BEFORE handleFault - " + currHandler, soapPart, lastMessageTrace);
}
- currHandler = handlers.get(handlerIndex);
- log.debug("Handle fault: " + currHandler);
doNext = handleFault(currHandler, soapContext);
if (log.isTraceEnabled())
{
SOAPPart soapPart = soapContext.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+ lastMessageTrace = traceSOAPPart("AFTER handleFault - " + currHandler, soapPart, lastMessageTrace);
}
}
}
@@ -245,7 +243,7 @@
if (doNext == false)
falseIndex = (handlerIndex - 1);
- soapContext.removeProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM);
+ soapContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
log.debug("Exit: handleFault with status: " + doNext);
}
}
@@ -284,16 +282,21 @@
/**
* Trace the SOAPPart, do nothing if the String representation is equal to the last one.
+ * @param logMsg TODO
*/
- protected String traceSOAPPart(SOAPPart soapPart, String lastMessageTrace)
+ protected String traceSOAPPart(String logMsg, SOAPPart soapPart, String lastMessageTrace)
{
try
{
SOAPEnvelopeImpl soapEnv = (SOAPEnvelopeImpl)soapPart.getEnvelope();
String envString = DOMWriter.printNode(soapEnv, true);
- if (envString.equals(lastMessageTrace) == false)
+ if (envString.equals(lastMessageTrace))
{
- log.debug(envString);
+ log.trace(logMsg + ": unchanged");
+ }
+ else
+ {
+ log.trace(logMsg + "\n" + envString);
lastMessageTrace = envString;
}
return lastMessageTrace;
Modified: trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerDelegateJAXWS.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerDelegateJAXWS.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerDelegateJAXWS.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -58,6 +58,7 @@
public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
{
+ log.debug("callRequestHandlerChain: " + type);
SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
EndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
@@ -77,6 +78,7 @@
public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
{
+ log.debug("callResponseHandlerChain: " + type);
SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
List<Handler> handlerChain = getHandlerChain(epMetaData, type);
@@ -86,6 +88,7 @@
public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex)
{
+ log.debug("callFaultHandlerChain: " + type);
SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
List<Handler> handlerChain = getHandlerChain(epMetaData, type);
Modified: trunk/src/main/java/org/jboss/ws/jaxws/handler/LogicalMessageImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/handler/LogicalMessageImpl.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jaxws/handler/LogicalMessageImpl.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -24,16 +24,17 @@
// $Id$
import java.io.StringReader;
+import java.util.Iterator;
import javax.xml.bind.JAXBContext;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.LogicalMessage;
import javax.xml.ws.WebServiceException;
-import org.jboss.util.NotImplementedException;
import org.jboss.ws.soap.SOAPBodyImpl;
import org.jboss.ws.soap.SOAPContentElement;
@@ -47,7 +48,7 @@
public class LogicalMessageImpl implements LogicalMessage
{
private SOAPBodyImpl soapBody;
-
+
public LogicalMessageImpl(SOAPMessage soapMessage)
{
try
@@ -65,16 +66,16 @@
Source source = soapBody.getPayload();
if (source == null)
{
- try
+ SOAPContentElement soapElement = (SOAPContentElement)soapBody.getChildElements().next();
+ if (soapElement.isDOMValid())
{
- SOAPContentElement soapElement = (SOAPContentElement)soapBody.getChildElements().next();
+ source = new DOMSource(soapElement);
+ }
+ else
+ {
String xmlPayload = soapElement.getXMLFragment();
source = new StreamSource(new StringReader(xmlPayload));
}
- catch (SOAPException ex)
- {
- throw new WebServiceException("Cannot obtain xml payload", ex);
- }
}
return source;
}
@@ -86,11 +87,23 @@
public Object getPayload(JAXBContext jaxbContext)
{
- throw new NotImplementedException();
+ Object payload = null;
+ Iterator it = soapBody.getChildElements();
+ if (it.hasNext())
+ {
+ SOAPContentElement bodyElement = (SOAPContentElement)it.next();
+ payload = bodyElement.getObjectValue();
+ }
+ return payload;
}
- public void setPayload(Object obj, JAXBContext jaxbContext)
+ public void setPayload(Object payload, JAXBContext jaxbContext)
{
- throw new NotImplementedException();
+ Iterator it = soapBody.getChildElements();
+ if (it.hasNext())
+ {
+ SOAPContentElement bodyElement = (SOAPContentElement)it.next();
+ bodyElement.setObjectValue(payload);
+ }
}
}
Modified: trunk/src/main/java/org/jboss/ws/jaxws/handler/SOAPMessageContextJAXWS.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/handler/SOAPMessageContextJAXWS.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jaxws/handler/SOAPMessageContextJAXWS.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -39,7 +39,7 @@
import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.soap.SOAPMessageContext;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
/**
* The interface SOAPMessageContext provides access to the SOAP message for either RPC request or response.
@@ -48,10 +48,8 @@
* @author Thomas.Diesler at jboss.org
* @since 25-Jul-2006
*/
-public class SOAPMessageContextJAXWS extends MessageContextJAXWS implements SOAPMessageContext, SOAPMessageContextBase
+public class SOAPMessageContextJAXWS extends MessageContextJAXWS implements SOAPMessageContext
{
- // The SOAPMessage in this message context
- private SOAPMessage soapMessage;
// The SOAP actor roles
private Set<URI> roles = new HashSet<URI>();
@@ -66,7 +64,7 @@
*/
public SOAPMessage getMessage()
{
- return soapMessage;
+ return getSOAPMessage();
}
/**
@@ -74,7 +72,7 @@
*/
public void setMessage(SOAPMessage soapMessage)
{
- this.soapMessage = soapMessage;
+ setSOAPMessage(soapMessage);
}
/**
@@ -85,11 +83,11 @@
{
List<Object> headers = new ArrayList<Object>();
- if (soapMessage != null)
+ if (getSOAPMessage() != null)
{
try
{
- SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+ SOAPHeader soapHeader = getSOAPMessage().getSOAPHeader();
Iterator<SOAPHeaderElement> headerElements = soapHeader.examineAllHeaderElements();
while (headerElements.hasNext())
{
Modified: trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSupport.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSupport.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/jbossxb/JBossXBSupport.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -4,7 +4,7 @@
import javax.xml.namespace.QName;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.metadata.OperationMetaData;
import org.jboss.ws.metadata.ServiceMetaData;
@@ -46,7 +46,7 @@
QName xmlType = (QName)properties.get(JBossXBConstants.JBXB_TYPE_QNAME);
// Get the eagerly initialized SchameBinding from the ServiceMetaData
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext != null)
{
OperationMetaData opMetaData = msgContext.getOperationMetaData();
Modified: trunk/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -73,6 +73,7 @@
clientConfig = null;
}
+ @Override
public List<UnifiedHandlerMetaData> getHandlers(HandlerType type)
{
ArrayList<UnifiedHandlerMetaData> handlers = new ArrayList<UnifiedHandlerMetaData>();
Modified: trunk/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -165,6 +165,7 @@
this.managedEndpointBean = managedEndpointBean;
}
+ @Override
public List<UnifiedHandlerMetaData> getHandlers(HandlerType type)
{
ArrayList<UnifiedHandlerMetaData> handlers = new ArrayList<UnifiedHandlerMetaData>();
Modified: trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/metadata/config/jaxrpc/WSConfigFactoryJAXRPC.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -28,6 +28,7 @@
import org.jboss.logging.Logger;
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.metadata.jsr181.HandlerChainMetaData;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.UnmarshallingContext;
@@ -96,13 +97,13 @@
if ("pre-handler-chain".equals(localName))
{
- HandlerChainMetaData preHandlerChain = new HandlerChainMetaData(null);
+ HandlerChainMetaData preHandlerChain = new HandlerChainMetaData(null, HandlerType.PRE);
wsCommonConfig.setPreHandlerChain(preHandlerChain);
return preHandlerChain;
}
if ("post-handler-chain".equals(localName))
{
- HandlerChainMetaData postHandlerChain = new HandlerChainMetaData(null);
+ HandlerChainMetaData postHandlerChain = new HandlerChainMetaData(null, HandlerType.POST);
wsCommonConfig.setPostHandlerChain(postHandlerChain);
return postHandlerChain;
}
@@ -117,7 +118,7 @@
log.trace("WSHandlerChainConfig newChild: " + localName);
if ("handler".equals(localName))
{
- UnifiedHandlerMetaData handler = new UnifiedHandlerMetaData(handlerChainMetaData);
+ UnifiedHandlerMetaData handler = new UnifiedHandlerMetaData(handlerChainMetaData, handlerChainMetaData.getHandlerType());
List<UnifiedHandlerMetaData> handlers = handlerChainMetaData.getHandlers();
handlers.add(handler);
return handler;
Modified: trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigFactoryJAXWS.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigFactoryJAXWS.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSConfigFactoryJAXWS.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -24,6 +24,7 @@
//$Id$
import org.jboss.logging.Logger;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
import org.jboss.ws.metadata.jsr181.HandlerChainFactory;
import org.jboss.ws.metadata.jsr181.HandlerChainMetaData;
import org.jboss.xb.binding.UnmarshallingContext;
@@ -92,13 +93,13 @@
if ("pre-handler-chains".equals(localName))
{
- WSHandlerChainsConfigJAXWS preHandlerChains = new WSHandlerChainsConfigJAXWS();
+ WSHandlerChainsConfigJAXWS preHandlerChains = new WSHandlerChainsConfigJAXWS(HandlerType.PRE);
wsCommonConfig.setPreHandlerChains(preHandlerChains);
return preHandlerChains;
}
if ("post-handler-chains".equals(localName))
{
- WSHandlerChainsConfigJAXWS postHandlerChains = new WSHandlerChainsConfigJAXWS();
+ WSHandlerChainsConfigJAXWS postHandlerChains = new WSHandlerChainsConfigJAXWS(HandlerType.POST);
wsCommonConfig.setPostHandlerChains(postHandlerChains);
return postHandlerChains;
}
@@ -114,7 +115,7 @@
if ("handler-chain".equals(localName))
{
- HandlerChainMetaData handlerChain = new HandlerChainMetaData(null);
+ HandlerChainMetaData handlerChain = new HandlerChainMetaData(null, wsHandlerChains.getHandlerType());
wsHandlerChains.getHandlerChains().add(handlerChain);
return handlerChain;
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSHandlerChainsConfigJAXWS.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSHandlerChainsConfigJAXWS.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/metadata/config/jaxws/WSHandlerChainsConfigJAXWS.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -24,6 +24,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
import org.jboss.ws.metadata.jsr181.HandlerChainMetaData;
@@ -35,8 +36,19 @@
*/
public class WSHandlerChainsConfigJAXWS
{
+ private HandlerType handlerType;
private List<HandlerChainMetaData> chains = new ArrayList<HandlerChainMetaData>();
+ public WSHandlerChainsConfigJAXWS(HandlerType handlerType)
+ {
+ this.handlerType = handlerType;
+ }
+
+ public HandlerType getHandlerType()
+ {
+ return handlerType;
+ }
+
public List<HandlerChainMetaData> getHandlerChains()
{
return chains;
Modified: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -51,6 +51,8 @@
private String handlerName;
// The required <handler-class> element
private String handlerClass;
+ // The required handler type
+ private HandlerType handlerType;
// The optional <init-param> elements
private ArrayList<UnifiedInitParamMetaData> initParams = new ArrayList<UnifiedInitParamMetaData>();
// The optional <soap-header> elements
@@ -60,9 +62,10 @@
// The optional <port-name> elements
private Set<String> portNames = new HashSet<String>();
- public UnifiedHandlerMetaData(HandlerChainMetaData handlerChainMetaData)
+ public UnifiedHandlerMetaData(HandlerChainMetaData handlerChainMetaData, HandlerType type)
{
this.chainConfig = handlerChainMetaData;
+ this.handlerType = type;
}
public void setHandlerName(String value)
@@ -85,6 +88,11 @@
return handlerClass;
}
+ public HandlerType getHandlerType()
+ {
+ return handlerType;
+ }
+
public void addInitParam(UnifiedInitParamMetaData param)
{
initParams.add(param);
@@ -149,6 +157,7 @@
StringBuffer buffer = new StringBuffer("\nHandlerMetaData:");
buffer.append("\n name=" + getHandlerName());
buffer.append("\n class=" + getHandlerClass());
+ buffer.append("\n type=" + getHandlerType());
buffer.append("\n params=" + getInitParams());
buffer.append("\n headers=" + getSoapHeaders());
buffer.append("\n roles=" + getSoapRoles());
Modified: trunk/src/main/java/org/jboss/ws/metadata/jsr109/WebservicesFactory.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/jsr109/WebservicesFactory.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/metadata/jsr109/WebservicesFactory.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -28,6 +28,7 @@
import org.jboss.logging.Logger;
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.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.UnmarshallingContext;
import org.xml.sax.Attributes;
@@ -111,7 +112,7 @@
public Object newChild(PortComponentMetaData portComponent, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
{
if ("handler".equals(localName))
- return new UnifiedHandlerMetaData(null);
+ return new UnifiedHandlerMetaData(null, HandlerType.ENDPOINT);
else return null;
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainFactory.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -26,6 +26,7 @@
import org.jboss.logging.Logger;
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.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.UnmarshallingContext;
import org.xml.sax.Attributes;
@@ -52,7 +53,7 @@
*/
public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
{
- HandlerChainsMetaData handlerConfigMetaData = new HandlerChainsMetaData();
+ HandlerChainsMetaData handlerConfigMetaData = new HandlerChainsMetaData(HandlerType.ENDPOINT);
return handlerConfigMetaData;
}
@@ -67,7 +68,7 @@
public Object newChild(HandlerChainsMetaData handlerConfig, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
{
if ("handler-chain".equals(localName))
- return new HandlerChainMetaData(handlerConfig);
+ return new HandlerChainMetaData(handlerConfig, handlerConfig.getHandlerType());
else
return null;
}
@@ -86,7 +87,7 @@
public Object newChild(HandlerChainMetaData chainConfig, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
{
if ("handler".equals(localName))
- return new UnifiedHandlerMetaData(chainConfig);
+ return new UnifiedHandlerMetaData(chainConfig, chainConfig.getHandlerType());
else
return null;
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainMetaData.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainMetaData.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -31,6 +31,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
/**
* XML Binding element for handler-config/handler-chain elements
@@ -43,24 +44,31 @@
// provide logging
private static final Logger log = Logger.getLogger(HandlerChainMetaData.class);
- // The parent <handler-config> element
- private HandlerChainsMetaData handlerConfig;
+ // The parent element
+ private HandlerChainsMetaData handlerChainsMetaData;
private String protocolBindings;
private QName serviceNamePattern;
private QName portNamePattern;
+ private HandlerType handlerType;
private ArrayList<UnifiedHandlerMetaData> handlers = new ArrayList<UnifiedHandlerMetaData>();
- public HandlerChainMetaData(HandlerChainsMetaData handlerConfig)
+ public HandlerChainMetaData(HandlerChainsMetaData handlerConfig, HandlerType handlerType)
{
- this.handlerConfig = handlerConfig;
+ this.handlerChainsMetaData = handlerConfig;
+ this.handlerType = handlerType;
}
- public HandlerChainsMetaData getHandlerConfig()
+ public HandlerChainsMetaData getHandlerChainsMetaData()
{
- return handlerConfig;
+ return handlerChainsMetaData;
}
+ public HandlerType getHandlerType()
+ {
+ return handlerType;
+ }
+
public void addHandler(UnifiedHandlerMetaData handlerMetaData)
{
handlers.add(handlerMetaData);
Modified: trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/metadata/jsr181/HandlerChainsMetaData.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -24,9 +24,10 @@
//$Id$
-import java.net.URL;
import java.util.ArrayList;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
+
/**
* XML Binding root element for JSR-181 HandlerChain
*
@@ -35,9 +36,22 @@
*/
public class HandlerChainsMetaData
{
+ // The required handler type
+ private HandlerType handlerType;
// The required <handler-chain> elements
private ArrayList<HandlerChainMetaData> handlerChains = new ArrayList<HandlerChainMetaData>();
+ public HandlerChainsMetaData(HandlerType handlerType)
+ {
+ this.handlerType = handlerType;
+ }
+
+ public HandlerType getHandlerType()
+ {
+ return handlerType;
+ }
+
+
public void addHandlerChain(HandlerChainMetaData handlerChain)
{
handlerChains.add(handlerChain);
Modified: trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -42,7 +42,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
import org.jboss.ws.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.jaxws.core.BindingImpl;
@@ -53,6 +53,7 @@
import org.jboss.ws.metadata.ServerEndpointMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.soap.SOAPBodyImpl;
import org.jboss.ws.soap.SOAPMessageImpl;
import org.jboss.ws.utils.JavaUtils;
@@ -117,9 +118,9 @@
/** Invoke the the service endpoint */
public SOAPMessage invoke(ServiceEndpointInfo seInfo, Object context) throws Exception
{
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
- SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgContext.getMessage();
+ SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
// Load the endpoint implementation bean
Class seImpl = loadServiceEndpoint(seInfo);
@@ -130,34 +131,49 @@
try
{
boolean oneway = false;
+ BindingImpl binding = null;
+ EndpointInvocation epInv = null;
+ OperationMetaData opMetaData = null;
// call the handler chain
boolean handlersPass = callRequestHandlerChain(seInfo, HandlerType.PRE);
- handlersPass = handlersPass && callRequestHandlerChain(seInfo, HandlerType.ENDPOINT);
- handlersPass = handlersPass && callRequestHandlerChain(seInfo, HandlerType.POST);
-
+
+ // Unbind the request message
if (handlersPass)
{
// Get the binding from the provideer
- BindingImpl binding = (BindingImpl)bindingProvider.getBinding();
+ binding = (BindingImpl)bindingProvider.getBinding();
// Get the operation meta data from the SOAP message
- OperationMetaData opMetaData = getDispatchDestination(epMetaData, reqMessage);
+ opMetaData = getDispatchDestination(epMetaData, reqMessage);
msgContext.setOperationMetaData(opMetaData);
oneway = opMetaData.isOneWayOperation();
// Unbind the request message
- EndpointInvocation epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ }
+
+ handlersPass = handlersPass && callRequestHandlerChain(seInfo, HandlerType.ENDPOINT);
+ handlersPass = handlersPass && callRequestHandlerChain(seInfo, HandlerType.POST);
+ // Check if protocol handlers modified the payload
+ if (((SOAPBodyImpl)reqMessage.getSOAPBody()).isModifiedFromSource())
+ {
+ log.debug("Handler modified body payload, unbind message again");
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ }
+
+ if (handlersPass)
+ {
// Invoke the service endpoint
- msgContext.setProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+ msgContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
try
{
invokeServiceEndpoint(seInfo, seInstance, epInv);
}
finally
{
- msgContext.removeProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM);
+ msgContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
}
// Set the outbound property
@@ -166,7 +182,7 @@
// Bind the response message
SOAPMessage resMessage = (SOAPMessage)binding.bindResponseMessage(opMetaData, epInv);
- msgContext.setMessage(resMessage);
+ msgContext.setSOAPMessage(resMessage);
}
// call the handler chain
@@ -177,7 +193,7 @@
handlersPass = handlersPass && callResponseHandlerChain(seInfo, HandlerType.PRE);
}
- SOAPMessage resMessage = msgContext.getMessage();
+ SOAPMessage resMessage = msgContext.getSOAPMessage();
return resMessage;
}
catch (Exception ex)
@@ -185,7 +201,7 @@
try
{
SOAPMessage faultMessage = SOAPFaultExceptionHelper.exceptionToFaultMessage(ex);
- msgContext.setMessage(faultMessage);
+ msgContext.setSOAPMessage(faultMessage);
// call the handler chain
boolean handlersPass = handlerDelegate.callFaultHandlerChain(seInfo, HandlerType.POST, ex);
Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -40,7 +40,7 @@
import org.jboss.ws.utils.DOMWriter;
import org.jboss.ws.Constants;
import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.metadata.ServerEndpointMetaData;
@@ -145,7 +145,7 @@
*/
public SOAPMessage handleRequest(HeaderSource headerSource, EndpointContext context, InputStream inputStream) throws BindingException
{
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
long beginProcessing = 0;
@@ -171,7 +171,7 @@
SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers, inputStream);
// Associate current message with message context
- msgContext.setMessage(reqMessage);
+ msgContext.setSOAPMessage(reqMessage);
// debug the incomming message
if (msgLog.isTraceEnabled())
@@ -195,14 +195,14 @@
}
catch (Exception ex)
{
- SOAPMessage resMessage = msgContext.getMessage();
+ SOAPMessage resMessage = msgContext.getSOAPMessage();
// In case we have an exception before the invoker is called
// we create the fault message here.
if (resMessage == null || ((SOAPMessageImpl)resMessage).isFaultMessage() == false)
{
resMessage = SOAPFaultExceptionHelper.exceptionToFaultMessage(ex);
- msgContext.setMessage(resMessage);
+ msgContext.setSOAPMessage(resMessage);
}
postProcessResponse(headerSource, resMessage);
@@ -212,7 +212,7 @@
{
try
{
- SOAPMessage soapMessage = msgContext.getMessage();
+ SOAPMessage soapMessage = msgContext.getSOAPMessage();
if (soapMessage != null && soapMessage.getSOAPPart().getEnvelope() != null)
{
if (soapMessage.getSOAPPart().getEnvelope().getBody().getFault() != null)
Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvokerJSE.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvokerJSE.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvokerJSE.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -33,7 +33,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxrpc.ServletEndpointContextImpl;
import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.metadata.ServerEndpointMetaData;
@@ -86,7 +86,7 @@
log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
try
{
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext instanceof SOAPMessageContextJAXWS)
MessageContextInjector.injectMessageContext(seiImpl, (SOAPMessageContextJAXWS)msgContext);
Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -59,7 +59,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.ws.addressing.AddressingConstantsImpl;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxrpc.handler.MessageContextJAXRPC;
import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.jaxws.handler.MessageContextJAXWS;
@@ -353,7 +353,7 @@
ServletHeaderSource headerSource = new ServletHeaderSource(httpRequest, httpResponse);
// Associate a message context with the current thread
- SOAPMessageContextBase msgContext;
+ CommonMessageContext msgContext;
if (type == EndpointMetaData.Type.JAXRPC)
{
msgContext = new SOAPMessageContextJAXRPC();
@@ -422,9 +422,9 @@
}
}
- private void sendResponse(OutputStream outputStream, SOAPMessageContextBase msgContext, boolean isFault) throws SOAPException, IOException
+ private void sendResponse(OutputStream outputStream, CommonMessageContext msgContext, boolean isFault) throws SOAPException, IOException
{
- SOAPMessage soapMessage = msgContext.getMessage();
+ SOAPMessage soapMessage = msgContext.getSOAPMessage();
String wsaTo = null;
// Get the destination from the AddressingProperties
Modified: trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -26,7 +26,7 @@
import java.util.Stack;
import org.jboss.logging.Logger;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.utils.ThreadLocalAssociation;
/**
@@ -41,22 +41,22 @@
private static Logger log = Logger.getLogger(MessageContextAssociation.class);
- public static void pushMessageContext(SOAPMessageContextBase msgContext)
+ public static void pushMessageContext(CommonMessageContext msgContext)
{
log.debug("pushMessageContext: " + msgContext);
- Stack<SOAPMessageContextBase> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
+ Stack<CommonMessageContext> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
if (stack == null)
{
- stack = new Stack<SOAPMessageContextBase>();
+ stack = new Stack<CommonMessageContext>();
ThreadLocalAssociation.localMsgContextAssoc().set(stack);
}
stack.push(msgContext);
}
- public static SOAPMessageContextBase peekMessageContext()
+ public static CommonMessageContext peekMessageContext()
{
- SOAPMessageContextBase msgContext = null;
- Stack<SOAPMessageContextBase> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
+ CommonMessageContext msgContext = null;
+ Stack<CommonMessageContext> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
if (stack != null && stack.isEmpty() == false)
{
msgContext = stack.peek();
@@ -64,10 +64,10 @@
return msgContext;
}
- public static SOAPMessageContextBase popMessageContext()
+ public static CommonMessageContext popMessageContext()
{
- SOAPMessageContextBase msgContext = null;
- Stack<SOAPMessageContextBase> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
+ CommonMessageContext msgContext = null;
+ Stack<CommonMessageContext> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
if (stack != null && stack.isEmpty() == false)
{
msgContext = stack.pop();
Modified: trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -42,7 +42,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxrpc.Style;
import org.jboss.ws.soap.attachment.MimeConstants;
import org.jboss.ws.soap.attachment.MultipartRelatedDecoder;
@@ -88,7 +88,7 @@
{
if (style == null)
{
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext != null && msgContext.getOperationMetaData() != null)
{
style = msgContext.getOperationMetaData().getStyle();
Modified: trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -46,10 +46,12 @@
import javax.xml.transform.stream.StreamSource;
import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.common.CommonMessageContext;
+import org.jboss.ws.metadata.UnifiedMetaData;
import org.jboss.ws.utils.DOMUtils;
import org.jboss.ws.utils.DOMWriter;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
@@ -74,14 +76,24 @@
// Generic JAXWS payload
private Source payload;
- private boolean expanded;
+ private boolean isDOMValid = true;
+ private boolean isModifiedFromSource;
public SOAPBodyImpl(String prefix, String namespace)
{
super("Body", prefix, namespace);
- this.expanded = true;
}
+ public boolean isDOMValid()
+ {
+ return isDOMValid;
+ }
+
+ public boolean isModifiedFromSource()
+ {
+ return isModifiedFromSource;
+ }
+
public Source getPayload()
{
return payload;
@@ -92,12 +104,13 @@
log.debug("setPayload: " + payload.getClass().getName());
removeContents();
this.payload = payload;
- this.expanded = false;
+ this.isDOMValid = false;
}
/** Convert the child into a SOAPBodyElement */
public SOAPElement addChildElement(SOAPElement child) throws SOAPException
{
+ log.trace("addChildElement: " + child.getElementName());
expandToDOM();
if ((child instanceof SOAPBodyElement) == false)
child = convertToBodyElement(child);
@@ -108,6 +121,7 @@
public SOAPBodyElement addBodyElement(Name name) throws SOAPException
{
+ log.trace("addBodyElement: " + name);
expandToDOM();
SOAPBodyElement child = new SOAPBodyElementDoc(name);
return (SOAPBodyElement)addChildElement(child);
@@ -115,6 +129,7 @@
public SOAPBodyElement addDocument(Document doc) throws SOAPException
{
+ log.trace("addDocument");
expandToDOM();
Element rootElement = doc.getDocumentElement();
SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
@@ -124,6 +139,7 @@
public SOAPFault addFault() throws SOAPException
{
+ log.trace("addFault");
expandToDOM();
if (hasFault())
throw new SOAPException("A SOAPBody may contain at most one SOAPFault child element");
@@ -133,6 +149,7 @@
public SOAPFault addFault(Name faultCode, String faultString) throws SOAPException
{
+ log.trace("addFault");
expandToDOM();
if (hasFault())
throw new SOAPException("A SOAPBody may contain at most one SOAPFault child element");
@@ -146,6 +163,7 @@
public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException
{
+ log.trace("addFault");
expandToDOM();
if (hasFault())
throw new SOAPException("A SOAPBody may contain at most one SOAPFault child element");
@@ -159,6 +177,7 @@
public SOAPFault getFault()
{
+ log.trace("getFault");
expandToDOM();
Iterator it = getChildElements(new NameImpl("Fault", Constants.PREFIX_ENV, getSOAPEnvelope().getNamespaceURI()));
return (it.hasNext() ? (SOAPFault)it.next() : null);
@@ -166,12 +185,14 @@
public boolean hasFault()
{
+ log.trace("hasFault");
expandToDOM();
return getChildElements(Constants.SOAP11_FAULT).hasNext();
}
public Node appendChild(Node newChild) throws DOMException
{
+ log.trace("appendChild: " + newChild.getNodeName());
expandToDOM();
Node retNode;
if (!(newChild instanceof SOAPBodyElement || newChild instanceof DocumentFragment))
@@ -184,6 +205,7 @@
public Node insertBefore(Node newChild, Node refChild) throws DOMException
{
+ log.trace("insertBefore: " + newChild.getNodeName());
expandToDOM();
if (!(newChild instanceof SOAPBodyElement || newChild instanceof DocumentFragment))
newChild = convertToBodyElement(newChild);
@@ -193,6 +215,7 @@
public Node replaceChild(Node newChild, Node oldChild) throws DOMException
{
+ log.trace("replaceChild: " + newChild.getNodeName());
expandToDOM();
if (!(newChild instanceof SOAPBodyElement || newChild instanceof DocumentFragment))
{
@@ -204,36 +227,42 @@
public Iterator getChildElements()
{
+ log.trace("getChildElements");
expandToDOM();
return super.getChildElements();
}
public Iterator getChildElements(Name name)
{
+ log.trace("getChildElements: " + name);
expandToDOM();
return super.getChildElements(name);
}
public NodeList getChildNodes()
{
+ log.trace("getChildNodes");
expandToDOM();
return super.getChildNodes();
}
public Node getFirstChild()
{
+ log.trace("getFirstChild");
expandToDOM();
return super.getFirstChild();
}
public Node getLastChild()
{
+ log.trace("getLastChild");
expandToDOM();
return super.getLastChild();
}
public boolean hasChildNodes()
{
+ log.trace("hasChildNodes");
expandToDOM();
return super.hasChildNodes();
}
@@ -250,14 +279,21 @@
private void expandToDOM()
{
- if (expanded == false)
+ if (isDOMValid == false)
{
- // This should only happen when a handler accesses the DOM API.
- // Warn if this is not a final release.
- // if (UnifiedMetaData.isFinalRelease() == false)
- // log.warn("Expanding soap body to DOM", new WSException());
+ // DOM expansion should only happen when a handler accesses the DOM API.
+ // We do not allow DOM expansion on a dev release.
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext != null && UnifiedMetaData.isDevRelease())
+ {
+ Boolean allowExpand = (Boolean)msgContext.getProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
+ if (Boolean.TRUE.equals(allowExpand) == false)
+ throw new WSException("Expanding content element to DOM");
+ }
- expanded = true;
+ log.trace("BEGIN expandToDOM");
+
+ isDOMValid = true;
try
{
Element child = getBodyElementFromSource();
@@ -267,14 +303,19 @@
}
catch (RuntimeException rte)
{
- expanded = false;
+ isDOMValid = false;
throw rte;
}
catch (Exception ex)
{
- expanded = false;
+ isDOMValid = false;
throw new WSException("Cannot expand to DOM" + ex);
}
+ finally
+ {
+ isModifiedFromSource = true;
+ log.trace("END expandToDOM");
+ }
}
}
Modified: trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -44,7 +44,7 @@
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.common.CommonMessageContext;
import org.jboss.ws.jaxrpc.TypeMappingImpl;
import org.jboss.ws.jaxrpc.encoding.DeserializerFactoryBase;
import org.jboss.ws.jaxrpc.encoding.NullValueSerializer;
@@ -133,9 +133,24 @@
{
return getParamMetaData().getJavaType();
}
+
+ public boolean isDOMValid()
+ {
+ return isDOMValid;
+ }
- public String getXMLFragment() throws SOAPException
+ public boolean isObjectValid()
{
+ return isObjectValid;
+ }
+
+ public boolean isFragmentValid()
+ {
+ return xmlFragment != null;
+ }
+
+ public String getXMLFragment()
+ {
// Serialize the valueContent
if (xmlFragment == null && isObjectValid)
{
@@ -145,7 +160,7 @@
Class javaType = getJavaType();
log.debug("getXMLFragment from Object [xmlType=" + xmlType + ",javaType=" + javaType + "]");
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext == null)
throw new WSException("MessageContext not available");
@@ -169,8 +184,8 @@
}
xmlFragment = ser.serialize(xmlName, xmlType, getObjectValue(), serContext, null);
-
log.debug("xmlFragment: " + xmlFragment);
+ invalidateObjectContent();
}
catch (BindingException e)
{
@@ -184,6 +199,7 @@
log.debug("getXMLFragment from DOM");
xmlFragment = DOMWriter.printNode(this, false);
log.debug("xmlFragment: " + xmlFragment);
+ invalidateDOMContent();
}
if (xmlFragment == null || xmlFragment.startsWith("<") == false)
@@ -207,7 +223,7 @@
invalidateObjectContent();
}
- public Object getObjectValue() throws SOAPException
+ public Object getObjectValue()
{
if (isObjectValid == false)
{
@@ -217,7 +233,7 @@
log.debug("getObjectValue [xmlType=" + xmlType + ",javaType=" + javaType + "]");
assertContentMapping();
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext == null)
throw new WSException("MessageContext not available");
@@ -794,15 +810,12 @@
// DOM expansion should only happen when a handler accesses the DOM API.
// We do not allow DOM expansion on a dev release.
- if (UnifiedMetaData.isDevRelease())
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext != null && UnifiedMetaData.isDevRelease())
{
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext != null)
- {
- Boolean allowExpand = (Boolean)msgContext.getProperty(SOAPMessageContextBase.ALLOW_EXPAND_TO_DOM);
- if (Boolean.TRUE.equals(allowExpand) == false)
- throw new WSException("Expanding content element to DOM");
- }
+ Boolean allowExpand = (Boolean)msgContext.getProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
+ if (Boolean.TRUE.equals(allowExpand) == false)
+ throw new WSException("Expanding content element to DOM");
}
try
@@ -881,9 +894,8 @@
log.trace("END: expandToDOM " + getElementName());
}
- // Either the dom-valid state, or the xml-valid state can be true
- // Therefore we invalidate the xml content.
invalidateXMLContent();
+ invalidateObjectContent();
}
}
Modified: trunk/src/main/java/org/jboss/ws/soap/SOAPMessageDispatcher.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/SOAPMessageDispatcher.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/soap/SOAPMessageDispatcher.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -35,7 +35,7 @@
import javax.xml.ws.addressing.JAXWSAConstants;
import org.jboss.logging.Logger;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxrpc.Style;
import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.metadata.OperationMetaData;
@@ -58,7 +58,7 @@
OperationMetaData opMetaData = null;
// Dispatch based on wsa:Action
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext 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-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/utils/ThreadLocalAssociation.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -25,7 +25,7 @@
import java.util.Stack;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.wsse.SecurityStore;
/**
@@ -46,7 +46,7 @@
* SOAP message context
* @see org.jboss.ws.soap.MessageContextAssociation
*/
- private static ThreadLocal<Stack<SOAPMessageContextBase>> msgContextAssoc = new InheritableThreadLocal<Stack<SOAPMessageContextBase>>();
+ private static ThreadLocal<Stack<CommonMessageContext>> msgContextAssoc = new InheritableThreadLocal<Stack<CommonMessageContext>>();
/**
* @see org.jboss.ws.wsse.STRTransform
@@ -57,7 +57,7 @@
return invokerMDBAssoc;
}
- public static ThreadLocal<Stack<SOAPMessageContextBase>> localMsgContextAssoc() {
+ public static ThreadLocal<Stack<CommonMessageContext>> 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-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/wsse/WSSecurityDispatcher.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -35,7 +35,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.utils.DOMWriter;
import org.jboss.ws.WSException;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxrpc.StubExt;
import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.metadata.OperationMetaData;
@@ -103,10 +103,10 @@
return new SOAPFaultException(e.getFaultCode(), e.getFaultString(), null, null);
}
- public static void handleInbound(SOAPMessageContextBase ctx) throws SOAPException, SOAPFaultException
+ public static void handleInbound(CommonMessageContext ctx) throws SOAPException, SOAPFaultException
{
WSSecurityConfiguration config = getSecurityConfig(ctx);
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)ctx.getMessage();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)ctx.getSOAPMessage();
SOAPHeader soapHeader = soapMessage.getSOAPHeader();
QName secQName = new QName(Constants.WSSE_NS, "Security");
@@ -174,7 +174,7 @@
}
}
- private static WSSecurityConfiguration getSecurityConfig(SOAPMessageContextBase ctx)
+ private static WSSecurityConfiguration getSecurityConfig(CommonMessageContext ctx)
{
WSSecurityConfiguration config = ctx.getEndpointMetaData().getServiceMetaData().getSecurityConfiguration();
if (config == null)
@@ -221,10 +221,10 @@
return operations;
}
- public static void handleOutbound(SOAPMessageContextBase ctx) throws SOAPException, SOAPFaultException
+ public static void handleOutbound(CommonMessageContext ctx) throws SOAPException, SOAPFaultException
{
WSSecurityConfiguration config = getSecurityConfig(ctx);
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)ctx.getMessage();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)ctx.getSOAPMessage();
OperationMetaData opMetaData = ctx.getOperationMetaData();
String operation = opMetaData.getQName().toString();
Modified: trunk/src/main/java/org/jboss/ws/wsse/jaxws/WSSecurityHandler.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/wsse/jaxws/WSSecurityHandler.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/wsse/jaxws/WSSecurityHandler.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -27,7 +27,7 @@
import javax.xml.ws.handler.MessageContext;
import org.jboss.logging.Logger;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxws.handler.GenericSOAPHandler;
import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
@@ -50,7 +50,7 @@
{
if (getSecurityConfiguration(msgContext) != null)
{
- WSSecurityDispatcher.handleInbound((SOAPMessageContextBase)msgContext);
+ WSSecurityDispatcher.handleInbound((CommonMessageContext)msgContext);
}
}
catch (SOAPException ex)
@@ -67,7 +67,7 @@
{
if (getSecurityConfiguration(msgContext) != null)
{
- WSSecurityDispatcher.handleOutbound((SOAPMessageContextBase)msgContext);
+ WSSecurityDispatcher.handleOutbound((CommonMessageContext)msgContext);
}
}
catch (SOAPException ex)
@@ -80,7 +80,7 @@
private WSSecurityConfiguration getSecurityConfiguration(MessageContext msgContext)
{
- EndpointMetaData epMetaData = ((SOAPMessageContextBase)msgContext).getEndpointMetaData();
+ EndpointMetaData epMetaData = ((CommonMessageContext)msgContext).getEndpointMetaData();
WSSecurityConfiguration securityConfiguration = epMetaData.getServiceMetaData().getSecurityConfiguration();
if (securityConfiguration == null)
log.warn("Cannot obtain security configuration");
Modified: trunk/src/main/java/org/jboss/ws/xop/XOPContext.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/xop/XOPContext.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/xop/XOPContext.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -36,7 +36,7 @@
import org.jboss.ws.utils.DOMUtils;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxrpc.StubExt;
import org.jboss.ws.soap.MessageContextAssociation;
import org.jboss.ws.soap.NameImpl;
@@ -75,9 +75,9 @@
*/
public static boolean isXOPPackage() {
boolean isXOP = false;
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if(msgContext!=null) {
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
isXOP = (soapMessage != null && soapMessage.isXOPMessage());
}
return isXOP;
@@ -90,7 +90,7 @@
*/
public static boolean isMTOMEnabled()
{
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
Boolean mtomEnabled = (Boolean)msgContext.getProperty(StubExt.PROPERTY_MTOM_ENABLED);
return Boolean.TRUE.equals(mtomEnabled) || mtomEnabled == null;
}
@@ -225,8 +225,8 @@
log.debug("Created base64 representation for content-type " + contentType);
// cleanup the attachment part
- SOAPMessageContextBase msgContext = (SOAPMessageContextBase)MessageContextAssociation.peekMessageContext();
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
+ CommonMessageContext msgContext = (CommonMessageContext)MessageContextAssociation.peekMessageContext();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
if(cid.startsWith("cid:")) cid = cid.substring(4);
cid = '<'+cid+'>';
@@ -244,8 +244,8 @@
*/
public static AttachmentPart getAttachmentByCID(String cid) throws SOAPException
{
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
// RFC2392 requires the 'cid:' part to be stripped from the cid
if(cid.startsWith("cid:")) cid = cid.substring(4);
Modified: trunk/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -28,7 +28,7 @@
import org.jboss.ws.soap.SOAPMessageImpl;
import org.jboss.ws.soap.attachment.MimeConstants;
import org.jboss.ws.soap.attachment.ContentHandlerRegistry;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.xb.binding.sunday.xop.XOPMarshaller;
import org.jboss.xb.binding.sunday.xop.XOPObject;
@@ -64,8 +64,8 @@
public String addMtomAttachment(XOPObject obj, String elementNamespace, String elementName)
{
- SOAPMessageContextBase msgContext = (SOAPMessageContextBase)MessageContextAssociation.peekMessageContext();
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
+ CommonMessageContext msgContext = (CommonMessageContext)MessageContextAssociation.peekMessageContext();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
QName xmlName = new QName(elementNamespace, elementName);
log.debug("serialize: [xmlName=" + xmlName + "]");
Modified: trunk/src/test/ant/build-jars.xml
===================================================================
--- trunk/src/test/ant/build-jars.xml 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/test/ant/build-jars.xml 2006-09-05 20:10:19 UTC (rev 902)
@@ -266,19 +266,33 @@
</war>
<!-- jbossws-jaxws-logicalhandler -->
- <war warfile="${build.test.dir}/libs/jbossws-jaxws-logicalhandler.war" webxml="${build.test.dir}/resources/jaxws/logicalhandler/WEB-INF/web.xml">
+ <war warfile="${build.test.dir}/libs/jbossws-jaxws-logicalhandler-source.war" webxml="${build.test.dir}/resources/jaxws/logicalhandler/WEB-INF/web-source.xml">
<classes dir="${build.test.dir}/classes">
- <include name="org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointBean.class"/>
- <include name="org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpoint.class"/>
- <include name="org/jboss/test/ws/jaxws/logicalhandler/LogicalHandler.class"/>
+ <include name="org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointSourceImpl.class"/>
+ <include name="org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointSource.class"/>
+ <include name="org/jboss/test/ws/jaxws/logicalhandler/LogicalSourceHandler.class"/>
<include name="org/jboss/test/ws/jaxws/logicalhandler/ProtocolHandler.class"/>
<include name="org/jboss/test/ws/jaxws/logicalhandler/Echo.class"/>
<include name="org/jboss/test/ws/jaxws/logicalhandler/EchoResponse.class"/>
</classes>
<webinf dir="${build.test.dir}/resources/jaxws/logicalhandler/WEB-INF">
- <include name="jaxws-server-handlers.xml"/>
+ <include name="jaxws-server-source-handlers.xml"/>
</webinf>
</war>
+ <war warfile="${build.test.dir}/libs/jbossws-jaxws-logicalhandler-jaxb.war" webxml="${build.test.dir}/resources/jaxws/logicalhandler/WEB-INF/web-jaxb.xml">
+ <classes dir="${build.test.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointJAXBImpl.class"/>
+ <include name="org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointJAXB.class"/>
+ <include name="org/jboss/test/ws/jaxws/logicalhandler/LogicalJAXBHandler.class"/>
+ <include name="org/jboss/test/ws/jaxws/logicalhandler/ProtocolHandler.class"/>
+ <include name="org/jboss/test/ws/jaxws/logicalhandler/Echo.class"/>
+ <include name="org/jboss/test/ws/jaxws/logicalhandler/EchoResponse.class"/>
+ <include name="org/jboss/test/ws/jaxws/logicalhandler/ObjectFactory.class"/>
+ </classes>
+ <webinf dir="${build.test.dir}/resources/jaxws/logicalhandler/WEB-INF">
+ <include name="jaxws-server-jaxb-handlers.xml"/>
+ </webinf>
+ </war>
<!-- jbossws-jaxws-provider-jaxb -->
<war warfile="${build.test.dir}/libs/jbossws-jaxws-provider-jaxb.war" webxml="${build.test.dir}/resources/jaxws/provider/jaxb/WEB-INF/web.xml">
Modified: trunk/src/test/java/org/jboss/test/ws/binding/SOAPBindingTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/binding/SOAPBindingTestCase.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/test/java/org/jboss/test/ws/binding/SOAPBindingTestCase.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -40,7 +40,7 @@
import org.jboss.ws.Constants;
import org.jboss.ws.binding.EndpointInvocation;
import org.jboss.ws.binding.UnboundHeader;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxrpc.CallImpl;
import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.jaxws.core.BindingImpl;
@@ -242,8 +242,8 @@
MessageFactory factory = new MessageFactoryImpl();
SOAPMessage reqMessage = factory.createMessage(null, inputStream);
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- msgContext.setMessage(reqMessage);
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ msgContext.setSOAPMessage(reqMessage);
EndpointInvocation epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
assertNotNull(epInv);
@@ -268,8 +268,8 @@
MessageFactory factory = new MessageFactoryImpl();
SOAPMessage reqMessage = factory.createMessage(null, inputStream);
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- msgContext.setMessage(reqMessage);
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ msgContext.setSOAPMessage(reqMessage);
BindingImpl binding = (BindingImpl)new BindingProviderImpl(SOAPBinding.SOAP12HTTP_BINDING).getBinding();
EndpointInvocation epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
@@ -290,8 +290,8 @@
MessageFactory factory = new MessageFactoryImpl();
SOAPMessage reqMessage = factory.createMessage(null, inputStream);
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- msgContext.setMessage(reqMessage);
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ msgContext.setSOAPMessage(reqMessage);
BindingImpl binding = (BindingImpl)new BindingProviderImpl(SOAPBinding.SOAP12HTTP_BINDING).getBinding();
EndpointInvocation epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
@@ -331,8 +331,8 @@
MessageFactory factory = new MessageFactoryImpl();
SOAPMessage resMessage = factory.createMessage(null, inputStream);
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- msgContext.setMessage(resMessage);
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ msgContext.setSOAPMessage(resMessage);
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
binding.unbindResponseMessage(opMetaData, resMessage, epInv, null);
@@ -350,8 +350,8 @@
MessageFactory factory = new MessageFactoryImpl();
SOAPMessage resMessage = factory.createMessage(null, inputStream);
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- msgContext.setMessage(resMessage);
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ msgContext.setSOAPMessage(resMessage);
// Add bound header
QName xmlName = new QName("http://somens", "OutHeader");
@@ -379,8 +379,8 @@
MessageFactory factory = new MessageFactoryImpl();
SOAPMessage resMessage = factory.createMessage(null, inputStream);
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- msgContext.setMessage(resMessage);
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ msgContext.setSOAPMessage(resMessage);
QName xmlName = new QName("http://somens", "OutHeader");
UnboundHeader header = new UnboundHeader(xmlName, Constants.TYPE_LITERAL_STRING, String.class, ParameterMode.OUT);
@@ -406,8 +406,8 @@
MessageFactory factory = new MessageFactoryImpl();
SOAPMessage resMessage = factory.createMessage(null, inputStream);
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- msgContext.setMessage(resMessage);
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ msgContext.setSOAPMessage(resMessage);
try
{
Deleted: trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalHandler.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalHandler.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalHandler.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -1,90 +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.test.ws.jaxws.logicalhandler;
-
-// $Id$
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.LogicalMessageContext;
-import javax.xml.ws.handler.MessageContext;
-
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.jaxws.handler.GenericLogicalHandler;
-import org.w3c.dom.Element;
-
-public class LogicalHandler extends GenericLogicalHandler
-{
- @Override
- public boolean handleOutbound(MessageContext msgContext)
- {
- return appendHandlerName(msgContext);
- }
-
- @Override
- public boolean handleInbound(MessageContext msgContext)
- {
- return appendHandlerName(msgContext);
- }
-
- private boolean appendHandlerName(MessageContext msgContext)
- {
- try
- {
- // Get the payload as Source
- LogicalMessageContext logicalContext = (LogicalMessageContext)msgContext;
- Source source = logicalContext.getMessage().getPayload();
- TransformerFactory tf = TransformerFactory.newInstance();
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- tf.newTransformer().transform(source, new StreamResult(baos));
-
- // Parse the payload and extract the value
- Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));
- Element element = DOMUtils.getFirstChildElement(root);
- String value = DOMUtils.getTextContent(element);
-
- String handlerName = getHandlerName();
- value = value + ":" + handlerName;
- element.setTextContent(value);
-
- // Set the updated payload
- source = new DOMSource(root);
- logicalContext.getMessage().setPayload(source);
-
- return true;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WebServiceException(ex);
- }
- }
-}
Copied: trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalHandlerJAXBTestCase.java (from rev 901, branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalHandlerJAXBTestCase.java)
Copied: trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalHandlerSourceTestCase.java (from rev 901, branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalHandlerSourceTestCase.java)
Deleted: trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalHandlerTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalHandlerTestCase.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalHandlerTestCase.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -1,75 +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.test.ws.jaxws.logicalhandler;
-
-// $Id:LogicalHandlerTestCase.java 888 2006-09-02 00:37:13Z thomas.diesler at jboss.com $
-
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-
-import junit.framework.Test;
-
-import org.jboss.test.ws.JBossWSTest;
-import org.jboss.test.ws.JBossWSTestSetup;
-
-/**
- * Test JAXWS logical handlers
- *
- * @author Thomas.Diesler at jboss.org
- * @since 12-Aug-2006
- */
-public class LogicalHandlerTestCase extends JBossWSTest
-{
- public static Test suite()
- {
- return JBossWSTestSetup.newTestSetup(LogicalHandlerTestCase.class, "jbossws-jaxws-logicalhandler.war");
- }
-
- public void testClientAccess() throws Exception
- {
- URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jbossws-jaxws-logicalhandler?wsdl");
- QName serviceName = new QName("http://org.jboss.ws/jaxws/logicalhandler", "SOAPEndpointService");
- Service service = Service.create(wsdlURL, serviceName);
- SOAPEndpoint port = (SOAPEndpoint)service.getPort(SOAPEndpoint.class);
-
- String retStr = port.echo("hello");
-
- StringBuffer expStr = new StringBuffer("hello");
- expStr.append(":LogicalClientHandler");
- expStr.append(":SOAP11ClientHandler");
- expStr.append(":PortClientHandler");
- expStr.append(":LogicalServerHandler");
- expStr.append(":SOAP11ServerHandler");
- expStr.append(":PortServerHandler");
- expStr.append(":endpoint");
- System.out.println("FIXME: JBWS-1168");
- //expStr.append(":PortServerHandler");
- //expStr.append(":SOAP11ServerHandler");
- expStr.append(":LogicalServerHandler");
- expStr.append(":PortClientHandler");
- expStr.append(":SOAP11ClientHandler");
- expStr.append(":LogicalClientHandler");
- assertEquals(expStr.toString(), retStr);
- }
-}
Copied: trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalJAXBHandler.java (from rev 901, branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalJAXBHandler.java)
Copied: trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalSourceHandler.java (from rev 901, branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/LogicalSourceHandler.java)
Deleted: trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpoint.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpoint.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpoint.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -1,42 +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.test.ws.jaxws.logicalhandler;
-
-// $Id: $
-
-import javax.jws.HandlerChain;
-import javax.jws.WebMethod;
-import javax.jws.WebService;
-import javax.xml.ws.RequestWrapper;
-import javax.xml.ws.ResponseWrapper;
-
- at WebService()
- at HandlerChain(file = "resources/jaxws/logicalhandler/META-INF/jaxws-client-handlers.xml")
-public interface SOAPEndpoint
-{
-
- @WebMethod
- @RequestWrapper(className = "org.jboss.test.ws.jaxws.logicalhandler.Echo")
- @ResponseWrapper(className = "org.jboss.test.ws.jaxws.logicalhandler.EchoResponse")
- public String echo(String string1);
-
-}
Deleted: trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointBean.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointBean.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointBean.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -1,48 +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.test.ws.jaxws.logicalhandler;
-
-// $Id$
-
-import javax.jws.HandlerChain;
-import javax.jws.WebMethod;
-import javax.jws.WebService;
-import javax.xml.ws.RequestWrapper;
-import javax.xml.ws.ResponseWrapper;
-
-import org.jboss.logging.Logger;
-
- at WebService(name = "SOAPEndpoint", targetNamespace = "http://org.jboss.ws/jaxws/logicalhandler")
- at HandlerChain(file = "WEB-INF/jaxws-server-handlers.xml")
-public class SOAPEndpointBean
-{
- private static Logger log = Logger.getLogger(SOAPEndpointBean.class);
-
- @WebMethod
- @RequestWrapper(className = "org.jboss.test.ws.jaxws.logicalhandler.Echo")
- @ResponseWrapper(className = "org.jboss.test.ws.jaxws.logicalhandler.EchoResponse")
- public String echo(String msg)
- {
- log.info("echo: " + msg);
- return msg + ":endpoint";
- }
-}
Copied: trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointJAXB.java (from rev 901, branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointJAXB.java)
Copied: trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointJAXBImpl.java (from rev 901, branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointJAXBImpl.java)
Copied: trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointSource.java (from rev 901, branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointSource.java)
Copied: trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointSourceImpl.java (from rev 901, branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/logicalhandler/SOAPEndpointSourceImpl.java)
Modified: trunk/src/test/java/org/jboss/test/ws/xop/XOPElementRPCTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/xop/XOPElementRPCTestCase.java 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/test/java/org/jboss/test/ws/xop/XOPElementRPCTestCase.java 2006-09-05 20:10:19 UTC (rev 902)
@@ -23,7 +23,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.Constants;
-import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.jaxrpc.Style;
import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.metadata.OperationMetaData;
@@ -76,10 +76,10 @@
bodyElement.addChildElement(xopElement);
// Setup the message context
- SOAPMessageContextBase msgContext = new SOAPMessageContextJAXRPC();
+ CommonMessageContext msgContext = new SOAPMessageContextJAXRPC();
MessageContextAssociation.pushMessageContext(msgContext);
msgContext.setOperationMetaData(opMetaData);
- msgContext.setMessage(soapMessage);
+ msgContext.setSOAPMessage(soapMessage);
}
Deleted: trunk/src/test/resources/jaxws/logicalhandler/META-INF/jaxws-client-handlers.xml
===================================================================
--- trunk/src/test/resources/jaxws/logicalhandler/META-INF/jaxws-client-handlers.xml 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/test/resources/jaxws/logicalhandler/META-INF/jaxws-client-handlers.xml 2006-09-05 20:10:19 UTC (rev 902)
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ns1="http://org.jboss.ws/jaxws/logicalhandler"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee handler-chain.xsd">
-
- <handler-chain>
- <protocol-bindings>##SOAP11_HTTP</protocol-bindings>
- <handler>
- <handler-name> SOAP11ClientHandler </handler-name>
- <handler-class> org.jboss.test.ws.jaxws.logicalhandler.ProtocolHandler </handler-class>
- </handler>
- </handler-chain>
-
- <handler-chain>
- <handler>
- <handler-name> LogicalClientHandler </handler-name>
- <handler-class> org.jboss.test.ws.jaxws.logicalhandler.LogicalHandler </handler-class>
- </handler>
- </handler-chain>
-
- <handler-chain>
- <port-name-pattern>ns1:SOAPEndpointPort</port-name-pattern>
- <handler>
- <handler-name> PortClientHandler </handler-name>
- <handler-class> org.jboss.test.ws.jaxws.logicalhandler.ProtocolHandler </handler-class>
- </handler>
- </handler-chain>
-
-</handler-chains>
\ No newline at end of file
Copied: trunk/src/test/resources/jaxws/logicalhandler/META-INF/jaxws-client-jaxb-handlers.xml (from rev 901, branches/tdiesler/trunk/src/test/resources/jaxws/logicalhandler/META-INF/jaxws-client-jaxb-handlers.xml)
Copied: trunk/src/test/resources/jaxws/logicalhandler/META-INF/jaxws-client-source-handlers.xml (from rev 901, branches/tdiesler/trunk/src/test/resources/jaxws/logicalhandler/META-INF/jaxws-client-source-handlers.xml)
Modified: trunk/src/test/resources/jaxws/logicalhandler/META-INF/wsdl/TestService.wsdl
===================================================================
--- trunk/src/test/resources/jaxws/logicalhandler/META-INF/wsdl/TestService.wsdl 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/test/resources/jaxws/logicalhandler/META-INF/wsdl/TestService.wsdl 2006-09-05 20:10:19 UTC (rev 902)
@@ -68,7 +68,7 @@
<service name='SOAPEndpointService'>
<port binding='tns:SOAPEndpointBinding' name='SOAPEndpointPort'>
- <soap:address location='http://@jbosstest.host.name@:8080/jbossws-jaxws-logicalhandler/TestService'/>
+ <soap:address location='CLIENT_PROVIDED_URL'/>
</port>
</service>
</definitions>
\ No newline at end of file
Deleted: trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/jaxws-server-handlers.xml
===================================================================
--- trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/jaxws-server-handlers.xml 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/jaxws-server-handlers.xml 2006-09-05 20:10:19 UTC (rev 902)
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ns1="http://org.jboss.ws/jaxws/logicalhandler"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee handler-chain.xsd">
-
- <handler-chain>
- <protocol-bindings>##SOAP11_HTTP</protocol-bindings>
- <handler>
- <handler-name> SOAP11ServerHandler </handler-name>
- <handler-class> org.jboss.test.ws.jaxws.logicalhandler.ProtocolHandler </handler-class>
- </handler>
- </handler-chain>
-
- <handler-chain>
- <handler>
- <handler-name> LogicalServerHandler </handler-name>
- <handler-class> org.jboss.test.ws.jaxws.logicalhandler.LogicalHandler </handler-class>
- </handler>
- </handler-chain>
-
- <handler-chain>
- <port-name-pattern>ns1:SOAPEndpointPort</port-name-pattern>
- <handler>
- <handler-name> PortServerHandler </handler-name>
- <handler-class> org.jboss.test.ws.jaxws.logicalhandler.ProtocolHandler </handler-class>
- </handler>
- </handler-chain>
-
-</handler-chains>
\ No newline at end of file
Copied: trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/jaxws-server-jaxb-handlers.xml (from rev 901, branches/tdiesler/trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/jaxws-server-jaxb-handlers.xml)
Copied: trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/jaxws-server-source-handlers.xml (from rev 901, branches/tdiesler/trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/jaxws-server-source-handlers.xml)
Copied: trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/web-jaxb.xml (from rev 901, branches/tdiesler/trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/web-jaxb.xml)
Copied: trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/web-source.xml (from rev 901, branches/tdiesler/trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/web-source.xml)
Deleted: trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/web.xml
===================================================================
--- trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/web.xml 2006-09-05 19:49:56 UTC (rev 901)
+++ trunk/src/test/resources/jaxws/logicalhandler/WEB-INF/web.xml 2006-09-05 20:10:19 UTC (rev 902)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
- version="2.4">
-
- <servlet>
- <servlet-name>TestService</servlet-name>
- <servlet-class>org.jboss.test.ws.jaxws.logicalhandler.SOAPEndpointBean</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>TestService</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
-
-</web-app>
-
More information about the jboss-svn-commits
mailing list