Author: heiko.braun(a)jboss.com
Date: 2007-04-05 10:33:20 -0400 (Thu, 05 Apr 2007)
New Revision: 2777
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java
trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java
trunk/jbossws-core/src/java/org/jboss/ws/core/CommonMessageContext.java
trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java
trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
Log:
Fix remaining TCK handler tests. Added MessageContext.isModified()
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java 2007-04-05
13:49:22 UTC (rev 2776)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java 2007-04-05
14:33:20 UTC (rev 2777)
@@ -34,9 +34,12 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+import org.jboss.ws.WSException;
/**
* This Interceptor does the ws4ee handler processing.
@@ -85,6 +88,19 @@
// Call the next interceptor in the chain
if (handlersPass)
{
+ CommonBindingProvider bindingProvider = new
CommonBindingProvider(opMetaData.getEndpointMetaData());
+ CommonBinding binding = bindingProvider.getCommonBinding();
+
+ // Verify that the the message has not been mofified
+ CommonMessageContext messageContext =
MessageContextAssociation.peekMessageContext();
+ if(messageContext.isModified())
+ {
+ log.debug("Handler modified payload, unbind message and update
invocation args");
+ epInv = bindingProvider.getCommonBinding().unbindRequestMessage(
+ opMetaData, messageContext.getMessageAbstraction()
+ );
+ }
+
// The SOAPContentElements stored in the EndpointInvocation might have
changed after
// handler processing. Get the updated request payload. This should be a
noop if request
// handlers did not modify the incomming SOAP message.
@@ -94,8 +110,6 @@
epInv.setReturnValue(resObj);
// Bind the response message
- CommonBindingProvider bindingProvider = new
CommonBindingProvider(opMetaData.getEndpointMetaData());
- CommonBinding binding =
(CommonBinding)bindingProvider.getCommonBinding();
SOAPMessage resMessage =
(SOAPMessage)binding.bindResponseMessage(opMetaData, epInv);
msgContext.setSOAPMessage(resMessage);
}
@@ -125,11 +139,7 @@
log.warn("Cannot process handlerChain.handleFault, ignoring: ",
subEx);
}
throw ex;
- }
- finally
- {
- // do nothing
- }
+ }
}
else
{
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java 2007-04-05 13:49:22
UTC (rev 2776)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java 2007-04-05 14:33:20
UTC (rev 2777)
@@ -362,7 +362,7 @@
faultType[0] = null;
// Check if protocol handlers modified the payload
- if (reqMessage.isModified())
+ if (msgContext.isModified())
{
log.debug("Handler modified body payload, unbind message
again");
MessageAbstraction resMessage = msgContext.getMessageAbstraction();
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/CommonMessageContext.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/CommonMessageContext.java 2007-04-05
13:49:22 UTC (rev 2776)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/CommonMessageContext.java 2007-04-05
14:33:20 UTC (rev 2777)
@@ -36,6 +36,7 @@
import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
import org.jboss.ws.core.server.PropertyCallback;
import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.xb.binding.NamespaceRegistry;
@@ -69,6 +70,8 @@
// The current property scope
protected Scope currentScope = Scope.APPLICATION;
+ private boolean isModified;
+
public CommonMessageContext()
{
}
@@ -125,6 +128,7 @@
public void setSOAPMessage(SOAPMessage soapMessage)
{
this.message = (MessageAbstraction)soapMessage;
+ this.setModified(true);
}
public MessageAbstraction getMessageAbstraction()
@@ -249,6 +253,28 @@
scopedProps.clear();
}
+
+ public boolean isModified()
+ {
+ return isModified;
+ }
+
+ /**
+ * Mark a message as 'modified' when the SAAJ model becomes stale.
+ * This may be the case when:
+ * <ul>
+ * <li>the complete message is replaced at MessageContext level
+ * <li>the payload is set on a LogicalMessage
+ * <li>The SAAJ model is changed though the DOM or SAAJ API (handler)
+ * </ul>
+ *
+ * In any of these cases another 'unbind' invocation is required.
+ */
+ public void setModified(boolean modified)
+ {
+ isModified = modified;
+ }
+
public Set<String> keySet()
{
Set<String> keys = new HashSet<String>(scopedProps.size());
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java 2007-04-05
13:49:22 UTC (rev 2776)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java 2007-04-05
14:33:20 UTC (rev 2777)
@@ -293,6 +293,7 @@
elQName = namespaceRegistry.registerQName(elQName);
}
+ int numParameters = 0;
for (ParameterMetaData paramMetaData : opMetaData.getParameters())
{
QName xmlName = paramMetaData.getXmlName();
@@ -317,12 +318,19 @@
}
else
{
- SOAPElement element = paramMetaData.isInHeader() ? soapHeader :
soapBodyElement;
+ boolean isHeader = paramMetaData.isInHeader();
+ SOAPElement element = isHeader ? soapHeader : soapBodyElement;
+ if(!isHeader) numParameters++;
+
SOAPContentElement value = getParameterFromMessage(paramMetaData,
element, false);
epInv.setRequestParamValue(xmlName, value);
}
}
}
+
+ // TCK: verify the numer of parameters matches the actual message payload
+ int numChildren = soapBodyElement.getChildNodes().getLength();
+ if(numChildren!=numParameters) throw new WSException("Invalid number of
payload elements: " + numChildren);
}
// Generic message endpoint
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java 2007-04-05 13:49:22
UTC (rev 2776)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java 2007-04-05 14:33:20
UTC (rev 2777)
@@ -44,8 +44,7 @@
public class HTTPMessageImpl implements HTTPMessageAbstraction
{
private MimeHeaders mimeHeaders;
- private XMLFragment xmlFragment;
- private boolean modified;
+ private XMLFragment xmlFragment;
public HTTPMessageImpl(MimeHeaders mimeHeaders, InputStream inputStream)
{
@@ -111,15 +110,4 @@
{
throw new NotImplementedException();
}
-
- public boolean isModified()
- {
- return modified;
- }
-
- public void setModified(boolean modifiedInHandler)
- {
- this.modified = modifiedInHandler;
- }
-
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java 2007-04-05
13:49:22 UTC (rev 2776)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java 2007-04-05
14:33:20 UTC (rev 2777)
@@ -39,11 +39,7 @@
void writeTo(OutputStream outputStream) throws IOException;
- boolean isFaultMessage();
-
- boolean isModified();
-
- void setModified(boolean flag);
+ boolean isFaultMessage();
void addAttachmentPart(AttachmentPart part);
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java 2007-04-05
13:49:22 UTC (rev 2776)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java 2007-04-05
14:33:20 UTC (rev 2777)
@@ -40,10 +40,7 @@
import org.jboss.ws.core.HTTPMessageImpl;
import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.Style;
-import org.jboss.ws.core.soap.EnvelopeBuilderDOM;
-import org.jboss.ws.core.soap.SOAPBodyImpl;
-import org.jboss.ws.core.soap.SOAPContentElement;
-import org.jboss.ws.core.soap.XMLFragment;
+import org.jboss.ws.core.soap.*;
import org.jboss.ws.core.utils.DOMUtils;
import org.w3c.dom.Element;
@@ -133,7 +130,9 @@
HTTPMessageImpl httpMessage = (HTTPMessageImpl)message;
httpMessage.setXmlFragment(new XMLFragment(source));
}
- message.setModified(true);
+
+ MessageContextAssociation.peekMessageContext().setModified(true);
+
}
public Object getPayload(JAXBContext jaxbContext)
@@ -168,6 +167,7 @@
if (bodyElement != null)
{
bodyElement.setObjectValue(payload);
+ MessageContextAssociation.peekMessageContext().setModified(true);
}
}
else if (message instanceof HTTPMessageImpl)
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-04-05
13:49:22 UTC (rev 2776)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-04-05
14:33:20 UTC (rev 2777)
@@ -196,7 +196,7 @@
try
{
// Check if protocol handlers modified the payload
- if (reqMessage.isModified())
+ if (msgContext.isModified())
{
log.debug("Handler modified payload, unbind message again");
reqMessage = msgContext.getMessageAbstraction();
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2007-04-05
13:49:22 UTC (rev 2776)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2007-04-05
14:33:20 UTC (rev 2777)
@@ -23,6 +23,16 @@
// $Id$
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.SOAPMessageAbstraction;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.attachment.*;
+import org.jboss.ws.extensions.xop.XOPContext;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+
+import javax.mail.MessagingException;
+import javax.xml.soap.*;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Collection;
@@ -30,29 +40,6 @@
import java.util.LinkedList;
import java.util.List;
-import javax.mail.MessagingException;
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.MimeHeader;
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFault;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.soap.SOAPPart;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.SOAPMessageAbstraction;
-import org.jboss.ws.core.soap.attachment.AttachmentPartImpl;
-import org.jboss.ws.core.soap.attachment.CIDGenerator;
-import org.jboss.ws.core.soap.attachment.MimeConstants;
-import org.jboss.ws.core.soap.attachment.MultipartRelatedEncoder;
-import org.jboss.ws.core.soap.attachment.MultipartRelatedSwAEncoder;
-import org.jboss.ws.core.soap.attachment.MultipartRelatedXOPEncoder;
-import org.jboss.ws.extensions.xop.XOPContext;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-
/**
* The root class for all SOAP messages. As transmitted on the "wire", a SOAP
message is an XML document or a
* MIME message whose first body part is an XML/SOAP document.
@@ -68,8 +55,7 @@
private CIDGenerator cidGenerator = new CIDGenerator();
private boolean isXOPMessage;
private boolean isSWARefMessage;
- private SOAPPartImpl soapPart;
- private boolean modified;
+ private SOAPPartImpl soapPart;
private MultipartRelatedEncoder multipartRelatedEncoder;
// Cache the associated operation meta data
@@ -272,6 +258,9 @@
saveRequired = false;
}
+
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if(msgContext!=null) msgContext.setModified(true);
}
public boolean saveRequired()
@@ -506,14 +495,4 @@
while (attachmentItr.next() != null)
attachmentItr.remove();
}
-
- public boolean isModified()
- {
- return modified;
- }
-
- public void setModified(boolean modifiedInHandler)
- {
- this.modified = modifiedInHandler;
- }
}
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java 2007-04-05
13:49:22 UTC (rev 2776)
+++
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java 2007-04-05
14:33:20 UTC (rev 2777)
@@ -26,6 +26,7 @@
import java.io.IOException;
import java.net.URL;
import java.util.Set;
+import java.util.Iterator;
import javax.xml.namespace.QName;
@@ -34,8 +35,7 @@
import org.jboss.ws.WSException;
import org.jboss.ws.integration.ResourceLoaderAdapter;
import org.jboss.ws.integration.UnifiedVirtualFile;
-import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
-import org.jboss.ws.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+import org.jboss.ws.metadata.j2ee.serviceref.*;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping;
@@ -65,7 +65,7 @@
/** Build from WSDL and jaxrpc-mapping.xml
*/
public ServiceMetaData buildMetaData(QName serviceQName, URL wsdlURL, URL mappingURL,
URL securityURL,
- UnifiedServiceRefMetaData serviceRefMetaData, ClassLoader loader)
+ UnifiedServiceRefMetaData serviceRefMetaData,
ClassLoader loader)
{
try
{
@@ -97,7 +97,7 @@
/** Build from WSDL and jaxrpc-mapping.xml
*/
public ServiceMetaData buildMetaData(QName serviceQName, URL wsdlURL, JavaWsdlMapping
javaWsdlMapping, WSSecurityConfiguration securityConfig,
- UnifiedServiceRefMetaData usrMetaData, ClassLoader loader)
+ UnifiedServiceRefMetaData usrMetaData,
ClassLoader loader)
{
if(log.isDebugEnabled()) log.debug("START buildMetaData: [service=" +
serviceQName + "]");
try
@@ -149,7 +149,7 @@
}
private void buildMetaDataInternal(ServiceMetaData serviceMetaData, WSDLDefinitions
wsdlDefinitions, JavaWsdlMapping javaWsdlMapping,
- UnifiedServiceRefMetaData serviceRefMetaData) throws IOException
+ UnifiedServiceRefMetaData serviceRefMetaData)
throws IOException
{
QName serviceQName = serviceMetaData.getServiceName();
@@ -212,6 +212,32 @@
}
}
+ if(serviceRefMetaData!=null)
+ {
+ Iterator<UnifiedPortComponentRefMetaData> it =
serviceRefMetaData.getPortComponentRefs().iterator();
+ while(it.hasNext())
+ {
+ UnifiedPortComponentRefMetaData portComp = it.next();
+
+ if(epMetaData.matches(portComp))
+ {
+ log.debug("Processing service-ref contribution on portType:
"+epMetaData.getPortTypeName());
+
+ // process stub properties
+ for(UnifiedStubPropertyMetaData stubProp:
portComp.getStubProperties())
+ {
+ epMetaData.getProperties().put(stubProp.getPropName(),
stubProp.getPropValue());
+ }
+
+ // process call properties
+ for(UnifiedCallPropertyMetaData callProp:
portComp.getCallProperties())
+ {
+ epMetaData.getProperties().put(callProp.getPropName(),
callProp.getPropValue());
+ }
+ }
+ }
+ }
+
processEndpointMetaDataExtensions(epMetaData, wsdlDefinitions);
setupOperationsFromWSDL(epMetaData, wsdlEndpoint, seiMapping);
setupHandlers(serviceRefMetaData, portName, epMetaData);
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2007-04-05
13:49:22 UTC (rev 2776)
+++
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2007-04-05
14:33:20 UTC (rev 2777)
@@ -55,6 +55,7 @@
import org.jboss.ws.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
import org.jboss.ws.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
import org.jboss.ws.metadata.j2ee.serviceref.UnifiedStubPropertyMetaData;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedCallPropertyMetaData;
/**
* A client side meta data builder.
@@ -204,9 +205,12 @@
epMetaData.getProperties().put(stubProp.getPropName(),
stubProp.getPropValue());
}
- // process port-component-uri
+ // process call properties
+ for(UnifiedCallPropertyMetaData callProp: portComp.getCallProperties())
+ {
+ epMetaData.getProperties().put(callProp.getPropName(),
callProp.getPropValue());
+ }
-
}
}