Author: thomas.diesler(a)jboss.com
Date: 2007-04-03 17:36:00 -0400 (Tue, 03 Apr 2007)
New Revision: 2752
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBindingProvider.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageContextImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
Log:
partial commit
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java 2007-04-03
16:36:52 UTC (rev 2751)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java 2007-04-03
21:36:00 UTC (rev 2752)
@@ -26,7 +26,6 @@
import java.util.Map;
import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPMessage;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.soap.UnboundHeader;
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBindingProvider.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBindingProvider.java 2007-04-03
16:36:52 UTC (rev 2751)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBindingProvider.java 2007-04-03
21:36:00 UTC (rev 2752)
@@ -25,18 +25,19 @@
import java.util.Observable;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.soap.SOAPBinding;
+
import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
import org.jboss.ws.core.jaxrpc.SOAP11BindingJAXRPC;
import org.jboss.ws.core.jaxrpc.SOAP12BindingJAXRPC;
+import org.jboss.ws.core.jaxws.binding.HTTPBindingJAXWS;
import org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS;
import org.jboss.ws.core.jaxws.binding.SOAP12BindingJAXWS;
import org.jboss.ws.metadata.config.Configurable;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
-import javax.xml.ws.soap.SOAPBinding;
-
/**
* Provides access to the protocol binding.
*
@@ -74,18 +75,26 @@
protected void initBinding(String bindingId, Type type)
{
- if (CommonSOAPBinding.SOAP11HTTP_BINDING.equals(bindingId) ||
CommonSOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bindingId))
+ if (SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId))
{
binding = (type == Type.JAXWS ? new SOAP11BindingJAXWS() : new
SOAP11BindingJAXRPC());
}
- else if (CommonSOAPBinding.SOAP12HTTP_BINDING.equals(bindingId) ||
CommonSOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bindingId))
+ else if (SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bindingId))
{
+ binding = (type == Type.JAXWS ? new SOAP11BindingJAXWS(true) : new
SOAP11BindingJAXRPC(true));
+ }
+ else if (SOAPBinding.SOAP12HTTP_BINDING.equals(bindingId))
+ {
binding = (type == Type.JAXWS ? new SOAP12BindingJAXWS() : new
SOAP12BindingJAXRPC());
}
- else
+ else if (SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bindingId))
{
- throw new WSException("Unsupported binding: " + bindingId);
+ binding = (type == Type.JAXWS ? new SOAP12BindingJAXWS(true) : new
SOAP12BindingJAXRPC(true));
}
+ else if (HTTPBinding.HTTP_BINDING.equals(bindingId))
+ {
+ binding = new HTTPBindingJAXWS();
+ }
}
public CommonBinding getCommonBinding()
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java 2007-04-03
16:36:52 UTC (rev 2751)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java 2007-04-03
21:36:00 UTC (rev 2752)
@@ -28,7 +28,6 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.ws.core.CommonSOAP11Binding;
-import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.RoleSource;
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -44,11 +43,16 @@
// Delegate to JAXWS SOAP binding
private SOAPBindingJAXRPC delegate = new SOAPBindingJAXRPC();
- public SOAP11BindingJAXRPC() {
- super();
+ public SOAP11BindingJAXRPC()
+ {
setMTOMEnabled(false);
}
+ public SOAP11BindingJAXRPC(boolean mtomEnabled)
+ {
+ setMTOMEnabled(mtomEnabled);
+ }
+
public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage)
{
delegate.setSOAPActionHeader(opMetaData, reqMessage);
@@ -58,7 +62,7 @@
{
return SOAPFaultHelperJAXRPC.exceptionToFaultMessage(ex);
}
-
+
protected void throwFaultException(SOAPFaultImpl fault) throws Exception
{
throw SOAPFaultHelperJAXRPC.getSOAPFaultException(fault);
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java 2007-04-03
16:36:52 UTC (rev 2751)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java 2007-04-03
21:36:00 UTC (rev 2752)
@@ -28,9 +28,7 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.ws.core.CommonSOAP12Binding;
-import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.RoleSource;
-import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -45,11 +43,16 @@
// Delegate to JAXWS SOAP binding
private SOAPBindingJAXRPC delegate = new SOAPBindingJAXRPC();
- public SOAP12BindingJAXRPC() {
- super();
+ public SOAP12BindingJAXRPC()
+ {
setMTOMEnabled(false);
}
+ public SOAP12BindingJAXRPC(boolean mtomEnabled)
+ {
+ setMTOMEnabled(mtomEnabled);
+ }
+
public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage)
{
delegate.setSOAPActionHeader(opMetaData, reqMessage);
@@ -59,7 +62,7 @@
{
return SOAPFaultHelperJAXRPC.exceptionToFaultMessage(ex);
}
-
+
@Override
public Set<String> getRoles()
{
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java 2007-04-03
16:36:52 UTC (rev 2751)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java 2007-04-03
21:36:00 UTC (rev 2752)
@@ -31,8 +31,6 @@
import javax.xml.ws.EndpointReference;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.Service.Mode;
-import javax.xml.ws.http.HTTPBinding;
-import javax.xml.ws.soap.SOAPBinding;
import org.jboss.util.NotImplementedException;
import org.jboss.ws.core.CommonBindingProvider;
@@ -50,12 +48,12 @@
{
private Map<String, Object> requestContext = new HashMap<String,
Object>();
private Map<String, Object> responseContext = new HashMap<String,
Object>();
-
+
public BindingProviderImpl(EndpointMetaData epMetaData)
{
super(epMetaData);
}
-
+
public BindingProviderImpl(String bindingId)
{
super(bindingId, Type.JAXWS);
@@ -64,38 +62,21 @@
@Override
protected void initBinding(String bindingId, Type type)
{
- if (epMetaData != null && epMetaData.getServiceMode() == Mode.MESSAGE)
+ super.initBinding(bindingId, type);
+ if (binding == null)
{
- binding = new MessageBinding();
+ if (epMetaData != null && epMetaData.getServiceMode() == Mode.MESSAGE)
+ {
+ binding = new MessageBinding();
+ }
+ else if (epMetaData != null && epMetaData.getServiceMode() ==
Mode.PAYLOAD)
+ {
+ binding = new PayloadBinding();
+ }
}
- else if (epMetaData != null && epMetaData.getServiceMode() ==
Mode.PAYLOAD)
- {
- binding = new PayloadBinding();
- }
- else if (SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId))
- {
- binding = new SOAP11BindingJAXWS();
- }
- else if (SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bindingId))
- {
- binding = new SOAP11BindingJAXWS(true);
- }
- else if (SOAPBinding.SOAP12HTTP_BINDING.equals(bindingId))
- {
- binding = new SOAP12BindingJAXWS();
- }
- else if (SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bindingId))
- {
- binding = new SOAP12BindingJAXWS(true);
- }
- else if (HTTPBinding.HTTP_BINDING.equals(bindingId))
- {
- binding = new HTTPBindingJAXWS();
- }
- else
- {
+
+ if (binding == null)
throw new WebServiceException("Unsupported binding: " + bindingId);
- }
}
public Map<String, Object> getRequestContext()
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2007-04-03
16:36:52 UTC (rev 2751)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2007-04-03
21:36:00 UTC (rev 2752)
@@ -27,18 +27,24 @@
import java.util.Map;
import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
import javax.xml.ws.handler.Handler;
import javax.xml.ws.http.HTTPBinding;
+import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
-import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonBinding;
+import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.HTTPMessageImpl;
import org.jboss.ws.core.HeaderSource;
import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
/**
@@ -49,24 +55,71 @@
*/
public class HTTPBindingJAXWS implements CommonBinding, BindingExt, HTTPBinding
{
+ // provide logging
+ private static final Logger log = Logger.getLogger(HTTPBindingJAXWS.class);
+
private BindingImpl delegate = new BindingImpl();
-
- public MessageAbstraction bindRequestMessage(OperationMetaData opMetaData,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws
BindingException
+
+ public MessageAbstraction bindRequestMessage(OperationMetaData opMetaData,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ throws BindingException
{
throw new NotImplementedException();
}
- public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData,
EndpointInvocation epInv) throws BindingException
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData,
MessageAbstraction reqMessage) throws BindingException
{
- throw new NotImplementedException();
+ log.debug("unbindRequestMessage: " + opMetaData.getQName());
+ try
+ {
+ // Construct the endpoint invocation object
+ EndpointInvocation epInv = new EndpointInvocation(opMetaData);
+
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ ParameterMetaData paramMetaData = opMetaData.getParameters().get(0);
+ QName xmlName = paramMetaData.getXmlName();
+
+ HTTPMessageImpl httpMessage = (HTTPMessageImpl)reqMessage;
+ Source source = httpMessage.getXmlFragment().getSource();
+
+ epInv.setRequestParamValue(xmlName, source);
+
+ return epInv;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
}
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData,
MessageAbstraction reqMessage) throws BindingException
+ public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData,
EndpointInvocation epInv) throws BindingException
{
- throw new NotImplementedException();
+ log.debug("bindResponseMessage: " + opMetaData.getQName());
+ try
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Associate current message with message context
+ Source source = (Source)epInv.getReturnValue();
+ HTTPMessageImpl resMessage = new HTTPMessageImpl(source);
+ msgContext.setMessageAbstraction(resMessage);
+
+ return resMessage;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
}
- public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction
resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
throws BindingException
+ public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction
resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ throws BindingException
{
throw new NotImplementedException();
}
@@ -75,7 +128,7 @@
{
throw new NotImplementedException();
}
-
+
public List<Handler> getHandlerChain()
{
return delegate.getHandlerChain();
@@ -95,14 +148,25 @@
{
delegate.setHandlerChain(handlerChain, handlerType);
}
-
+
public String getBindingID()
{
- return Constants.HTTP_BINDING;
+ return HTTPBinding.HTTP_BINDING;
}
public void setHeaderSource(HeaderSource source)
{
// Not needed
}
+
+ private void handleException(Exception ex) throws BindingException
+ {
+ if (ex instanceof RuntimeException)
+ throw (RuntimeException)ex;
+
+ if (ex instanceof BindingException)
+ throw (BindingException)ex;
+
+ throw new BindingException(ex);
+ }
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2007-04-03
16:36:52 UTC (rev 2751)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2007-04-03
21:36:00 UTC (rev 2752)
@@ -27,7 +27,6 @@
import java.util.Map;
import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPMessage;
import javax.xml.ws.handler.Handler;
import org.jboss.logging.Logger;
@@ -41,7 +40,6 @@
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.core.server.ServerHandlerDelegate;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.UnboundHeader;
@@ -71,8 +69,7 @@
/** On the server side, extract the IN parameters from the payload and populate an
Invocation object */
public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData,
MessageAbstraction reqMessage) throws BindingException
{
- if(log.isDebugEnabled()) log.debug("unbindRequestMessage: " +
opMetaData.getQName());
-
+ log.debug("unbindRequestMessage: " + opMetaData.getQName());
try
{
// Construct the endpoint invocation object
@@ -98,8 +95,7 @@
/** On the server side, generate the payload from OUT parameters. */
public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData,
EndpointInvocation epInv) throws BindingException
{
- if(log.isDebugEnabled()) log.debug("bindResponseMessage: " +
opMetaData.getQName());
-
+ log.debug("bindResponseMessage: " + opMetaData.getQName());
try
{
SOAPMessageContextJAXWS msgContext =
(SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
@@ -161,6 +157,16 @@
delegate.setHandlerChain(handlerChain, handlerType);
}
+ public String getBindingID()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void setHeaderSource(HeaderSource source)
+ {
+ // Not needed
+ }
+
private void handleException(Exception ex) throws BindingException
{
if (ex instanceof RuntimeException)
@@ -171,14 +177,4 @@
throw new BindingException(ex);
}
-
- public String getBindingID()
- {
- throw new NotImplementedException();
- }
-
- public void setHeaderSource(HeaderSource source)
- {
- // Not needed
- }
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2007-04-03
16:36:52 UTC (rev 2751)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2007-04-03
21:36:00 UTC (rev 2752)
@@ -43,7 +43,6 @@
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.core.server.ServerHandlerDelegate;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.SOAPBodyImpl;
@@ -65,9 +64,10 @@
// Delegate to JAXWS binding
private BindingImpl delegate = new BindingImpl();
-
+
/** On the client side, generate the payload from IN parameters. */
- public MessageAbstraction bindRequestMessage(OperationMetaData opMetaData,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws
BindingException
+ public MessageAbstraction bindRequestMessage(OperationMetaData opMetaData,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ throws BindingException
{
throw new NotImplementedException();
}
@@ -75,14 +75,13 @@
/** On the server side, extract the IN parameters from the payload and populate an
Invocation object */
public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData,
MessageAbstraction payload) throws BindingException
{
- if(log.isDebugEnabled()) log.debug("unbindRequestMessage: " +
opMetaData.getQName());
-
+ log.debug("unbindRequestMessage: " + opMetaData.getQName());
try
{
// Construct the endpoint invocation object
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
- SOAPMessageContextJAXWS msgContext =
(SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
if (msgContext == null)
throw new WSException("MessageContext not available");
@@ -92,10 +91,10 @@
SOAPMessage reqMessage = (SOAPMessage)payload;
SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMessage.getSOAPBody();
Source source = soapBody.getSource();
-
+
if (source == null)
- throw new IllegalStateException ("Payload cannot be null");
-
+ throw new IllegalStateException("Payload cannot be null");
+
epInv.setRequestParamValue(xmlName, source);
return epInv;
@@ -110,7 +109,8 @@
/** On the server side, generate the payload from OUT parameters. */
public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData,
EndpointInvocation epInv) throws BindingException
{
- if(log.isDebugEnabled()) log.debug("bindResponseMessage: " +
opMetaData.getQName());
+ if (log.isDebugEnabled())
+ log.debug("bindResponseMessage: " + opMetaData.getQName());
try
{
@@ -173,12 +173,12 @@
{
delegate.setHandlerChain(handlerChain);
}
-
+
public void setHandlerChain(List<Handler> handlerChain, HandlerType
handlerType)
{
delegate.setHandlerChain(handlerChain, handlerType);
}
-
+
private void handleException(Exception ex) throws BindingException
{
if (ex instanceof RuntimeException)
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java 2007-04-03
16:36:52 UTC (rev 2751)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java 2007-04-03
21:36:00 UTC (rev 2752)
@@ -27,19 +27,12 @@
import java.util.List;
import java.util.Set;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeaderElement;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.handler.Handler;
import javax.xml.ws.soap.SOAPBinding;
-import org.jboss.util.NotImplementedException;
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonSOAP11Binding;
-import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -58,12 +51,11 @@
public SOAP11BindingJAXWS()
{
- super();
setMTOMEnabled(false);
}
- public SOAP11BindingJAXWS(boolean mtomEnabled) {
- super();
+ public SOAP11BindingJAXWS(boolean mtomEnabled)
+ {
setMTOMEnabled(mtomEnabled);
}
@@ -106,12 +98,12 @@
{
delegate.setHandlerChain(handlerChain, handlerType);
}
-
+
public SOAPMessage createFaultMessageFromException(Exception ex)
{
return SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
}
-
+
protected void throwFaultException(SOAPFaultImpl fault) throws Exception
{
throw SOAPFaultHelperJAXWS.getSOAPFaultException(fault);
@@ -119,6 +111,6 @@
public String getBindingID()
{
- return Constants.SOAP11HTTP_BINDING;
+ return isMTOMEnabled() ? SOAPBinding.SOAP11HTTP_MTOM_BINDING :
SOAPBinding.SOAP11HTTP_BINDING;
}
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2007-04-03
16:36:52 UTC (rev 2751)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2007-04-03
21:36:00 UTC (rev 2752)
@@ -122,6 +122,6 @@
public String getBindingID()
{
- return Constants.SOAP12HTTP_BINDING;
+ return isMTOMEnabled() ? SOAPBinding.SOAP12HTTP_MTOM_BINDING :
SOAPBinding.SOAP12HTTP_BINDING;
}
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageContextImpl.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageContextImpl.java 2007-04-03
16:36:52 UTC (rev 2751)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageContextImpl.java 2007-04-03
21:36:00 UTC (rev 2752)
@@ -27,13 +27,12 @@
import java.util.Map;
import java.util.Set;
-import javax.xml.soap.SOAPMessage;
import javax.xml.ws.LogicalMessage;
import javax.xml.ws.handler.LogicalMessageContext;
import javax.xml.ws.handler.MessageContext;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.Style;
-import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
/**
* The LogicalMessageContext interface extends MessageContext to provide access to a the
@@ -48,13 +47,13 @@
private LogicalMessage logicalMessage;
private MessageContext delegate;
- public LogicalMessageContextImpl(SOAPMessageContextJAXWS soapContext)
+ public LogicalMessageContextImpl(MessageContextJAXWS msgContext)
{
- this.delegate = soapContext;
-
- Style style = soapContext.getEndpointMetaData().getStyle();
- SOAPMessage soapMessage = soapContext.getSOAPMessage();
- logicalMessage = new LogicalMessageImpl(soapMessage, style);
+ this.delegate = msgContext;
+
+ Style style = msgContext.getEndpointMetaData().getStyle();
+ MessageAbstraction message = msgContext.getMessageAbstraction();
+ logicalMessage = new LogicalMessageImpl(message, style);
}
/**
@@ -67,7 +66,7 @@
}
// MessageContext delegation
-
+
public void clear()
{
delegate.clear();
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java 2007-04-03
16:36:52 UTC (rev 2751)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java 2007-04-03
21:36:00 UTC (rev 2752)
@@ -24,7 +24,6 @@
// $Id$
import java.io.IOException;
-import java.util.Iterator;
import javax.xml.bind.JAXBContext;
import javax.xml.soap.SOAPElement;
@@ -36,7 +35,10 @@
import javax.xml.ws.WebServiceException;
import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
import org.jboss.ws.WSException;
+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;
@@ -58,102 +60,149 @@
private static final Logger log = Logger.getLogger(LogicalMessageImpl.class);
private Style style;
- private SOAPBodyImpl soapBody;
+ private MessageAbstraction message;
private boolean setPayloadBodyChild;
- public LogicalMessageImpl(SOAPMessage soapMessage, Style style)
+ public LogicalMessageImpl(MessageAbstraction message, Style style)
{
this.style = style;
- try
- {
- soapBody = (SOAPBodyImpl)soapMessage.getSOAPBody();
- }
- catch (SOAPException ex)
- {
- throw new WebServiceException("Cannot obtain xml payload", ex);
- }
+ this.message = message;
}
public Source getPayload()
{
- Source source = soapBody.getSource();
- setPayloadBodyChild = false;
- if (source == null)
+ Source source = null;
+ if (message instanceof SOAPMessage)
{
- SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
- if (style == Style.RPC)
+ SOAPMessage soapMessage = (SOAPMessage)message;
+ SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
+
+ source = soapBody.getSource();
+ setPayloadBodyChild = false;
+ if (source == null)
{
- source = new DOMSource(soapElement);
+ SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
+ if (style == Style.RPC)
+ {
+ source = new DOMSource(soapElement);
+ }
+ else
+ {
+ SOAPContentElement contentElement = (SOAPContentElement)soapElement;
+ source = contentElement.getPayload();
+ }
+ setPayloadBodyChild = true;
}
- else
- {
- SOAPContentElement contentElement = (SOAPContentElement)soapElement;
- source = contentElement.getPayload();
- }
- setPayloadBodyChild = true;
}
+ else if (message instanceof HTTPMessageImpl)
+ {
+ HTTPMessageImpl httpMessage = (HTTPMessageImpl)message;
+ source = httpMessage.getXmlFragment().getSource();
+ }
return source;
}
public void setPayload(Source source)
{
- if (setPayloadBodyChild)
+ if (message instanceof SOAPMessage)
{
- try
+ SOAPMessage soapMessage = (SOAPMessage)message;
+ SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
+
+ if (setPayloadBodyChild)
{
- SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
- if (style == Style.RPC)
+ try
{
- try
+ SOAPElement soapElement =
(SOAPElement)soapBody.getChildElements().next();
+ if (style == Style.RPC)
{
- EnvelopeBuilderDOM builder = new EnvelopeBuilderDOM(style);
- Element domBodyElement = DOMUtils.sourceToElement(source);
- builder.buildBodyElementRpc(soapBody, domBodyElement);
+ try
+ {
+ EnvelopeBuilderDOM builder = new EnvelopeBuilderDOM(style);
+ Element domBodyElement = DOMUtils.sourceToElement(source);
+ builder.buildBodyElementRpc(soapBody, domBodyElement);
+ }
+ catch (IOException ex)
+ {
+ WSException.rethrow(ex);
+ }
}
- catch (IOException ex)
+ else
{
- WSException.rethrow(ex);
+ SOAPContentElement contentElement = (SOAPContentElement)soapElement;
+ contentElement.setXMLFragment(new XMLFragment(source));
}
}
- else
+ catch (SOAPException ex)
{
- SOAPContentElement contentElement = (SOAPContentElement)soapElement;
- contentElement.setXMLFragment(new XMLFragment(source));
+ throw new WebServiceException("Cannot set xml payload", ex);
}
}
- catch (SOAPException ex)
+ else
{
- throw new WebServiceException("Cannot set xml payload", ex);
+ soapBody.setSource(source);
}
+ // The body payload has been modified
+ soapBody.setModifiedFromSource(true);
}
- else
+ else if (message instanceof HTTPMessageImpl)
{
- soapBody.setSource(source);
+ HTTPMessageImpl httpMessage = (HTTPMessageImpl)message;
+ httpMessage.setXmlFragment(new XMLFragment(source));
}
-
- // The body payload has been modified
- soapBody.setModifiedFromSource(true);
}
public Object getPayload(JAXBContext jaxbContext)
{
Object payload = null;
- Iterator it = soapBody.getChildElements();
- if (it.hasNext())
+ if (message instanceof SOAPMessage)
{
- SOAPContentElement bodyElement = (SOAPContentElement)it.next();
- payload = bodyElement.getObjectValue();
+ SOAPMessage soapMessage = (SOAPMessage)message;
+ SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
+
+ SOAPContentElement bodyElement = (SOAPContentElement)soapBody.getFirstChild();
+ if (bodyElement != null)
+ {
+ payload = bodyElement.getObjectValue();
+ }
}
+ else if (message instanceof HTTPMessageImpl)
+ {
+ throw new NotImplementedException();
+ }
return payload;
}
public void setPayload(Object payload, JAXBContext jaxbContext)
{
- Iterator it = soapBody.getChildElements();
- if (it.hasNext())
+ if (message instanceof SOAPMessage)
{
- SOAPContentElement bodyElement = (SOAPContentElement)it.next();
- bodyElement.setObjectValue(payload);
+ SOAPMessage soapMessage = (SOAPMessage)message;
+ SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
+
+ SOAPContentElement bodyElement = (SOAPContentElement)soapBody.getFirstChild();
+ if (bodyElement != null)
+ {
+ bodyElement.setObjectValue(payload);
+ }
}
+ else if (message instanceof HTTPMessageImpl)
+ {
+ throw new NotImplementedException();
+ }
}
+
+ private SOAPBodyImpl getSOAPBody(SOAPMessage soapMessage)
+ {
+ SOAPBodyImpl soapBody = null;
+ try
+ {
+ soapBody = (SOAPBodyImpl)soapMessage.getSOAPBody();
+ }
+ catch (SOAPException ex)
+ {
+ WSException.rethrow(ex);
+ }
+ return soapBody;
+ }
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-04-03
16:36:52 UTC (rev 2751)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-04-03
21:36:00 UTC (rev 2752)
@@ -227,15 +227,15 @@
XOPContext.setMTOMEnabled(((CommonSOAPBinding)binding).isMTOMEnabled());
// Bind the response message
- SOAPMessage resMessage = (SOAPMessage)binding.bindResponseMessage(opMetaData,
epInv);
- msgContext.setSOAPMessage(resMessage);
+ MessageAbstraction resMessage = binding.bindResponseMessage(opMetaData,
epInv);
+ msgContext.setMessageAbstraction(resMessage);
}
else
{
// Reverse the message direction without calling the endpoint
- SOAPMessage resMessage = msgContext.getSOAPMessage();
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
msgContext = processPivotInternal(msgContext, direction);
- msgContext.setSOAPMessage(resMessage);
+ msgContext.setMessageAbstraction(resMessage);
}
if (oneway == false)
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java 2007-04-03
16:36:52 UTC (rev 2751)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java 2007-04-03
21:36:00 UTC (rev 2752)
@@ -86,7 +86,7 @@
/** Invoke an instance of the SEI implementation bean */
public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv)
throws SOAPFaultException, Exception
{
- if(log.isDebugEnabled()) log.debug("invokeServiceEndpoint: " +
epInv.getJavaMethod().getName());
+ log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
try
{
CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2007-04-03
16:36:52 UTC (rev 2751)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2007-04-03
21:36:00 UTC (rev 2752)
@@ -38,6 +38,7 @@
import javax.xml.ws.Service.Mode;
import org.jboss.ws.Constants;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.Style;
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.core.utils.JavaUtils;
@@ -109,9 +110,7 @@
sepMetaData.setServiceEndpointInterfaceName(sepClass.getName());
ServiceMode anServiceMode = sepClass.getAnnotation(ServiceMode.class);
- if (anServiceMode != null)
- sepMetaData.setServiceMode(anServiceMode.value());
- else sepMetaData.setServiceMode(Mode.PAYLOAD);
+ sepMetaData.setServiceMode(anServiceMode != null ? anServiceMode.value() :
Mode.PAYLOAD);
serviceMetaData.addEndpoint(sepMetaData);
@@ -159,10 +158,8 @@
OperationMetaData opMetaData = new OperationMetaData(epMetaData, new
QName(targetNS, javaName), javaName);
epMetaData.addOperation(opMetaData);
- Mode serviceMode = epMetaData.getServiceMode();
- Class paramType = (serviceMode == Mode.MESSAGE ? SOAPMessage.class :
Source.class);
-
// Setup invoke param
+ Class paramType = Source.class;
QName xmlName = new QName("invokeParam");
QName xmlType = Constants.TYPE_LITERAL_ANYTYPE;
ParameterMetaData pmd = new ParameterMetaData(opMetaData, xmlName, xmlType,
paramType.getName());