Author: alessio.soldano(a)jboss.com
Date: 2007-10-31 10:41:21 -0400 (Wed, 31 Oct 2007)
New Revision: 4957
Modified:
stack/native/branches/asoldano/trunk/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
stack/native/branches/asoldano/trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
Log:
[JBWS-1876] Improvement and fix for oneway dispatch
Modified:
stack/native/branches/asoldano/trunk/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
---
stack/native/branches/asoldano/trunk/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-10-31
14:39:59 UTC (rev 4956)
+++
stack/native/branches/asoldano/trunk/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-10-31
14:41:21 UTC (rev 4957)
@@ -318,6 +318,9 @@
public void invokeOneWay(T msg)
{
+ CommonMessageContext msgContext = new SOAPMessageContextJAXWS();
+ MessageContextAssociation.pushMessageContext(msgContext);
+ msgContext.setEndpointMetaData(epMetaData);
try
{
MessageAbstraction reqMsg = getRequestMessage(msg);
@@ -328,6 +331,10 @@
{
handleInvokeException(ex);
}
+ finally
+ {
+ MessageContextAssociation.popMessageContext();
+ }
}
// 4.17. Conformance (Failed Dispatch.invoke): When an operation is invoked using an
invoke method, an
Modified:
stack/native/branches/asoldano/trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
===================================================================
---
stack/native/branches/asoldano/trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2007-10-31
14:39:59 UTC (rev 4956)
+++
stack/native/branches/asoldano/trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2007-10-31
14:41:21 UTC (rev 4957)
@@ -42,6 +42,7 @@
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
+import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.SOAPMessageAbstraction;
@@ -225,10 +226,20 @@
private String getSOAPContentType() throws SOAPException
{
- if
(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(soapPart.getEnvelope().getNamespaceURI()))
+ //Check binding type in the endpoint metadata
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext != null &&
Constants.SOAP12HTTP_BINDING.equalsIgnoreCase(msgContext.getEndpointMetaData().getBindingId()))
+ {
return SOAPConstants.SOAP_1_2_CONTENT_TYPE;
- else
- return SOAPConstants.SOAP_1_1_CONTENT_TYPE;
+ }
+ //Check the message envelope
+ SOAPEnvelope env = soapPart != null ? soapPart.getEnvelope() : null;
+ if (env != null &&
SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(env.getNamespaceURI()))
+ {
+ return SOAPConstants.SOAP_1_2_CONTENT_TYPE;
+ }
+ //Default to soap 1.1
+ return SOAPConstants.SOAP_1_1_CONTENT_TYPE;
}
public void saveChanges() throws SOAPException