JBossWS SVN: r2756 - trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-04-04 07:48:00 -0400 (Wed, 04 Apr 2007)
New Revision: 2756
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java
Log:
Fix test regression
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java 2007-04-04 10:38:07 UTC (rev 2755)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java 2007-04-04 11:48:00 UTC (rev 2756)
@@ -74,7 +74,7 @@
public void setMessage(SOAPMessage message)
{
- setMessage(message);
+ setSOAPMessage(message);
}
/** Create the serialization context
17 years
JBossWS SVN: r2755 - in trunk: integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms and 34 other directories.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-04-04 06:38:07 -0400 (Wed, 04 Apr 2007)
New Revision: 2755
Added:
trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageAbstraction.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/MessageTrace.java
trunk/jbossws-core/src/java/org/jboss/ws/core/SOAPMessageAbstraction.java
trunk/jbossws-core/src/java/org/jboss/ws/core/client/EndpointInfo.java
trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java
trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBinding.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/UserType.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/WebServiceEndpoint.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/httpbinding-handlers.xml
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/WEB-INF/
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/WEB-INF/web.xml
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/usertype.xsd
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload/
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload/WEB-INF/
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload/WEB-INF/web.xml
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared/
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared/wsdl/
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared/wsdl/HttpBinding.wsdl
Removed:
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/EndpointInfo.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/UserType.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/WebServiceEndpoint.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/httpbinding-handlers.xml
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/WEB-INF/
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/WEB-INF/web.xml
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/usertype.xsd
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload/
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload/WEB-INF/
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload/WEB-INF/web.xml
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared/
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared/wsdl/
trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared/wsdl/HttpBinding.wsdl
trunk/jbossws-tests/src/resources/jaxws/samples/provider/jaxb/org/
Modified:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java
trunk/jbossws-core/src/java/javax/xml/ws/soap/SOAPBinding.java
trunk/jbossws-core/src/java/org/jboss/ws/Constants.java
trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java
trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBindingProvider.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/CommonSOAP11Binding.java
trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP12Binding.java
trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageContextImpl.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/server/AbstractServiceEndpointServlet.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPBodyImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java
trunk/jbossws-core/src/java/org/jboss/ws/core/utils/DOMUtils.java
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
trunk/jbossws-core/src/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
trunk/jbossws-tests/ant-import/build-samples-jaxws.xml
trunk/jbossws-tests/build.xml
trunk/jbossws-tests/src/etc/log4j.xml
trunk/jbossws-tests/src/java/org/jboss/test/ws/JBossWSTest.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/SOAPFaultTestCase.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
Log:
Implement HTTPBinding
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -33,7 +33,9 @@
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -36,6 +36,7 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.server.ServiceEndpoint;
import org.jboss.ws.core.server.ServiceEndpointInvoker;
@@ -90,7 +91,7 @@
// Process the request message and return the already serialized response
// Legacy implementations of the JMSTransportSupport dont provide a msg
// context which is needed for serialization.
- resMessage = sep.handleRequest(null, null, reqMessage);
+ resMessage = (SOAPMessage)sep.processRequest(null, null, reqMessage);
resMessage.writeTo(new ByteArrayOutputStream());
return resMessage;
}
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-04 10:34:50 UTC (rev 2754)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -33,6 +33,7 @@
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
Modified: trunk/jbossws-core/src/java/javax/xml/ws/soap/SOAPBinding.java
===================================================================
--- trunk/jbossws-core/src/java/javax/xml/ws/soap/SOAPBinding.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/javax/xml/ws/soap/SOAPBinding.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -34,76 +34,75 @@
* the SOAP binding.
*
* @since JAX-WS 2.0
-**/
-public interface SOAPBinding extends Binding {
+ **/
+public interface SOAPBinding extends Binding
+{
+ /**
+ * A constant representing the identity of the SOAP 1.1 over HTTP binding.
+ */
+ public static final String SOAP11HTTP_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http";
- /**
- * A constant representing the identity of the SOAP 1.1 over HTTP binding.
- */
- public static final String SOAP11HTTP_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http";
+ /**
+ * A constant representing the identity of the SOAP 1.2 over HTTP binding.
+ */
+ public static final String SOAP12HTTP_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/";
- /**
- * A constant representing the identity of the SOAP 1.2 over HTTP binding.
- */
- public static final String SOAP12HTTP_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/";
+ /**
+ * A constant representing the identity of the SOAP 1.1 over HTTP binding
+ * with MTOM enabled by default.
+ */
+ public static final String SOAP11HTTP_MTOM_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true";
- /**
- * A constant representing the identity of the SOAP 1.1 over HTTP binding
- * with MTOM enabled by default.
- */
- public static final String SOAP11HTTP_MTOM_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true";
+ /**
+ * A constant representing the identity of the SOAP 1.2 over HTTP binding
+ * with MTOM enabled by default.
+ */
+ public static final String SOAP12HTTP_MTOM_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true";
- /**
- * A constant representing the identity of the SOAP 1.2 over HTTP binding
- * with MTOM enabled by default.
- */
- public static final String SOAP12HTTP_MTOM_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true";
-
-
- /** Gets the roles played by the SOAP binding instance.
- *
- * @return Set<String> The set of roles played by the binding instance.
- **/
- public Set<String> getRoles();
+ /** Gets the roles played by the SOAP binding instance.
+ *
+ * @return Set<String> The set of roles played by the binding instance.
+ **/
+ public Set<String> getRoles();
- /** Sets the roles played by the SOAP binding instance.
- *
- * @param roles The set of roles played by the binding instance.
- * @throws WebServiceException On an error in the configuration of
- * the list of roles.
- **/
- public void setRoles(Set<String> roles);
+ /** Sets the roles played by the SOAP binding instance.
+ *
+ * @param roles The set of roles played by the binding instance.
+ * @throws WebServiceException On an error in the configuration of
+ * the list of roles.
+ **/
+ public void setRoles(Set<String> roles);
- /**
- * Returns <code>true</code> if the use of MTOM is enabled.
- *
- * @return <code>true</code> if and only if the use of MTOM is enabled.
- **/
-
- public boolean isMTOMEnabled();
-
- /**
- * Enables or disables use of MTOM.
- *
- * @param flag A <code>boolean</code> specifying whether the use of MTOM should
- * be enabled or disabled.
- * @throws WebServiceException If the specified setting is not supported
- * by this binding instance.
- * *
- **/
- public void setMTOMEnabled(boolean flag);
-
- /**
- * Gets the SAAJ <code>SOAPFactory</code> instance used by this SOAP binding.
- *
- * @return SOAPFactory instance used by this SOAP binding.
- **/
- public SOAPFactory getSOAPFactory();
-
- /**
- * Gets the SAAJ <code>MessageFactory</code> instance used by this SOAP binding.
- *
- * @return MessageFactory instance used by this SOAP binding.
- **/
- public MessageFactory getMessageFactory();
+ /**
+ * Returns <code>true</code> if the use of MTOM is enabled.
+ *
+ * @return <code>true</code> if and only if the use of MTOM is enabled.
+ **/
+
+ public boolean isMTOMEnabled();
+
+ /**
+ * Enables or disables use of MTOM.
+ *
+ * @param flag A <code>boolean</code> specifying whether the use of MTOM should
+ * be enabled or disabled.
+ * @throws WebServiceException If the specified setting is not supported
+ * by this binding instance.
+ * *
+ **/
+ public void setMTOMEnabled(boolean flag);
+
+ /**
+ * Gets the SAAJ <code>SOAPFactory</code> instance used by this SOAP binding.
+ *
+ * @return SOAPFactory instance used by this SOAP binding.
+ **/
+ public SOAPFactory getSOAPFactory();
+
+ /**
+ * Gets the SAAJ <code>MessageFactory</code> instance used by this SOAP binding.
+ *
+ * @return MessageFactory instance used by this SOAP binding.
+ **/
+ public MessageFactory getMessageFactory();
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/Constants.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/Constants.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/Constants.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -25,6 +25,8 @@
import javax.xml.namespace.QName;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPConstants;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.soap.SOAPBinding;
import org.jboss.ws.core.soap.NameImpl;
@@ -72,28 +74,18 @@
static final String NS_XML_MIME = "http://www.w3.org/2005/05/xmlmime";
/** The namespace for XOP. */
static final String NS_XOP = "http://www.w3.org/2004/08/xop/include";
- /**
- * A constant representing the identity of the SOAP 1.1 over HTTP binding.
- */
- public static final String SOAP11HTTP_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http";
-
- /**
- * A constant representing the identity of the SOAP 1.2 over HTTP binding.
- */
- public static final String SOAP12HTTP_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/";
-
- /**
- * A constant representing the identity of the SOAP 1.1 over HTTP binding
- * with MTOM enabled by default.
- */
- public static final String SOAP11HTTP_MTOM_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true";
-
- /**
- * A constant representing the identity of the SOAP 1.2 over HTTP binding
- * with MTOM enabled by default.
- */
- public static final String SOAP12HTTP_MTOM_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true";
+ /** A constant representing the identity of the SOAP 1.1 over HTTP binding. */
+ public static final String SOAP11HTTP_BINDING = SOAPBinding.SOAP11HTTP_BINDING;
+ /** A constant representing the identity of the SOAP 1.2 over HTTP binding. */
+ public static final String SOAP12HTTP_BINDING = SOAPBinding.SOAP12HTTP_BINDING;
+ /** A constant representing the identity of the SOAP 1.1 over HTTP binding with MTOM enabled by default. */
+ public static final String SOAP11HTTP_MTOM_BINDING = SOAPBinding.SOAP11HTTP_MTOM_BINDING;
+ /** A constant representing the identity of the SOAP 1.2 over HTTP binding with MTOM enabled by default. */
+ public static final String SOAP12HTTP_MTOM_BINDING = SOAPBinding.SOAP12HTTP_MTOM_BINDING;
+ /** A constant representing the identity of the XML/HTTP binding. */
+ public static final String HTTP_BINDING = HTTPBinding.HTTP_BINDING;
+
/** SOAP-1.1 encoding URI */
static final String URI_SOAP11_ENC = SOAPConstants.URI_NS_SOAP_ENCODING;
/** SOAP-1.2 encoding URI */
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -40,19 +40,19 @@
public interface CommonBinding
{
/** On the client side, generate the Object from IN parameters. */
- Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
+ MessageAbstraction bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
/** On the server side, extract the IN parameters from the Object and populate an Invocation object */
- EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object reqMessage) throws BindingException;
+ EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, MessageAbstraction reqMessage) throws BindingException;
/** On the server side, generate the Object from OUT parameters in the Invocation object. */
- Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException;
+ MessageAbstraction bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException;
/** On the client side, extract the OUT parameters from the Object and return them to the client. */
- void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
+ void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
/** bind an exception to a fault message */
- Object bindFaultMessage(Exception ex);
+ MessageAbstraction bindFaultMessage(Exception ex);
void setHeaderSource(HeaderSource source);
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBindingProvider.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBindingProvider.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBindingProvider.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -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: trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -38,7 +38,6 @@
import javax.xml.soap.AttachmentPart;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
import javax.xml.ws.addressing.AddressingProperties;
import javax.xml.ws.addressing.JAXWSAConstants;
@@ -46,12 +45,11 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.DirectionHolder.Direction;
+import org.jboss.ws.core.client.EndpointInfo;
+import org.jboss.ws.core.client.SOAPRemotingConnection;
import org.jboss.ws.core.jaxrpc.ParameterWrapping;
import org.jboss.ws.core.jaxrpc.Style;
-import org.jboss.ws.core.soap.EndpointInfo;
import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.SOAPBodyImpl;
-import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.core.utils.HolderUtils;
import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
@@ -75,9 +73,9 @@
{
// provide logging
private static Logger log = Logger.getLogger(CommonClient.class);
-
+
public static String SESSION_COOKIES = "org.jboss.ws.maintain.session.cookies";
-
+
// The endpoint together with the operationName uniquely identify the call operation
protected EndpointMetaData epMetaData;
// The current operation name
@@ -223,7 +221,7 @@
protected abstract void setInboundContextProperties();
protected abstract void setOutboundContextProperties();
-
+
protected abstract boolean shouldMaintainSession();
/** Call invokation goes as follows:
@@ -273,7 +271,7 @@
setOutboundContextProperties();
// Bind the request message
- SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData, epInv, unboundHeaders);
+ MessageAbstraction reqMessage = binding.bindRequestMessage(opMetaData, epInv, unboundHeaders);
// Add possible attachment parts
addAttachmentParts(reqMessage);
@@ -284,8 +282,8 @@
handlerPass = handlerPass && callRequestHandlerChain(portName, handlerType[2]);
// Handlers might have replaced the message
- reqMessage = msgContext.getSOAPMessage();
-
+ reqMessage = msgContext.getMessageAbstraction();
+
if (handlerPass)
{
String targetAddress = getTargetEndpointAddress();
@@ -315,32 +313,25 @@
if (targetAddress == null)
throw new WSException("Target endpoint address not set");
- Map<String, Object> callProps = new HashMap<String, Object>(getRequestContext());
+ Map<String, Object> callProps = new HashMap<String, Object>(getRequestContext());
EndpointInfo epInfo = new EndpointInfo(epMetaData, targetAddress, callProps);
if (shouldMaintainSession())
addSessionInfo(reqMessage, callProps);
- SOAPMessage resMessage;
- if (oneway)
- {
- resMessage = new SOAPConnectionImpl().callOneWay(reqMessage, epInfo);
- }
- else
- {
- resMessage = new SOAPConnectionImpl().call(reqMessage, epInfo);
- }
-
+ SOAPRemotingConnection remotingConnection = new SOAPRemotingConnection();
+ MessageAbstraction resMessage = remotingConnection.invoke(reqMessage, epInfo, oneway);
+
if (shouldMaintainSession())
saveSessionInfo(callProps, getRequestContext());
// At pivot the message context might be replaced
msgContext = processPivotInternal(msgContext, direction);
-
+
// Copy the remoting meta data
msgContext.put(CommonMessageContext.REMOTING_METADATA, callProps);
// Associate response message with message context
- msgContext.setSOAPMessage(resMessage);
+ msgContext.setMessageAbstraction(resMessage);
}
setInboundContextProperties();
@@ -361,7 +352,7 @@
if (handlerPass)
{
// unbind the return values
- SOAPMessage resMessage = msgContext.getSOAPMessage();
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
binding.unbindResponseMessage(opMetaData, resMessage, epInv, unboundHeaders);
}
@@ -371,10 +362,10 @@
faultType[0] = null;
// Check if protocol handlers modified the payload
- if (((SOAPBodyImpl)reqMessage.getSOAPBody()).isModifiedFromSource())
+ if (reqMessage.isModified())
{
log.debug("Handler modified body payload, unbind message again");
- SOAPMessage resMessage = msgContext.getSOAPMessage();
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
binding.unbindResponseMessage(opMetaData, resMessage, epInv, unboundHeaders);
}
@@ -403,53 +394,53 @@
closeHandlerChain(portName, handlerType[0]);
}
}
-
+
private void saveSessionInfo(Map<String, Object> remotingMetadata, Map<String, Object> requestContext)
{
- Map<String, String> cookies = (Map) remotingMetadata.get(SESSION_COOKIES);
+ Map<String, String> cookies = (Map)remotingMetadata.get(SESSION_COOKIES);
if (cookies == null)
{
cookies = new HashMap<String, String>();
requestContext.put(SESSION_COOKIES, cookies);
}
-
+
List<String> setCookies = new ArrayList<String>();
-
+
List<String> setCookies1 = (List)remotingMetadata.get("Set-Cookie");
if (setCookies1 != null)
setCookies.addAll(setCookies1);
-
+
List<String> setCookies2 = (List)remotingMetadata.get("Set-Cookie2");
if (setCookies2 != null)
setCookies.addAll(setCookies2);
-
+
// TODO: The parsing here should be improved to be fully compliant with the RFC
for (String setCookie : setCookies)
{
int index = setCookie.indexOf(';');
if (index == -1)
continue;
-
+
String pair = setCookie.substring(0, index);
index = pair.indexOf('=');
if (index == -1)
continue;
-
+
String name = pair.substring(0, index);
String value = pair.substring(index + 1);
-
+
cookies.put(name, value);
}
}
- protected void addSessionInfo(SOAPMessage reqMessage, Map<String, Object> callProperties)
+ protected void addSessionInfo(MessageAbstraction reqMessage, Map<String, Object> callProperties)
{
- Map<String, String> cookies = (Map) callProperties.get(SESSION_COOKIES);
+ Map<String, String> cookies = (Map)callProperties.get(SESSION_COOKIES);
if (cookies != null)
{
for (Map.Entry<String, String> cookie : cookies.entrySet())
{
- reqMessage.getMimeHeaders().addHeader("Cookie" , cookie.getKey() + "=" + cookie.getValue());
+ reqMessage.getMimeHeaders().addHeader("Cookie", cookie.getKey() + "=" + cookie.getValue());
}
}
}
@@ -464,12 +455,11 @@
return msgContext;
}
- protected void addAttachmentParts(SOAPMessage reqMessage)
+ protected void addAttachmentParts(MessageAbstraction reqMessage)
{
for (AttachmentPart part : attachmentParts)
{
- if (log.isDebugEnabled())
- log.debug("Adding attachment part: " + part.getContentId());
+ log.debug("Adding attachment part: " + part.getContentId());
reqMessage.addAttachmentPart(part);
}
}
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-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/CommonMessageContext.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -35,6 +35,7 @@
import org.jboss.logging.Logger;
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.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.xb.binding.NamespaceRegistry;
@@ -61,8 +62,8 @@
private EndpointMetaData epMetaData;
// The operation for this message ctx
private OperationMetaData opMetaData;
- // The SOAPMessage in this message context
- private SOAPMessage soapMessage;
+ // The Message in this message context
+ private MessageAbstraction message;
// The map of scoped properties
protected Map<String, ScopedProperty> scopedProps = new HashMap<String, ScopedProperty>();
// The current property scope
@@ -77,7 +78,7 @@
{
this.epMetaData = msgContext.epMetaData;
this.opMetaData = msgContext.opMetaData;
- this.soapMessage = msgContext.soapMessage;
+ this.message = msgContext.message;
this.serContext = msgContext.serContext;
this.scopedProps = new HashMap<String, ScopedProperty>(msgContext.scopedProps);
this.currentScope = msgContext.currentScope;
@@ -118,14 +119,24 @@
public SOAPMessage getSOAPMessage()
{
- return soapMessage;
+ return (SOAPMessage)message;
}
public void setSOAPMessage(SOAPMessage soapMessage)
{
- this.soapMessage = soapMessage;
+ this.message = (MessageAbstraction)soapMessage;
}
+ public MessageAbstraction getMessageAbstraction()
+ {
+ return message;
+ }
+
+ public void setMessageAbstraction(MessageAbstraction message)
+ {
+ this.message = message;
+ }
+
public SerializationContext getSerializationContext()
{
if (serContext == null)
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP11Binding.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP11Binding.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP11Binding.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -35,6 +35,7 @@
import org.jboss.ws.core.jaxrpc.Use;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.SOAPFaultImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
@@ -50,11 +51,11 @@
}
/** Create the SOAP-1.1 message */
- protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException
+ protected MessageAbstraction createMessage(OperationMetaData opMetaData) throws SOAPException
{
MessageFactoryImpl factory = new MessageFactoryImpl();
factory.setEnvNamespace(Constants.NS_SOAP11_ENV);
- SOAPMessage soapMessage = factory.createMessage();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage();
Use encStyle = opMetaData.getEndpointMetaData().getEncodingStyle();
if (Use.ENCODED.equals(encStyle))
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP12Binding.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP12Binding.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP12Binding.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -52,11 +52,11 @@
}
/** Create the SOAP-1.1 message */
- protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException
+ protected MessageAbstraction createMessage(OperationMetaData opMetaData) throws SOAPException
{
MessageFactoryImpl factory = new MessageFactoryImpl();
factory.setEnvNamespace(Constants.NS_SOAP12_ENV);
- return factory.createMessage();
+ return (MessageAbstraction)factory.createMessage();
}
protected abstract Set<String> getRoles();
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-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -129,11 +129,11 @@
this.mtomEnabled = flag;
}
- /** Create the SOAP-1.1 message */
- protected abstract SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException;
+ /** Create the message */
+ protected abstract MessageAbstraction createMessage(OperationMetaData opMetaData) throws SOAPException;
/** On the client side, generate the payload from IN parameters. */
- public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ public MessageAbstraction bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
{
if (log.isDebugEnabled())
log.debug("bindRequestMessage: " + opMetaData.getQName());
@@ -250,7 +250,7 @@
public abstract void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage);
/** On the server side, extract the IN parameters from the payload and populate an Invocation object */
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object payload) throws BindingException
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, MessageAbstraction payload) throws BindingException
{
if (log.isDebugEnabled())
log.debug("unbindRequestMessage: " + opMetaData.getQName());
@@ -346,7 +346,7 @@
}
/** On the server side, generate the payload from OUT parameters. */
- public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
+ public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
{
if (log.isDebugEnabled())
log.debug("bindResponseMessage: " + opMetaData.getQName());
@@ -475,7 +475,7 @@
}
/** On the client side, extract the OUT parameters from the payload and return them to the client. */
- public void unbindResponseMessage(OperationMetaData opMetaData, Object payload, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction payload, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
throws BindingException
{
if (log.isDebugEnabled())
@@ -610,9 +610,9 @@
}
}
- public Object bindFaultMessage(Exception ex)
+ public MessageAbstraction bindFaultMessage(Exception ex)
{
- SOAPMessage faultMessage = createFaultMessageFromException(ex);
+ SOAPMessageImpl faultMessage = (SOAPMessageImpl)createFaultMessageFromException(ex);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext != null)
{
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageAbstraction.java (from rev 2753, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageAbstraction.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageAbstraction.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageAbstraction.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,33 @@
+/*
+ * 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.core;
+
+/**
+ * A generic HTTP message
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Apr-2007
+ */
+public interface HTTPMessageAbstraction extends MessageAbstraction
+{
+
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java (from rev 2753, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,125 @@
+/*
+ * 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.core;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.core.soap.XMLFragment;
+import org.jboss.ws.core.soap.attachment.MimeConstants;
+
+/**
+ * A generic HTTP message
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Apr-2007
+ */
+public class HTTPMessageImpl implements HTTPMessageAbstraction
+{
+ private MimeHeaders mimeHeaders;
+ private XMLFragment xmlFragment;
+ private boolean modified;
+
+ public HTTPMessageImpl(MimeHeaders mimeHeaders, InputStream inputStream)
+ {
+ this.mimeHeaders = mimeHeaders;
+ this.xmlFragment = new XMLFragment(new StreamSource(inputStream));
+ }
+
+ public HTTPMessageImpl(Source source)
+ {
+ this.mimeHeaders = new MimeHeaders();
+ this.xmlFragment = new XMLFragment(source);
+
+ initDefaultMimeHeaders();
+ }
+
+ public HTTPMessageImpl(Result result)
+ {
+ this.mimeHeaders = new MimeHeaders();
+ this.xmlFragment = new XMLFragment(result);
+
+ initDefaultMimeHeaders();
+ }
+
+ private void initDefaultMimeHeaders()
+ {
+ mimeHeaders.setHeader(MimeConstants.CONTENT_TYPE, MimeConstants.TYPE_XML_UTF8);
+ }
+
+ public XMLFragment getXmlFragment()
+ {
+ return xmlFragment;
+ }
+
+ public void setXmlFragment(XMLFragment xmlFragment)
+ {
+ this.xmlFragment = xmlFragment;
+ }
+
+ public MimeHeaders getMimeHeaders()
+ {
+ if (mimeHeaders == null)
+ mimeHeaders = new MimeHeaders();
+
+ return mimeHeaders;
+ }
+
+ public void setMimeHeaders(MimeHeaders mimeHeaders)
+ {
+ this.mimeHeaders = mimeHeaders;
+ }
+
+ public void writeTo(OutputStream outputStream) throws IOException
+ {
+ xmlFragment.writeTo(outputStream);
+ }
+
+ public boolean isFaultMessage()
+ {
+ return false;
+ }
+
+ public void addAttachmentPart(AttachmentPart part)
+ {
+ throw new NotImplementedException();
+ }
+
+ public boolean isModified()
+ {
+ return modified;
+ }
+
+ public void setModified(boolean modifiedInHandler)
+ {
+ this.modified = modifiedInHandler;
+ }
+
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java (from rev 2753, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,50 @@
+/*
+ * 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.core;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MimeHeaders;
+
+/**
+ * A generic message independent of the underlying protocol
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Apr-2007
+ */
+public interface MessageAbstraction
+{
+ MimeHeaders getMimeHeaders();
+
+ void writeTo(OutputStream outputStream) throws IOException;
+
+ boolean isFaultMessage();
+
+ boolean isModified();
+
+ void setModified(boolean flag);
+
+ void addAttachmentPart(AttachmentPart part);
+
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTrace.java (from rev 2753, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTrace.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTrace.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTrace.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,84 @@
+/*
+ * 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.core;
+
+// $Id$
+
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPElementWriter;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.w3c.dom.Element;
+
+/**
+ * Trace incomming/outgoing messages
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Apr-2007
+ */
+public final class MessageTrace
+{
+ private static Logger msgLog = Logger.getLogger(MessageTrace.class);
+
+ // Hide ctor
+ private MessageTrace()
+ {
+ }
+
+ public static void traceMessage(String messagePrefix, MessageAbstraction message)
+ {
+ if (msgLog.isTraceEnabled())
+ {
+ if (message instanceof SOAPMessage)
+ {
+ try
+ {
+ SOAPEnvelope soapEnv = ((SOAPMessage)message).getSOAPPart().getEnvelope();
+ if (soapEnv != null)
+ {
+ String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, true);
+ msgLog.trace(messagePrefix + "\n" + envStr);
+ }
+ }
+ catch (SOAPException ex)
+ {
+ msgLog.error("Cannot trace SOAPMessage", ex);
+ }
+ }
+ else if (message instanceof HTTPMessageImpl)
+ {
+ HTTPMessageImpl httpMessage = (HTTPMessageImpl)message;
+ Element root = httpMessage.getXmlFragment().toElement();
+ String xmlString = DOMWriter.printNode(root, true);
+ msgLog.trace(messagePrefix + "\n" + xmlString);
+ }
+ else
+ {
+ msgLog.warn("Unsupported message type: " + message);
+ }
+ }
+ }
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/SOAPMessageAbstraction.java (from rev 2753, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/SOAPMessageAbstraction.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/SOAPMessageAbstraction.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/SOAPMessageAbstraction.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,33 @@
+/*
+ * 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.core;
+
+/**
+ * A generic SOAP message
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Apr-2007
+ */
+public interface SOAPMessageAbstraction extends MessageAbstraction
+{
+
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/client/EndpointInfo.java (from rev 2753, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/EndpointInfo.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/client/EndpointInfo.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/client/EndpointInfo.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,99 @@
+/*
+* 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.core.client;
+
+// $Id$
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+
+/** A wrapper object that associates the target address with some metadata
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 20-Jul-2005
+ */
+public class EndpointInfo
+{
+ private String targetAddress;
+ private Map<String, Object> properties;
+ public EndpointInfo(EndpointMetaData epMetaData, String targetAddress, Map<String, Object> callProps)
+ {
+ this.targetAddress = targetAddress;
+ this.properties = callProps;
+
+ // Add the service properties
+ Properties serviceProps = epMetaData.getServiceMetaData().getProperties();
+ if (serviceProps != null)
+ {
+ Iterator it = serviceProps.entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+ String key = (String)entry.getKey();
+ Object val = entry.getValue();
+ properties.put(key, val);
+ }
+ }
+
+ // Add the endpoint properties
+ Properties epProps = epMetaData.getProperties();
+ Iterator it = epProps.entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+ String key = (String)entry.getKey();
+ Object val = entry.getValue();
+ properties.put(key, val);
+ }
+
+ }
+
+ public Map<String, Object> getProperties()
+ {
+ return properties;
+ }
+
+ public String getTargetAddress()
+ {
+ return targetAddress;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof EndpointInfo))
+ return false;
+ return toString().equals(obj.toString());
+ }
+
+ public int hashCode()
+ {
+ return toString().hashCode();
+ }
+
+ public String toString()
+ {
+ return "[addr=" + targetAddress + ",props=" + properties + "]";
+ }
+}
\ No newline at end of file
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java (from rev 2753, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,45 @@
+/*
+ * 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.core.client;
+
+// $Id$
+
+import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.ws.core.jaxws.binding.HTTPMessageMarshaller;
+import org.jboss.ws.core.jaxws.binding.HTTPMessageUnMarshaller;
+
+/**
+ * @since 02-Apr-2007
+ */
+public class HTTPRemotingConnection extends RemotingConnectionImpl
+{
+ protected UnMarshaller getUnmarshaller()
+ {
+ return new HTTPMessageUnMarshaller();
+ }
+
+ protected Marshaller getMarshaller()
+ {
+ return new HTTPMessageMarshaller();
+ }
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java (from rev 2753, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.core.client;
+
+
+import java.io.IOException;
+
+import org.jboss.ws.core.MessageAbstraction;
+
+// $Id$
+
+/**
+ * A remoting connection
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 02-Apr-2007
+ */
+public interface RemotingConnection
+{
+ MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException;
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java (from rev 2753, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,358 @@
+/*
+ * 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.core.client;
+
+// $Id$
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.SocketTimeoutException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.rpc.Stub;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.addressing.EndpointReference;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.marshal.MarshalFactory;
+import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.MessageTrace;
+import org.jboss.ws.core.StubExt;
+import org.jboss.ws.core.WSTimeoutException;
+
+/**
+ * SOAPConnection implementation
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason@stacksmash.com">Jason T. Greene</a>
+ *
+ * @since 02-Feb-2005
+ */
+public abstract class RemotingConnectionImpl implements RemotingConnection
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(RemotingConnectionImpl.class);
+
+ private Map<String, Object> clientConfig = new HashMap<String, Object>();
+
+ private static Map<String, String> metadataMap = new HashMap<String, String>();
+ static
+ {
+ metadataMap.put(Stub.USERNAME_PROPERTY, "http.basic.username");
+ metadataMap.put(Stub.PASSWORD_PROPERTY, "http.basic.password");
+ metadataMap.put(BindingProvider.USERNAME_PROPERTY, "http.basic.username");
+ metadataMap.put(BindingProvider.PASSWORD_PROPERTY, "http.basic.password");
+ }
+ private static Map<String, String> configMap = new HashMap<String, String>();
+ static
+ {
+ // Remoting constants since 2.0.0.GA
+ //configMap.put(StubExt.PROPERTY_KEY_STORE, SSLSocketBuilder.REMOTING_KEY_STORE_FILE_PATH);
+ //configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD, SSLSocketBuilder.REMOTING_KEY_STORE_PASSWORD);
+ //configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE, SSLSocketBuilder.REMOTING_KEY_STORE_TYPE);
+ //configMap.put(StubExt.PROPERTY_TRUST_STORE, SSLSocketBuilder.REMOTING_TRUST_STORE_FILE_PATH);
+ //configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD, SSLSocketBuilder.REMOTING_TRUST_STORE_PASSWORD);
+ //configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE, SSLSocketBuilder.REMOTING_TRUST_STORE_TYPE);
+
+ configMap.put(StubExt.PROPERTY_KEY_STORE, "org.jboss.remoting.keyStore");
+ configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD, "org.jboss.remoting.keyStorePassword");
+ configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE, "org.jboss.remoting.keyStoreType");
+ configMap.put(StubExt.PROPERTY_TRUST_STORE, "org.jboss.remoting.trustStore");
+ configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD, "org.jboss.remoting.trustStorePassword");
+ configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE, "org.jboss.remoting.trustStoreType");
+ }
+
+ private boolean closed;
+
+ public RemotingConnectionImpl()
+ {
+ // HTTPClientInvoker conect sends gratuitous POST
+ // http://jira.jboss.com/jira/browse/JBWS-711
+ clientConfig.put(Client.ENABLE_LEASE, false);
+ }
+
+ public boolean isClosed()
+ {
+ return closed;
+ }
+
+ public void setClosed(boolean closed)
+ {
+ this.closed = closed;
+ }
+
+ /**
+ * Sends the given message to the specified endpoint.
+ *
+ * A null reqMessage signifies a HTTP GET request.
+ */
+ public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException
+ {
+ if (endpoint == null)
+ throw new IllegalArgumentException("Given endpoint cannot be null");
+
+ if (closed)
+ throw new WSException("Connection is already closed");
+
+ Object timeout = null;
+ String targetAddress;
+ Map<String, Object> callProps = new HashMap<String, Object>();
+
+ if (endpoint instanceof EndpointInfo)
+ {
+ EndpointInfo epInfo = (EndpointInfo)endpoint;
+ targetAddress = epInfo.getTargetAddress();
+ callProps = epInfo.getProperties();
+
+ if (callProps.containsKey(StubExt.PROPERTY_CLIENT_TIMEOUT))
+ {
+ timeout = callProps.get(StubExt.PROPERTY_CLIENT_TIMEOUT);
+ targetAddress = addURLParameter(targetAddress, "timeout", timeout.toString());
+ }
+
+ }
+ else if (endpoint instanceof EndpointReference)
+ {
+ EndpointReference epr = (EndpointReference)endpoint;
+ targetAddress = epr.getAddress().toString();
+ }
+ else
+ {
+ targetAddress = endpoint.toString();
+ }
+
+ // setup remoting client
+ Map<String, Object> metadata = createRemotingMetaData(reqMessage, callProps);
+ Client client = createRemotingClient(endpoint, targetAddress, oneway);
+
+ try
+ {
+ // debug the outgoing message
+ MessageTrace.traceMessage("Outgoing Request Message", reqMessage);
+
+ MessageAbstraction resMessage = null;
+ try
+ {
+ if (oneway == true)
+ {
+ client.invokeOneway(reqMessage, metadata, false);
+ }
+ else
+ {
+ resMessage = (MessageAbstraction)client.invoke(reqMessage, metadata);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ Throwable cause = rte.getCause();
+ if (timeout != null && cause instanceof SocketTimeoutException)
+ throw new WSTimeoutException("Timeout after: " + timeout + "ms", new Long(timeout.toString()));
+ else throw rte;
+ }
+
+ // Disconnect the remoting client
+ client.disconnect();
+
+ callProps.clear();
+ callProps.putAll(metadata);
+
+ // trace the incomming response message
+ MessageTrace.traceMessage("Incoming Response Message", resMessage);
+
+ return resMessage;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Throwable th)
+ {
+ IOException io = new IOException("Could not transmit message");
+ io.initCause(th);
+ throw io;
+ }
+ }
+
+ private String addURLParameter(String url, String key, String value)
+ {
+ int qmIndex = url.indexOf("?");
+ url += (qmIndex < 0 ? "?" : "&") + key + "=" + value;
+ return url;
+ }
+
+ private Client createRemotingClient(Object endpoint, String targetAddress, boolean oneway)
+ {
+ Client client;
+ try
+ {
+ // Get the invoker from Remoting for a given endpoint address
+ log.debug("Get locator for: " + endpoint);
+ targetAddress = addURLParameter(targetAddress, InvokerLocator.DATATYPE, "JBossWSMessage");
+ InvokerLocator locator = new InvokerLocator(targetAddress);
+
+ /* An HTTPClientInvoker may disconnect from the server and recreated by the remoting layer.
+ * In that case the new invoker does not inherit the marshaller/unmarshaller from the disconnected invoker.
+ * We therefore explicitly specify the invoker locator datatype and register the SOAP marshaller/unmarshaller
+ * with the MarshalFactory.
+ *
+ * This applies to remoting-1.4.5
+ */
+ Marshaller marshaller = getMarshaller();
+ UnMarshaller unmarshaller = getUnmarshaller();
+ MarshalFactory.addMarshaller("JBossWSMessage", marshaller, unmarshaller);
+
+ client = new Client(locator, "jbossws", clientConfig);
+ client.connect();
+
+ client.setMarshaller(marshaller);
+
+ if (oneway == false)
+ client.setUnMarshaller(unmarshaller);
+ }
+ catch (MalformedURLException e)
+ {
+ throw new IllegalArgumentException("Malformed endpoint address", e);
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Could not setup remoting client", e);
+ }
+ return client;
+ }
+
+ protected abstract UnMarshaller getUnmarshaller();
+
+ protected abstract Marshaller getMarshaller();
+
+ private Map<String, Object> createRemotingMetaData(MessageAbstraction reqMessage, Map callProps)
+ {
+
+ Map<String, Object> metadata = new HashMap<String, Object>();
+
+ // We need to unmarshall faults (HTTP 500)
+ // metadata.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true"); // since 2.0.0.GA
+ metadata.put("NoThrowOnError", "true");
+
+ if (reqMessage != null)
+ {
+ populateHeaders(reqMessage, metadata);
+ }
+ else
+ {
+ metadata.put("TYPE", "GET");
+ }
+
+ if (callProps != null)
+ {
+ Iterator it = callProps.entrySet().iterator();
+
+ // Get authentication type, default to BASIC authetication
+ String authType = (String)callProps.get(StubExt.PROPERTY_AUTH_TYPE);
+ if (authType == null)
+ authType = StubExt.PROPERTY_AUTH_TYPE_BASIC;
+
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+ String key = (String)entry.getKey();
+ Object val = entry.getValue();
+
+ // pass properties to remoting meta data
+ if (metadataMap.containsKey(key))
+ {
+ String remotingKey = metadataMap.get(key);
+ if ("http.basic.username".equals(remotingKey) || "http.basic.password".equals(remotingKey))
+ {
+ if (authType.equals(StubExt.PROPERTY_AUTH_TYPE_BASIC))
+ {
+ metadata.put(remotingKey, val);
+ }
+ else
+ {
+ log.warn("Ignore '" + key + "' with auth typy: " + authType);
+ }
+ }
+ else
+ {
+ metadata.put(remotingKey, val);
+ }
+ }
+
+ // pass properties to remoting client config
+ if (configMap.containsKey(key))
+ {
+ String remotingKey = configMap.get(key);
+ clientConfig.put(remotingKey, val);
+ }
+ }
+ }
+
+ return metadata;
+ }
+
+ protected void populateHeaders(MessageAbstraction reqMessage, Map<String, Object> metadata)
+ {
+ MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+
+ Properties props = new Properties();
+ metadata.put("HEADER", props);
+
+ Iterator i = mimeHeaders.getAllHeaders();
+ while (i.hasNext())
+ {
+ MimeHeader header = (MimeHeader)i.next();
+ String currentValue = props.getProperty(header.getName());
+
+ /*
+ * Coalesce multiple headers into one
+ *
+ * From HTTP/1.1 RFC 2616:
+ *
+ * Multiple message-header fields with the same field-name MAY be
+ * present in a message if and only if the entire field-value for that
+ * header field is defined as a comma-separated list [i.e., #(values)].
+ * It MUST be possible to combine the multiple header fields into one
+ * "field-name: field-value" pair, without changing the semantics of
+ * the message, by appending each subsequent field-value to the first,
+ * each separated by a comma.
+ */
+ if (currentValue != null)
+ {
+ props.put(header.getName(), currentValue + "," + header.getValue());
+ }
+ else
+ {
+ props.put(header.getName(), header.getValue());
+ }
+ }
+ }
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java (from rev 2753, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,120 @@
+/*
+ * 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.core.client;
+
+// $Id$
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.soap.SOAPMessageMarshaller;
+import org.jboss.ws.core.soap.SOAPMessageUnMarshaller;
+import org.jboss.ws.extensions.xop.XOPContext;
+
+/**
+ * SOAPConnection implementation
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason@stacksmash.com">Jason T. Greene</a>
+ *
+ * @since 02-Apr-2007
+ */
+public class SOAPRemotingConnection extends RemotingConnectionImpl
+{
+ protected UnMarshaller getUnmarshaller()
+ {
+ return new SOAPMessageUnMarshaller();
+ }
+
+ protected Marshaller getMarshaller()
+ {
+ return new SOAPMessageMarshaller();
+ }
+
+ public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException
+ {
+ try
+ {
+ // enforce xop transitions
+ // TODO: there should be a clear transition to an immutable object model
+ XOPContext.eagerlyCreateAttachments();
+
+ // save object model changes
+ SOAPMessage soapMessage = (SOAPMessage)reqMessage;
+ if (reqMessage != null && soapMessage.saveRequired())
+ soapMessage.saveChanges();
+
+ return super.invoke(reqMessage, endpoint, oneway);
+ }
+ catch (SOAPException ex)
+ {
+ IOException io = new IOException();
+ io.initCause(ex);
+ throw io;
+ }
+ }
+
+ protected void populateHeaders(MessageAbstraction reqMessage, Map<String, Object> metadata)
+ {
+ super.populateHeaders(reqMessage, metadata);
+
+ Properties props = (Properties)metadata.get("HEADER");
+
+ // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+ // with a quoted value equal to the value of the soapAction attribute of
+ // soapbind:operation, if present in the corresponding WSDL description.
+
+ // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+ // with a quoted empty string value, if in the corresponding WSDL description,
+ // the soapAction attribute of soapbind:operation is either not present, or
+ // present with an empty string as its value.
+
+ MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+ String[] action = mimeHeaders.getHeader("SOAPAction");
+ if (action != null && action.length > 0)
+ {
+ String soapAction = action[0];
+
+ // R1109 The value of the SOAPAction HTTP header field in a HTTP request MESSAGE MUST be a quoted string.
+ if (soapAction.startsWith("\"") == false || soapAction.endsWith("\"") == false)
+ soapAction = "\"" + soapAction + "\"";
+
+ props.put("SOAPAction", soapAction);
+ }
+ else
+ {
+ props.put("SOAPAction", "\"\"");
+ }
+
+ }
+}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -29,7 +29,6 @@
import org.jboss.ws.core.CommonSOAP11Binding;
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;
@@ -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: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -29,7 +29,6 @@
import org.jboss.ws.core.CommonSOAP12Binding;
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;
@@ -44,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);
@@ -58,7 +62,7 @@
{
return SOAPFaultHelperJAXRPC.exceptionToFaultMessage(ex);
}
-
+
@Override
public Set<String> getRoles()
{
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -48,6 +48,7 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.jaxrpc.binding.DeserializerFactoryBase;
import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
@@ -59,6 +60,7 @@
import org.jboss.ws.core.soap.NameImpl;
import org.jboss.ws.core.soap.SOAPEnvelopeImpl;
import org.jboss.ws.core.soap.SOAPFactoryImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.XMLFragment;
import org.jboss.ws.metadata.umdm.FaultMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -171,7 +173,7 @@
/** Translate the request exception into a SOAPFault message.
*/
- public static SOAPMessage exceptionToFaultMessage(Exception reqEx)
+ public static SOAPMessageImpl exceptionToFaultMessage(Exception reqEx)
{
// Get or create the SOAPFaultException
SOAPFaultException faultEx;
@@ -192,7 +194,7 @@
try
{
- SOAPMessage faultMessage = toSOAPMessage(faultEx);
+ SOAPMessageImpl faultMessage = toSOAPMessage(faultEx);
return faultMessage;
}
catch (RuntimeException rte)
@@ -206,7 +208,7 @@
}
}
- private static SOAPMessage toSOAPMessage(SOAPFaultException faultEx) throws SOAPException
+ private static SOAPMessageImpl toSOAPMessage(SOAPFaultException faultEx) throws SOAPException
{
assertFaultCode(faultEx.getFaultCode());
@@ -215,7 +217,7 @@
NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage soapMessage = factory.createMessage();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage();
SOAPEnvelopeImpl soapEnvelope = (SOAPEnvelopeImpl)soapMessage.getSOAPPart().getEnvelope();
SOAPBody soapBody = soapEnvelope.getBody();
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -284,7 +284,7 @@
if (log.isTraceEnabled())
{
- SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ SOAPPart soapPart = jaxrpcContext.getSOAPMessage().getSOAPPart();
lastMessageTrace = traceSOAPPart("BEFORE handleRequest - " + currHandler, soapPart, lastMessageTrace);
}
@@ -292,7 +292,7 @@
if (log.isTraceEnabled())
{
- SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ SOAPPart soapPart = jaxrpcContext.getSOAPMessage().getSOAPPart();
lastMessageTrace = traceSOAPPart("AFTER handleRequest - " + currHandler, soapPart, lastMessageTrace);
}
}
@@ -366,7 +366,7 @@
if (log.isTraceEnabled())
{
- SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ SOAPPart soapPart = jaxrpcContext.getSOAPMessage().getSOAPPart();
lastMessageTrace = traceSOAPPart("BEFORE handleResponse - " + currHandler, soapPart, lastMessageTrace);
}
@@ -374,7 +374,7 @@
if (log.isTraceEnabled())
{
- SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ SOAPPart soapPart = jaxrpcContext.getSOAPMessage().getSOAPPart();
lastMessageTrace = traceSOAPPart("AFTER handleResponse - " + currHandler, soapPart, lastMessageTrace);
}
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -74,7 +74,7 @@
public void setMessage(SOAPMessage message)
{
- setSOAPMessage(message);
+ setMessage(message);
}
/** Create the serialization context
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -36,6 +36,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.jaxrpc.binding.DeserializerFactoryBase;
@@ -46,6 +47,7 @@
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.NameImpl;
import org.jboss.ws.core.soap.SOAPFactoryImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.XMLFragment;
import org.jboss.ws.metadata.umdm.FaultMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -140,13 +142,13 @@
}
/** Translate the request exception into a SOAPFault message. */
- public static SOAPMessage exceptionToFaultMessage(Exception reqEx)
+ public static SOAPMessageImpl exceptionToFaultMessage(Exception reqEx)
{
log.error("SOAP request exception", reqEx);
try
{
- SOAPMessage faultMessage;
+ SOAPMessageImpl faultMessage;
if (reqEx instanceof SOAPFaultException)
{
faultMessage = toSOAPMessage((SOAPFaultException)reqEx);
@@ -171,10 +173,10 @@
}
}
- private static SOAPMessage toSOAPMessage(SOAPFaultException faultEx) throws SOAPException
+ private static SOAPMessageImpl toSOAPMessage(SOAPFaultException faultEx) throws SOAPException
{
MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage soapMessage = factory.createMessage();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage();
SOAPBody soapBody = soapMessage.getSOAPBody();
populateSOAPFault(soapBody, faultEx);
@@ -227,10 +229,10 @@
targetFault.setFaultActor(faultActor);
}
- private static SOAPMessage toSOAPMessage(Exception ex) throws SOAPException
+ private static SOAPMessageImpl toSOAPMessage(Exception ex) throws SOAPException
{
MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage soapMessage = factory.createMessage();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage();
SOAPBody soapBody = soapMessage.getSOAPBody();
SOAPFault soapFault;
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -32,7 +32,6 @@
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 +49,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 +63,23 @@
@Override
protected void initBinding(String bindingId, Type type)
{
- if (epMetaData != null && epMetaData.getServiceMode() == Mode.MESSAGE)
+ super.initBinding(bindingId, type);
+
+ if (HTTPBinding.HTTP_BINDING.equals(bindingId) == false)
{
- binding = new MessageBinding();
+ Mode serviceMode = (epMetaData != null ? epMetaData.getServiceMode() : null);
+ if (serviceMode == Mode.MESSAGE)
+ {
+ binding = new MessageBinding();
+ }
+ else if (serviceMode == 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: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -27,16 +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.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;
/**
@@ -47,33 +55,80 @@
*/
public class HTTPBindingJAXWS implements CommonBinding, BindingExt, HTTPBinding
{
+ // provide logging
+ private static final Logger log = Logger.getLogger(HTTPBindingJAXWS.class);
+
private BindingImpl delegate = new BindingImpl();
-
- public Object 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 Object 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, Object 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, Object 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();
}
- public Object bindFaultMessage(Exception ex)
+ public MessageAbstraction bindFaultMessage(Exception ex)
{
throw new NotImplementedException();
}
-
+
public List<Handler> getHandlerChain()
{
return delegate.getHandlerChain();
@@ -93,14 +148,25 @@
{
delegate.setHandlerChain(handlerChain, handlerType);
}
-
+
public String getBindingID()
{
- throw new NotImplementedException();
+ 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);
+ }
}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java (from rev 2753, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,80 @@
+/*
+ * 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.core.jaxws.binding;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.invocation.OnewayInvocation;
+import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.ws.core.HTTPMessageImpl;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.w3c.dom.Element;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Nov-2004
+ */
+public class HTTPMessageMarshaller implements Marshaller
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(HTTPMessageMarshaller.class);
+
+ /**
+ * Marshaller will need to take the dataObject and convert
+ * into primitive java data types and write to the
+ * given output.
+ *
+ * @param dataObject Object to be writen to output
+ * @param output The data output to write the object
+ * data to.
+ */
+ public void write(Object dataObject, OutputStream output) throws IOException
+ {
+ if (dataObject instanceof InvocationRequest)
+ dataObject = ((InvocationRequest)dataObject).getParameter();
+
+ if (dataObject instanceof OnewayInvocation)
+ dataObject = ((OnewayInvocation)dataObject).getParameters()[0];
+
+ if ((dataObject instanceof HTTPMessageImpl) == false)
+ throw new IllegalArgumentException("Not a HTTPMessage: " + dataObject);
+
+ HTTPMessageImpl httpMessage = (HTTPMessageImpl)dataObject;
+ Element root = httpMessage.getXmlFragment().toElement();
+
+ // debug the outgoing message
+ if (log.isTraceEnabled())
+ {
+ log.trace("Outgoing Message\n" + DOMWriter.printNode(root, true));
+ }
+
+ new DOMWriter(output).print(root);
+ }
+
+ public Marshaller cloneMarshaller() throws CloneNotSupportedException
+ {
+ return new HTTPMessageMarshaller();
+ }
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java (from rev 2753, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,114 @@
+/*
+ * 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.core.jaxws.binding;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.soap.MimeHeaders;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.transport.http.HTTPMetadataConstants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.HTTPMessageImpl;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Nov-2004
+ */
+public class HTTPMessageUnMarshaller implements UnMarshaller
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(HTTPMessageUnMarshaller.class);
+
+ private static List validResponseCodes = new ArrayList();
+ static
+ {
+ validResponseCodes.add(HttpServletResponse.SC_OK);
+ validResponseCodes.add(HttpServletResponse.SC_ACCEPTED);
+ validResponseCodes.add(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+
+ public Object read(InputStream inputStream, Map metadata) throws IOException, ClassNotFoundException
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("Read input stream with metadata=" + metadata);
+ }
+
+ Integer resCode = (Integer)metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
+ String resMessage = (String)metadata.get(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE);
+ if (resCode != null && validResponseCodes.contains(resCode) == false)
+ throw new WSException("Invalid HTTP server response [" + resCode + "] - " + resMessage);
+
+ MimeHeaders mimeHeaders = getMimeHeaders(metadata);
+ HTTPMessageImpl soapMsg = new HTTPMessageImpl(mimeHeaders, inputStream);
+ return soapMsg;
+ }
+
+ /**
+ * Set the class loader to use for unmarhsalling. This may
+ * be needed when need to have access to class definitions that
+ * are not part of this unmarshaller's parent classloader (especially
+ * when doing remote classloading).
+ *
+ * @param classloader
+ */
+ public void setClassLoader(ClassLoader classloader)
+ {
+ //NO OP
+ }
+
+ public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
+ {
+ return new HTTPMessageUnMarshaller();
+ }
+
+ private MimeHeaders getMimeHeaders(Map metadata)
+ {
+ log.debug("getMimeHeaders from: " + metadata);
+
+ MimeHeaders headers = new MimeHeaders();
+ Iterator i = metadata.keySet().iterator();
+ while (i.hasNext())
+ {
+ String key = (String)i.next();
+ Object value = metadata.get(key);
+ if (key != null && value instanceof List)
+ {
+ for (Object listValue : (List)value)
+ {
+ headers.addHeader(key, listValue.toString());
+ }
+ }
+ }
+ return headers;
+ }
+}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -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;
@@ -37,11 +36,12 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
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.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;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
@@ -61,16 +61,15 @@
private BindingImpl delegate = new BindingImpl();
/** On the client side, generate the payload from IN parameters. */
- public SOAPMessage 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();
}
/** On the server side, extract the IN parameters from the payload and populate an Invocation object */
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object reqMessage) throws BindingException
+ 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
@@ -94,10 +93,9 @@
}
/** On the server side, generate the payload from OUT parameters. */
- public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
+ 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();
@@ -105,8 +103,8 @@
throw new WSException("MessageContext not available");
// Associate current message with message context
- SOAPMessage resMessage = (SOAPMessage)epInv.getReturnValue();
- msgContext.setMessage(resMessage);
+ MessageAbstraction resMessage = (MessageAbstraction)epInv.getReturnValue();
+ msgContext.setMessageAbstraction(resMessage);
return resMessage;
}
@@ -118,15 +116,15 @@
}
/** On the client side, extract the OUT parameters from the payload and return them to the client. */
- public void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
throws BindingException
{
throw new NotImplementedException();
}
- public Object bindFaultMessage(Exception ex)
+ public MessageAbstraction bindFaultMessage(Exception ex)
{
- SOAPMessage faultMessage = SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
+ SOAPMessageImpl faultMessage = SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext != null)
{
@@ -159,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)
@@ -169,14 +177,4 @@
throw new BindingException(ex);
}
-
- public String getBindingID()
- {
- throw new NotImplementedException();
- }
-
- public void setHeaderSource(HeaderSource source)
- {
- // Not needed
- }
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -39,10 +39,10 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
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.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;
@@ -64,24 +64,24 @@
// Delegate to JAXWS binding
private BindingImpl delegate = new BindingImpl();
-
+
/** On the client side, generate the payload from IN parameters. */
- public Object 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();
}
/** On the server side, extract the IN parameters from the payload and populate an Invocation object */
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object payload) throws BindingException
+ 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");
@@ -91,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;
@@ -107,9 +107,10 @@
}
/** On the server side, generate the payload from OUT parameters. */
- public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
+ 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
{
@@ -121,7 +122,7 @@
MessageFactoryImpl factory = new MessageFactoryImpl();
factory.setEnvNamespace(Constants.NS_SOAP11_ENV);
SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage();
- msgContext.setMessage(resMessage);
+ msgContext.setSOAPMessage(resMessage);
Source payload = (Source)epInv.getReturnValue();
SOAPBodyImpl soapBody = (SOAPBodyImpl)resMessage.getSOAPBody();
@@ -137,15 +138,15 @@
}
/** On the client side, extract the OUT parameters from the payload and return them to the client. */
- public void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
throws BindingException
{
throw new NotImplementedException();
}
- public Object bindFaultMessage(Exception ex)
+ public MessageAbstraction bindFaultMessage(Exception ex)
{
- SOAPMessage faultMessage = SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
+ SOAPMessageImpl faultMessage = SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext != null)
{
@@ -172,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: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -27,18 +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.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -57,12 +51,11 @@
public SOAP11BindingJAXWS()
{
- super();
setMTOMEnabled(false);
}
- public SOAP11BindingJAXWS(boolean mtomEnabled) {
- super();
+ public SOAP11BindingJAXWS(boolean mtomEnabled)
+ {
setMTOMEnabled(mtomEnabled);
}
@@ -105,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);
@@ -118,6 +111,6 @@
public String getBindingID()
{
- throw new NotImplementedException();
+ return isMTOMEnabled() ? SOAPBinding.SOAP11HTTP_MTOM_BINDING : SOAPBinding.SOAP11HTTP_BINDING;
}
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -34,7 +34,9 @@
import javax.xml.ws.soap.SOAPBinding;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonSOAP12Binding;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -120,6 +122,6 @@
public String getBindingID()
{
- throw new NotImplementedException();
+ return isMTOMEnabled() ? SOAPBinding.SOAP12HTTP_MTOM_BINDING : SOAPBinding.SOAP12HTTP_BINDING;
}
}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java (from rev 2753, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.core.jaxws.client;
+
+// $Id$
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.HTTPMessageImpl;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.jaxrpc.binding.BufferedStreamResult;
+
+/**
+ * The Dispatch interface provides support for the dynamic invocation of a service endpoint operations.
+ * The javax.xml.ws.Service interface acts as a factory for the creation of Dispatch instances.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public class DispatchHTTPBinding
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(DispatchHTTPBinding.class);
+
+ private JAXBContext jaxbContext;
+ private Class type;
+ private Mode mode;
+
+ public DispatchHTTPBinding(Mode mode, Class type, JAXBContext jaxbContext)
+ {
+ this.mode = mode;
+ this.type = type;
+ this.jaxbContext = jaxbContext;
+ }
+
+ public MessageAbstraction getRequestMessage(Object obj)
+ {
+ HTTPMessageImpl reqMsg = null;
+ try
+ {
+ if (Source.class.isAssignableFrom(type))
+ {
+ Source source = (Source)obj;
+ reqMsg = new HTTPMessageImpl(source);
+ }
+ else if (jaxbContext != null)
+ {
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
+ BufferedStreamResult result = new BufferedStreamResult();
+ marshaller.marshal(obj, result);
+
+ reqMsg = new HTTPMessageImpl(result);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Cannot create request message", ex);
+ }
+
+ if (reqMsg == null)
+ throw new WebServiceException("Cannot create request message for: " + obj);
+
+ return reqMsg;
+ }
+
+ public Object getReturnObject(MessageAbstraction message)
+ {
+ HTTPMessageImpl resMsg = (HTTPMessageImpl)message;
+
+ Object retObj = null;
+ try
+ {
+ if (Source.class.isAssignableFrom(type))
+ {
+ retObj = resMsg.getXmlFragment().getSource();
+ }
+ else if (jaxbContext != null)
+ {
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ Source source = resMsg.getXmlFragment().getSource();
+ retObj = unmarshaller.unmarshal(source);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Cannot process response message", ex);
+ }
+ return retObj;
+ }
+}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -23,26 +23,14 @@
// $Id$
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
+import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
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.transform.stream.StreamSource;
import javax.xml.ws.AsyncHandler;
import javax.xml.ws.Binding;
import javax.xml.ws.BindingProvider;
@@ -51,14 +39,16 @@
import javax.xml.ws.Response;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.Service.Mode;
+import javax.xml.ws.http.HTTPBinding;
import javax.xml.ws.soap.SOAPFaultException;
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.client.HTTPRemotingConnection;
+import org.jboss.ws.core.client.RemotingConnection;
+import org.jboss.ws.core.client.SOAPRemotingConnection;
import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
-import org.jboss.ws.core.soap.SOAPBodyImpl;
-import org.jboss.ws.core.soap.SOAPConnectionImpl;
-import org.jboss.ws.core.utils.DOMWriter;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
/**
@@ -82,7 +72,7 @@
public DispatchImpl(ExecutorService executor, EndpointMetaData epMetaData, Class<T> type, Mode mode)
{
- this.bindingProvider = new BindingProviderImpl(epMetaData.getBindingId());
+ this.bindingProvider = new BindingProviderImpl(epMetaData);
this.epMetaData = epMetaData;
this.executor = executor;
this.type = type;
@@ -92,7 +82,7 @@
public DispatchImpl(ExecutorService executor, EndpointMetaData epMetaData, JAXBContext jbc, Mode mode)
{
- this.bindingProvider = new BindingProviderImpl(epMetaData.getBindingId());
+ this.bindingProvider = new BindingProviderImpl(epMetaData);
this.epMetaData = epMetaData;
this.executor = executor;
this.type = Object.class;
@@ -115,15 +105,33 @@
return retObj;
}
- private Object invokeInternal(Object obj, Map<String, Object> resContext) throws SOAPException
+ private Object invokeInternal(Object obj, Map<String, Object> resContext) throws IOException
{
- SOAPMessage reqMsg = getRequestMessage(obj);
+ MessageAbstraction reqMsg = getRequestMessage(obj);
String targetAddress = epMetaData.getEndpointAddress();
- SOAPMessage resMsg = new SOAPConnectionImpl().call(reqMsg, targetAddress);
+ MessageAbstraction resMsg = getRemotingConnection().invoke(reqMsg, targetAddress, false);
Object retObj = getReturnObject(resMsg);
return retObj;
}
+ private RemotingConnection getRemotingConnection()
+ {
+ String bindingID = bindingProvider.getBinding().getBindingID();
+ if (EndpointMetaData.SUPPORTED_BINDINGS.contains(bindingID) == false)
+ throw new IllegalStateException("Unsupported binding: " + bindingID);
+
+ RemotingConnection remotingConnection;
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
+ {
+ remotingConnection = new HTTPRemotingConnection();
+ }
+ else
+ {
+ remotingConnection = new SOAPRemotingConnection();
+ }
+ return remotingConnection;
+ }
+
public Response<T> invokeAsync(T msg)
{
ResponseImpl response = new ResponseImpl();
@@ -144,11 +152,11 @@
public void invokeOneWay(T msg)
{
- SOAPMessage reqMsg = getRequestMessage(msg);
+ MessageAbstraction reqMsg = getRequestMessage(msg);
try
{
String targetAddress = epMetaData.getEndpointAddress();
- new SOAPConnectionImpl().callOneWay(reqMsg, targetAddress);
+ getRemotingConnection().invoke(reqMsg, targetAddress, true);
}
catch (Exception ex)
{
@@ -169,7 +177,7 @@
{
throw (WebServiceException)ex;
}
-
+
String msg = "Cannot dispatch message";
log.error(msg, ex);
throw new WebServiceException(msg, ex);
@@ -210,107 +218,47 @@
}
}
- private SOAPMessage getRequestMessage(Object obj)
+ private MessageAbstraction getRequestMessage(Object obj)
{
// jaxws/api/javax_xml_ws/Dispatch/Client.java#invokeTestJAXBNull
if (obj == null)
throw new SOAPFaultException("Request object cannot be null");
-
- SOAPMessage reqMsg = null;
- try
- {
- MessageFactory factory = MessageFactory.newInstance();
- if (SOAPMessage.class.isAssignableFrom(type))
- {
- reqMsg = (SOAPMessage)obj;
- }
- else if (Source.class.isAssignableFrom(type))
- {
- Source source = (Source)obj;
- if (mode == Mode.PAYLOAD)
- {
- reqMsg = factory.createMessage();
- SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
- soapBody.setSource(source);
- }
- if (mode == Mode.MESSAGE)
- {
- TransformerFactory tf = TransformerFactory.newInstance();
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- tf.newTransformer().transform(source, new StreamResult(baos));
- reqMsg = factory.createMessage(null, new ByteArrayInputStream(baos.toByteArray()));
- }
- }
- else if (jaxbContext != null)
- {
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- marshaller.marshal(obj, baos);
- reqMsg = factory.createMessage();
- SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
- StreamSource source = new StreamSource(new ByteArrayInputStream(baos.toByteArray()));
- soapBody.setSource(source);
- }
- }
- catch (RuntimeException rte)
+ String bindingID = bindingProvider.getBinding().getBindingID();
+ if (EndpointMetaData.SUPPORTED_BINDINGS.contains(bindingID) == false)
+ throw new IllegalStateException("Unsupported binding: " + bindingID);
+
+ MessageAbstraction message;
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
{
- throw rte;
+ DispatchHTTPBinding helper = new DispatchHTTPBinding(mode, type, jaxbContext);
+ message = helper.getRequestMessage(obj);
}
- catch (Exception ex)
+ else
{
- throw new WebServiceException("Cannot create request message", ex);
+ DispatchSOAPBinding helper = new DispatchSOAPBinding(mode, type, jaxbContext);
+ message = helper.getRequestMessage(obj);
}
-
- if (reqMsg == null)
- throw new WebServiceException("Cannot create request message for: " + obj);
-
- return reqMsg;
+ return message;
}
- private Object getReturnObject(SOAPMessage resMsg)
+ private Object getReturnObject(MessageAbstraction resMsg)
{
+ String bindingID = bindingProvider.getBinding().getBindingID();
+ if (EndpointMetaData.SUPPORTED_BINDINGS.contains(bindingID) == false)
+ throw new IllegalStateException("Unsupported binding: " + bindingID);
+
Object retObj = null;
- try
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
{
- if (SOAPMessage.class.isAssignableFrom(type))
- {
- retObj = resMsg;
- }
- else if (Source.class.isAssignableFrom(type))
- {
- if (mode == Mode.PAYLOAD)
- {
- SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();
- SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
- retObj = new DOMSource(soapElement);
- }
- if (mode == Mode.MESSAGE)
- {
- SOAPEnvelope soapEnvelope = resMsg.getSOAPPart().getEnvelope();
- String xmlMessage = DOMWriter.printNode(soapEnvelope, false);
- retObj = new StreamSource(new StringReader(xmlMessage));
- }
- }
- else if (jaxbContext != null)
- {
- SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();
- SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
-
- if(log.isDebugEnabled()) log.debug("JAXB unmarshal: " + DOMWriter.printNode(soapElement, false));
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- retObj = unmarshaller.unmarshal(soapElement);
- }
+ DispatchHTTPBinding helper = new DispatchHTTPBinding(mode, type, jaxbContext);
+ retObj = helper.getReturnObject(resMsg);
}
- catch (RuntimeException rte)
+ else
{
- throw rte;
+ DispatchSOAPBinding helper = new DispatchSOAPBinding(mode, type, jaxbContext);
+ retObj = helper.getReturnObject(resMsg);
}
- catch (Exception ex)
- {
- throw new WebServiceException("Cannot process response message", ex);
- }
return retObj;
}
@@ -346,7 +294,7 @@
handler.handleResponse(response);
}
}
-
+
// 4.18 Conformance (Failed Dispatch.invokeAsync): When an operation is invoked using an invokeAsync
// method, an implementation MUST throw a WebServiceException if there is any error in the configuration
// of the Dispatch instance. Errors that occur during the invocation are reported when the client
@@ -355,7 +303,7 @@
{
String msg = "Cannot dispatch message";
log.error(msg, ex);
-
+
WebServiceException wsex;
if (ex instanceof WebServiceException)
{
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBinding.java (from rev 2753, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBinding.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBinding.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBinding.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,175 @@
+/*
+ * 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.core.jaxws.client;
+
+// $Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.StringReader;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPMessage;
+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.transform.stream.StreamSource;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.soap.SOAPBodyImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.utils.DOMWriter;
+
+/**
+ * A helper that
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Apr-2007
+ */
+public class DispatchSOAPBinding
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(DispatchSOAPBinding.class);
+
+ private JAXBContext jaxbContext;
+ private Class type;
+ private Mode mode;
+
+ public DispatchSOAPBinding(Mode mode, Class type, JAXBContext jaxbContext)
+ {
+ this.mode = mode;
+ this.type = type;
+ this.jaxbContext = jaxbContext;
+ }
+
+ public MessageAbstraction getRequestMessage(Object obj)
+ {
+ SOAPMessageImpl reqMsg = null;
+ try
+ {
+ MessageFactory factory = MessageFactory.newInstance();
+ if (SOAPMessage.class.isAssignableFrom(type))
+ {
+ reqMsg = (SOAPMessageImpl)obj;
+ }
+ else if (Source.class.isAssignableFrom(type))
+ {
+ Source source = (Source)obj;
+ if (mode == Mode.PAYLOAD)
+ {
+ reqMsg = (SOAPMessageImpl)factory.createMessage();
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
+ soapBody.setSource(source);
+ }
+ if (mode == Mode.MESSAGE)
+ {
+ TransformerFactory tf = TransformerFactory.newInstance();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ tf.newTransformer().transform(source, new StreamResult(baos));
+ reqMsg = (SOAPMessageImpl)factory.createMessage(null, new ByteArrayInputStream(baos.toByteArray()));
+ }
+ }
+ else if (jaxbContext != null)
+ {
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ marshaller.marshal(obj, baos);
+
+ reqMsg = (SOAPMessageImpl)factory.createMessage();
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
+ StreamSource source = new StreamSource(new ByteArrayInputStream(baos.toByteArray()));
+ soapBody.setSource(source);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Cannot create request message", ex);
+ }
+
+ if (reqMsg == null)
+ throw new WebServiceException("Cannot create request message for: " + obj);
+
+ return reqMsg;
+ }
+
+ public Object getReturnObject(MessageAbstraction message)
+ {
+ SOAPMessage resMsg = (SOAPMessage)message;
+
+ Object retObj = null;
+ try
+ {
+ if (SOAPMessage.class.isAssignableFrom(type))
+ {
+ retObj = resMsg;
+ }
+ else if (Source.class.isAssignableFrom(type))
+ {
+ if (mode == Mode.PAYLOAD)
+ {
+ SOAPBody soapBody = resMsg.getSOAPBody();
+ SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
+ retObj = new DOMSource(soapElement);
+ }
+ if (mode == Mode.MESSAGE)
+ {
+ SOAPEnvelope soapEnvelope = resMsg.getSOAPPart().getEnvelope();
+ String xmlMessage = DOMWriter.printNode(soapEnvelope, false);
+ retObj = new StreamSource(new StringReader(xmlMessage));
+ }
+ }
+ else if (jaxbContext != null)
+ {
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();
+ SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
+
+ log.debug("JAXB unmarshal: " + DOMWriter.printNode(soapElement, false));
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ retObj = unmarshaller.unmarshal(soapElement);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Cannot process response message", ex);
+ }
+ return retObj;
+ }
+}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageContextImpl.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageContextImpl.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageContextImpl.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -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.getMessage();
- 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: 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-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -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,148 @@
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);
}
}
- 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);
+ message.setModified(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: 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-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -37,7 +37,7 @@
import javax.xml.soap.SOAPBodyElement;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.http.HTTPBinding;
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
@@ -47,6 +47,7 @@
import org.jboss.ws.core.CommonSOAPBinding;
import org.jboss.ws.core.DirectionHolder;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.DirectionHolder.Direction;
import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
@@ -54,7 +55,6 @@
import org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS;
import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.SOAPBodyImpl;
import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.extensions.xop.XOPContext;
@@ -128,11 +128,11 @@
}
/** Invoke the the service endpoint */
- public SOAPMessage invoke(Object context) throws Exception
+ public MessageAbstraction invoke(Object context) throws Exception
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)msgContext.getEndpointMetaData();
- SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
+ MessageAbstraction reqMessage = msgContext.getMessageAbstraction();
// Load the endpoint implementation bean
Class seImpl = loadServiceEndpoint();
@@ -149,7 +149,7 @@
// Set the required inbound context properties
setInboundContextProperties();
-
+
try
{
boolean oneway = false;
@@ -196,10 +196,9 @@
try
{
// Check if protocol handlers modified the payload
- SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMessage.getSOAPBody();
- if (soapBody.isModifiedFromSource())
+ if (reqMessage.isModified())
{
- log.debug("Handler modified body payload, unbind message again");
+ log.debug("Handler modified payload, unbind message again");
epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
}
@@ -216,20 +215,20 @@
// Set the required outbound context properties
setOutboundContextProperties();
-
+
if (binding instanceof CommonSOAPBinding)
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)
@@ -243,7 +242,7 @@
faultType[0] = null;
}
- SOAPMessage resMessage = msgContext.getSOAPMessage();
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
return resMessage;
}
catch (RuntimeException ex)
@@ -320,39 +319,54 @@
return msgContext;
}
- private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData, SOAPMessageImpl reqMessage) throws SOAPException
+ private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData, MessageAbstraction reqMessage) throws SOAPException
{
- OperationMetaData opMetaData = reqMessage.getOperationMetaData(epMetaData);
- SOAPHeader soapHeader = reqMessage.getSOAPHeader();
+ OperationMetaData opMetaData;
- // Report a MustUnderstand fault
- if (opMetaData == null)
+ String bindingID = epMetaData.getBindingId();
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
{
- String faultString;
- SOAPBody soapBody = reqMessage.getSOAPBody();
- if (soapBody.getChildElements().hasNext())
+ if (epMetaData.getOperations().size() != 1)
+ throw new IllegalStateException("Multiple operations not supported for HTTP binding");
+
+ opMetaData = epMetaData.getOperations().get(0);
+ }
+ else
+ {
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)reqMessage;
+
+ opMetaData = soapMessage.getOperationMetaData(epMetaData);
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+
+ // Report a MustUnderstand fault
+ if (opMetaData == null)
{
- SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
- Name soapName = soapBodyElement.getElementName();
- faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for: " + soapName;
- }
- else
- {
- faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for empty soap body";
- }
+ String faultString;
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+ if (soapBody.getChildElements().hasNext())
+ {
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ Name soapName = soapBodyElement.getElementName();
+ faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for: " + soapName;
+ }
+ else
+ {
+ faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for empty soap body";
+ }
- // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL description, it SHOULD generate a soap:Fault
- // with a faultcode of "Client", unless a "MustUnderstand" or "VersionMismatch" fault is generated.
- if (soapHeader != null && soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
- throw new SOAPFaultException(faultCode, faultString, null, null);
+ // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL description, it SHOULD generate a soap:Fault
+ // with a faultcode of "Client", unless a "MustUnderstand" or "VersionMismatch" fault is generated.
+ if (soapHeader != null && soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+ else
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
}
- else
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
- throw new SOAPFaultException(faultCode, faultString, null, null);
- }
}
return opMetaData;
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -111,7 +111,7 @@
try
{
EndpointContext context = new EndpointContext(getServletContext(), req, res);
- epManager.processSOAPRequest(sepId, req.getInputStream(), res.getOutputStream(), context);
+ epManager.processRequest(sepId, req.getInputStream(), res.getOutputStream(), context);
}
catch (Exception ex)
{
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -30,22 +30,23 @@
import java.net.URL;
import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.soap.SOAPFaultException;
import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.http.HTTPBinding;
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.HTTPMessageImpl;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.MessageTrace;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
-import org.jboss.ws.core.soap.SOAPElementImpl;
-import org.jboss.ws.core.soap.SOAPElementWriter;
import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.utils.DOMWriter;
import org.jboss.ws.extensions.xop.XOPContext;
@@ -64,7 +65,6 @@
{
// provide logging
private static Logger log = Logger.getLogger(ServiceEndpoint.class);
- private static Logger msgLog = Logger.getLogger("jbossws.SOAPMessage");
/** Endpoint type enum */
public enum State
@@ -88,7 +88,7 @@
{
return seInfo.getState();
}
-
+
public ServiceEndpointInfo getServiceEndpointInfo()
{
return seInfo;
@@ -110,7 +110,7 @@
ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
UnifiedMetaData wsMetaData = epMetaData.getServiceMetaData().getUnifiedMetaData();
wsMetaData.eagerInitialize();
-
+
seMetrics.start();
seInfo.setState(State.STARTED);
}
@@ -119,7 +119,8 @@
{
seMetrics.stop();
seInfo.setState(State.STOPED);
- if(log.isDebugEnabled()) log.debug("Stop Endpoint" + seMetrics);
+ if (log.isDebugEnabled())
+ log.debug("Stop Endpoint" + seMetrics);
}
public void destroy()
@@ -143,7 +144,8 @@
{
wsdlHost = epManager.getWebServiceHost();
}
- if(log.isDebugEnabled()) log.debug("WSDL request, using host: " + wsdlHost);
+ if (log.isDebugEnabled())
+ log.debug("WSDL request, using host: " + wsdlHost);
WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(epMetaData);
Document document = wsdlRequestHandler.getDocumentForPath(reqURL, wsdlHost, resPath);
@@ -157,10 +159,10 @@
/**
* Handle a request to this web service endpoint
*/
- public SOAPMessage handleRequest(MimeHeaderSource headerSource, EndpointContext context, InputStream inputStream) throws BindingException
+ public MessageAbstraction processRequest(MimeHeaderSource headerSource, EndpointContext context, InputStream inputStream) throws BindingException
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
+ ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
long beginProcessing = 0;
ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
@@ -174,34 +176,40 @@
throw new SOAPFaultException(faultCode, faultString, null, null);
}
- if(log.isDebugEnabled()) log.debug("BEGIN handleRequest: " + seInfo.getServiceEndpointID());
+ log.debug("BEGIN handleRequest: " + seInfo.getServiceEndpointID());
beginProcessing = seMetrics.processRequestMessage();
- MessageFactoryImpl msgFactory = new MessageFactoryImpl();
- msgFactory.setServiceMode(epMetaData.getServiceMode());
- msgFactory.setStyle(epMetaData.getStyle());
-
MimeHeaders headers = (headerSource != null ? headerSource.getMimeHeaders() : null);
- SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers, inputStream);
+ MessageAbstraction reqMessage;
+
+ String bindingID = sepMetaData.getBindingId();
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
+ {
+ reqMessage = new HTTPMessageImpl(headers, inputStream);
+ }
+ else
+ {
+ MessageFactoryImpl msgFactory = new MessageFactoryImpl();
+ msgFactory.setServiceMode(sepMetaData.getServiceMode());
+ msgFactory.setStyle(sepMetaData.getStyle());
+
+ reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers, inputStream);
+ }
+
// Associate current message with message context
- msgContext.setSOAPMessage(reqMessage);
+ msgContext.setMessageAbstraction(reqMessage);
// debug the incomming message
- if (msgLog.isTraceEnabled())
- {
- SOAPEnvelope soapEnv = reqMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, true);
- msgLog.trace("Incoming SOAPMessage\n" + envStr);
- }
+ MessageTrace.traceMessage("Incoming Request Message", reqMessage);
// Set the thread context class loader
- ClassLoader classLoader = epMetaData.getClassLoader();
+ ClassLoader classLoader = sepMetaData.getClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
// Invoke the service endpoint
ServiceEndpointInvoker seInvoker = seInfo.getInvoker();
- SOAPMessage resMessage = seInvoker.invoke(context);
+ MessageAbstraction resMessage = seInvoker.invoke(context);
if (resMessage != null)
postProcessResponse(headerSource, resMessage);
@@ -210,15 +218,15 @@
}
catch (Exception ex)
{
- SOAPMessage resMessage = msgContext.getSOAPMessage();
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
// In case we have an exception before the invoker is called
// we create the fault message here.
- if (resMessage == null || ((SOAPMessageImpl)resMessage).isFaultMessage() == false)
+ if (resMessage == null || resMessage.isFaultMessage() == false)
{
CommonBindingProvider bindingProvider = getCommonBindingProvider();
CommonBinding binding = bindingProvider.getCommonBinding();
- resMessage = (SOAPMessage)binding.bindFaultMessage(ex);
+ resMessage = binding.bindFaultMessage(ex);
}
if (resMessage != null)
@@ -230,10 +238,10 @@
{
try
{
- SOAPMessage soapMessage = msgContext.getSOAPMessage();
- if (soapMessage != null && soapMessage.getSOAPPart().getEnvelope() != null)
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ if (resMessage != null)
{
- if (soapMessage.getSOAPPart().getEnvelope().getBody().hasFault())
+ if (resMessage.isFaultMessage())
{
seMetrics.processFaultMessage(beginProcessing);
}
@@ -250,39 +258,31 @@
// Reset the thread context class loader
Thread.currentThread().setContextClassLoader(ctxClassLoader);
- if(log.isDebugEnabled()) log.debug("END handleRequest: " + seInfo.getServiceEndpointID());
+ if (log.isDebugEnabled())
+ log.debug("END handleRequest: " + seInfo.getServiceEndpointID());
}
}
/** Set response mime headers
*/
- private void postProcessResponse(MimeHeaderSource headerSource, SOAPMessage resMessage)
+ private void postProcessResponse(MimeHeaderSource headerSource, MessageAbstraction resMessage)
{
try
{
// Set the outbound headers
- if (headerSource != null)
+ if (headerSource != null && resMessage instanceof SOAPMessage)
{
XOPContext.eagerlyCreateAttachments();
- resMessage.saveChanges();
+ ((SOAPMessage)resMessage).saveChanges();
headerSource.setMimeHeaders(resMessage.getMimeHeaders());
}
// debug the outgoing message
- if (msgLog.isTraceEnabled())
- {
- resMessage.saveChanges();
- SOAPEnvelope soapEnv = resMessage.getSOAPPart().getEnvelope();
- if (soapEnv != null)
- {
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, true);
- msgLog.trace("Outgoing SOAPMessage\n" + envStr);
- }
- }
+ MessageTrace.traceMessage("Outgoing Response Message", resMessage);
}
catch (Exception ex)
{
- throw new JAXRPCException("Failed to post process response message", ex);
+ WSException.rethrow("Faild to post process response message", ex);
}
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -23,7 +23,7 @@
// $Id$
-import javax.xml.soap.SOAPMessage;
+import org.jboss.ws.core.MessageAbstraction;
/** An implementation handles invocations on the endpoint
*
@@ -36,5 +36,5 @@
void init(ServiceEndpointInfo seInfo);
/** Invoke the the service endpoint */
- SOAPMessage invoke(Object endpointContext) throws Exception;
+ MessageAbstraction invoke(Object endpointContext) throws Exception;
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -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: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -59,6 +59,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
@@ -397,7 +398,7 @@
wsEndpoint.handleWSDLRequest(outStream, requestURL, resourcePath);
}
- public void processSOAPRequest(ObjectName sepID, InputStream inStream, OutputStream outStream, EndpointContext context) throws Exception
+ public void processRequest(ObjectName sepID, InputStream inStream, OutputStream outStream, EndpointContext context) throws Exception
{
final String SESSION_COOKIES = "org.jboss.ws.cookies";
@@ -444,9 +445,9 @@
MessageContextAssociation.pushMessageContext(msgContext);
try
{
- SOAPMessage resMessage = wsEndpoint.handleRequest(headerSource, context, inStream);
+ MessageAbstraction resMessage = wsEndpoint.processRequest(headerSource, context, inStream);
- // REplace the message context with the response context
+ // Replace the message context with the response context
msgContext = MessageContextAssociation.peekMessageContext();
Map<String, List<String>> headers = (Map<String, List<String>>)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_HEADERS);
@@ -457,20 +458,24 @@
if (code != null)
httpResponse.setStatus(code.intValue());
- SOAPPart part = resMessage.getSOAPPart();
- if (part == null)
- throw new SOAPException("Cannot obtain SOAPPart from response message");
+ boolean isFault = false;
+ if (resMessage instanceof SOAPMessage)
+ {
+ SOAPPart part = ((SOAPMessage)resMessage).getSOAPPart();
+ if (part == null)
+ throw new SOAPException("Cannot obtain SOAPPart from response message");
- // R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP status code
- // if the response envelope is a Fault.
- //
- // Also, a one-way operation must show up as empty content, and can be detected
- // by a null envelope.
- SOAPEnvelope soapEnv = part.getEnvelope();
- boolean isFault = soapEnv != null && soapEnv.getBody().hasFault();
- if (isFault && httpResponse != null)
- {
- httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ // R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP status code
+ // if the response envelope is a Fault.
+ //
+ // Also, a one-way operation must show up as empty content, and can be detected
+ // by a null envelope.
+ SOAPEnvelope soapEnv = part.getEnvelope();
+ isFault = soapEnv != null && soapEnv.getBody().hasFault();
+ if (isFault && httpResponse != null)
+ {
+ httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
}
sendResponse(outStream, msgContext, isFault);
@@ -490,7 +495,7 @@
private void sendResponse(OutputStream outputStream, CommonMessageContext msgContext, boolean isFault) throws SOAPException, IOException
{
- SOAPMessage resMessage = msgContext.getSOAPMessage();
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
String wsaTo = null;
// Get the destination from the AddressingProperties
@@ -505,7 +510,7 @@
if (wsaTo != null)
{
log.debug("Sending response to addressing destination: " + wsaTo);
- new SOAPConnectionImpl().callOneWay(resMessage, wsaTo);
+ new SOAPConnectionImpl().callOneWay((SOAPMessage)resMessage, wsaTo);
}
else
{
@@ -515,14 +520,14 @@
/** Process the given SOAPRequest and return the corresponding SOAPResponse
*/
- public String processSOAPRequest(ObjectName sepID, String inMessage) throws Exception
+ public String processRequest(ObjectName sepID, String inMessage) throws Exception
{
log.debug("processSOAPRequest: " + sepID);
ByteArrayInputStream inputStream = new ByteArrayInputStream(inMessage.getBytes("UTF-8"));
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(512);
- processSOAPRequest(sepID, inputStream, outputStream, null);
+ processRequest(sepID, inputStream, outputStream, null);
String outMsg = new String(outputStream.toByteArray());
return outMsg;
Deleted: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/EndpointInfo.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/EndpointInfo.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/EndpointInfo.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -1,100 +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.core.soap;
-
-// $Id$
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-
-/** A wrapper object that associates the target address with some metadata
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 20-Jul-2005
- */
-public class EndpointInfo
-{
- private String targetAddress;
- private Map<String, Object> properties;
- public EndpointInfo(EndpointMetaData epMetaData, String targetAddress, Map<String, Object> callProps)
- {
- this.targetAddress = targetAddress;
- this.properties = callProps;
-
- // Add the service properties
- Properties serviceProps = epMetaData.getServiceMetaData().getProperties();
- if (serviceProps != null)
- {
- Iterator it = serviceProps.entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- Object val = entry.getValue();
- properties.put(key, val);
- }
- }
-
- // Add the endpoint properties
- Properties epProps = epMetaData.getProperties();
- Iterator it = epProps.entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- Object val = entry.getValue();
- properties.put(key, val);
- }
-
- }
-
- public Map<String, Object> getProperties()
- {
- return properties;
- }
-
- public String getTargetAddress()
- {
- return targetAddress;
- }
-
- public boolean equals(Object obj)
- {
- if (!(obj instanceof EndpointInfo))
- return false;
- return toString().equals(obj.toString());
- }
-
- public int hashCode()
- {
- return toString().hashCode();
- }
-
- public String toString()
- {
- return "[addr=" + targetAddress + ",props=" + properties + "]";
- }
-}
\ No newline at end of file
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPBodyImpl.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPBodyImpl.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPBodyImpl.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -68,7 +68,6 @@
// Generic JAXWS payload
private XMLFragment xmlFragment;
private boolean isDOMValid = true;
- private boolean isModifiedFromSource;
public SOAPBodyImpl(String prefix, String namespace)
{
@@ -80,16 +79,6 @@
return isDOMValid;
}
- public boolean isModifiedFromSource()
- {
- return isModifiedFromSource;
- }
-
- public void setModifiedFromSource(boolean isModified)
- {
- this.isModifiedFromSource = isModified;
- }
-
public Source getSource()
{
Source source;
@@ -372,7 +361,8 @@
}
finally
{
- isModifiedFromSource = true;
+ // Mark the message as modified
+
log.trace("END expandToDOM");
}
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -60,6 +60,7 @@
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPException;
+
/**
* SOAP Connection Factory implementation
*
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -24,30 +24,15 @@
// $Id$
import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.SocketTimeoutException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import javax.xml.rpc.Stub;
-import javax.xml.soap.MimeHeader;
-import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPConnection;
-import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.addressing.EndpointReference;
import org.jboss.logging.Logger;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.marshal.MarshalFactory;
-import org.jboss.ws.core.StubExt;
-import org.jboss.ws.core.WSTimeoutException;
-import org.jboss.ws.extensions.xop.XOPContext;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.client.RemotingConnectionImpl;
+import org.jboss.ws.core.client.SOAPRemotingConnection;
/**
* SOAPConnection implementation
@@ -61,44 +46,12 @@
{
// provide logging
private static Logger log = Logger.getLogger(SOAPConnectionImpl.class);
- private static Logger msgLog = Logger.getLogger("jbossws.SOAPMessage");
- private Map<String, Object> config = new HashMap<String, Object>();
+ private RemotingConnectionImpl remotingConnection;
- private static Map<String, String> metadataMap = new HashMap<String, String>();
- static
- {
- metadataMap.put(Stub.USERNAME_PROPERTY, "http.basic.username");
- metadataMap.put(Stub.PASSWORD_PROPERTY, "http.basic.password");
- metadataMap.put(BindingProvider.USERNAME_PROPERTY, "http.basic.username");
- metadataMap.put(BindingProvider.PASSWORD_PROPERTY, "http.basic.password");
- }
- private static Map<String, String> configMap = new HashMap<String, String>();
- static
- {
- // Remoting constants since 2.0.0.GA
- //configMap.put(StubExt.PROPERTY_KEY_STORE, SSLSocketBuilder.REMOTING_KEY_STORE_FILE_PATH);
- //configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD, SSLSocketBuilder.REMOTING_KEY_STORE_PASSWORD);
- //configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE, SSLSocketBuilder.REMOTING_KEY_STORE_TYPE);
- //configMap.put(StubExt.PROPERTY_TRUST_STORE, SSLSocketBuilder.REMOTING_TRUST_STORE_FILE_PATH);
- //configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD, SSLSocketBuilder.REMOTING_TRUST_STORE_PASSWORD);
- //configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE, SSLSocketBuilder.REMOTING_TRUST_STORE_TYPE);
-
- configMap.put(StubExt.PROPERTY_KEY_STORE, "org.jboss.remoting.keyStore");
- configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD, "org.jboss.remoting.keyStorePassword");
- configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE, "org.jboss.remoting.keyStoreType");
- configMap.put(StubExt.PROPERTY_TRUST_STORE, "org.jboss.remoting.trustStore");
- configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD, "org.jboss.remoting.trustStorePassword");
- configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE, "org.jboss.remoting.trustStoreType");
- }
-
- private boolean closed;
-
public SOAPConnectionImpl()
{
- // HTTPClientInvoker conect sends gratuitous POST
- // http://jira.jboss.com/jira/browse/JBWS-711
- config.put(Client.ENABLE_LEASE, false);
+ remotingConnection = new SOAPRemotingConnection();
}
/**
@@ -109,7 +62,9 @@
{
if (reqMessage == null)
throw new IllegalArgumentException("Given SOAPMessage cannot be null");
- return callInternal(reqMessage, endpoint, false);
+
+ MessageAbstraction resMessage = callInternal(reqMessage, endpoint, false);
+ return (SOAPMessage)resMessage;
}
/**
@@ -117,9 +72,10 @@
*/
public SOAPMessage get(Object endpoint) throws SOAPException
{
- return callInternal(null, endpoint, false);
+ MessageAbstraction resMessage = callInternal(null, endpoint, false);
+ return (SOAPMessage)resMessage;
}
-
+
/**
* Sends the given message to the specified endpoint. This method is logically
* non blocking.
@@ -128,299 +84,39 @@
{
if (reqMessage == null)
throw new IllegalArgumentException("Given SOAPMessage cannot be null");
- return callInternal(reqMessage, endpoint, true);
- }
- /**
- * Sends the given message to the specified endpoint.
- *
- * A null reqMessage signifies a HTTP GET request.
- */
- private SOAPMessage callInternal(SOAPMessage reqMessage, Object endpoint, boolean oneway) throws SOAPException
- {
- if (endpoint == null)
- throw new IllegalArgumentException("Given endpoint cannot be null");
-
- if (closed)
- throw new SOAPException("SOAPConnection is already closed");
-
- Object timeout = null;
- String targetAddress;
- Map<String, Object> callProps = new HashMap<String,Object>();
-
- if (endpoint instanceof EndpointInfo)
- {
- EndpointInfo epInfo = (EndpointInfo)endpoint;
- targetAddress = epInfo.getTargetAddress();
- callProps = epInfo.getProperties();
-
- if (callProps.containsKey(StubExt.PROPERTY_CLIENT_TIMEOUT))
- {
- timeout = callProps.get(StubExt.PROPERTY_CLIENT_TIMEOUT);
- targetAddress = addURLParameter(targetAddress, "timeout", timeout.toString());
- }
-
-
- }
- else if (endpoint instanceof EndpointReference)
- {
- EndpointReference epr = (EndpointReference)endpoint;
- targetAddress = epr.getAddress().toString();
- }
- else
- {
- targetAddress = endpoint.toString();
- }
-
- // enforce xop transitions
- // TODO: there should be a clear transition to an immutable object model
- XOPContext.eagerlyCreateAttachments();
-
- // save object model changes
- if (reqMessage != null && reqMessage.saveRequired())
- reqMessage.saveChanges();
-
- // setup remoting client
- Map<String, Object> metadata = createRemotingMetaData(reqMessage, callProps);
- Client client = createRemotingClient(endpoint, targetAddress, oneway);
-
- try
- {
- // debug the outgoing message
- if (reqMessage != null && msgLog.isTraceEnabled())
- {
- SOAPEnvelope soapReqEnv = reqMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapReqEnv, true);
- msgLog.trace("Remoting meta data: " + metadata);
- msgLog.trace("Outgoing SOAPMessage\n" + envStr);
- }
-
- SOAPMessage resMessage = null;
- try
- {
- if (oneway == true)
- {
- client.invokeOneway(reqMessage, metadata, false);
- }
- else
- {
- resMessage = (SOAPMessage)client.invoke(reqMessage, metadata);
- }
- }
- catch (RuntimeException rte)
- {
- Throwable cause = rte.getCause();
- // The CTS expects only SOAPException to be thrown.
- if (cause instanceof IOException && cause.getCause() instanceof SOAPException)
- throw cause.getCause();
- else if (timeout != null && cause instanceof SocketTimeoutException)
- throw new WSTimeoutException("Timeout after: " + timeout + "ms", new Long(timeout.toString()));
- else throw rte;
- }
-
- // Disconnect the remoting client
- client.disconnect();
-
- callProps.clear();
- callProps.putAll(metadata);
-
- // debug the incomming response message
- if (resMessage != null && msgLog.isTraceEnabled())
- {
- SOAPEnvelope soapResEnv = resMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapResEnv, true);
- msgLog.trace("Incoming Response SOAPMessage\n" + envStr);
- }
-
- return resMessage;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Throwable t)
- {
- throw new SOAPException("Could not transmit message", t);
- }
+ MessageAbstraction resMessage = callInternal((SOAPMessageImpl)reqMessage, endpoint, true);
+ return (SOAPMessage)resMessage;
}
- private String addURLParameter(String url, String key, String value)
- {
- int qmIndex = url.indexOf("?");
- url += (qmIndex < 0 ? "?" : "&") + key + "=" + value;
- return url;
- }
-
/** Closes this SOAPConnection
*/
public void close() throws SOAPException
{
- if (closed)
+ if (remotingConnection.isClosed())
throw new SOAPException("SOAPConnection is already closed");
- closed = true;
+ remotingConnection.setClosed(true);
}
- private Client createRemotingClient(Object endpoint, String targetAddress, boolean oneway) throws SOAPException
+ private MessageAbstraction callInternal(SOAPMessage reqMessage, Object endpoint, boolean oneway) throws SOAPException
{
- Client client;
try
{
- // Get the invoker from Remoting for a given endpoint address
- if(log.isDebugEnabled()) log.debug("Get locator for: " + endpoint);
- targetAddress = addURLParameter(targetAddress, InvokerLocator.DATATYPE, "SOAPMessage");
- InvokerLocator locator = new InvokerLocator(targetAddress);
-
- /* An HTTPClientInvoker may disconnect from the server and recreated by the remoting layer.
- * In that case the new invoker does not inherit the marshaller/unmarshaller from the disconnected invoker.
- * We therefore explicitly specify the invoker locator datatype and register the SOAP marshaller/unmarshaller
- * with the MarshalFactory.
- *
- * This applies to remoting-1.4.5
- */
- SOAPMessageMarshaller marshaller = new SOAPMessageMarshaller();
- SOAPMessageUnMarshaller unmarshaller = new SOAPMessageUnMarshaller();
- MarshalFactory.addMarshaller("SOAPMessage", marshaller, unmarshaller);
-
- client = new Client(locator, "saaj", config);
- client.connect();
-
- client.setMarshaller(marshaller);
-
- if (oneway == false)
- client.setUnMarshaller(unmarshaller);
+ MessageAbstraction resMessage = remotingConnection.invoke((SOAPMessageImpl)reqMessage, endpoint, oneway);
+ return resMessage;
}
- catch (MalformedURLException e)
+ catch (RuntimeException rte)
{
- throw new SOAPException("Malformed endpoint address", e);
+ throw rte;
}
- catch (Exception e)
+ catch (Exception ex)
{
- throw new SOAPException("Could not setup remoting client", e);
- }
- return client;
- }
+ Throwable cause = ex.getCause();
+ if (cause instanceof SOAPException)
+ throw (SOAPException)cause;
- private Map<String, Object> createRemotingMetaData(SOAPMessage reqMessage, Map callProps) throws SOAPException
- {
-
- Map<String, Object> metadata = new HashMap<String, Object>();
-
- // We need to unmarshall faults (HTTP 500)
- // metadata.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true"); // since 2.0.0.GA
- metadata.put("NoThrowOnError", "true");
-
- if (reqMessage != null)
- populateHeaders(reqMessage, metadata);
- else
- metadata.put("TYPE", "GET");
-
- if (callProps != null)
- {
- Iterator it = callProps.entrySet().iterator();
-
- // Get authentication type, default to BASIC authetication
- String authType = (String)callProps.get(StubExt.PROPERTY_AUTH_TYPE);
- if (authType == null)
- authType = StubExt.PROPERTY_AUTH_TYPE_BASIC;
-
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- Object val = entry.getValue();
-
- // pass properties to remoting meta data
- if (metadataMap.containsKey(key))
- {
- String remotingKey = metadataMap.get(key);
- if ("http.basic.username".equals(remotingKey) || "http.basic.password".equals(remotingKey))
- {
- if (authType.equals(StubExt.PROPERTY_AUTH_TYPE_BASIC))
- {
- metadata.put(remotingKey, val);
- }
- else
- {
- log.warn("Ignore '" + key + "' with auth typy: " + authType);
- }
- }
- else
- {
- metadata.put(remotingKey, val);
- }
- }
-
- // pass properties to remoting client config
- if (configMap.containsKey(key))
- {
- String remotingKey = configMap.get(key);
- config.put(remotingKey, val);
- }
- }
+ throw new SOAPException(ex);
}
-
- return metadata;
}
-
- private void populateHeaders(SOAPMessage reqMessage, Map<String, Object> metadata)
- {
- // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
- // with a quoted value equal to the value of the soapAction attribute of
- // soapbind:operation, if present in the corresponding WSDL description.
-
- // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
- // with a quoted empty string value, if in the corresponding WSDL description,
- // the soapAction attribute of soapbind:operation is either not present, or
- // present with an empty string as its value.
-
- MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
- String[] action = mimeHeaders.getHeader("SOAPAction");
- if (action != null && action.length > 0)
- {
- String soapAction = action[0];
-
- // R1109 The value of the SOAPAction HTTP header field in a HTTP request MESSAGE MUST be a quoted string.
- if (soapAction.startsWith("\"") == false || soapAction.endsWith("\"") == false)
- soapAction = "\"" + soapAction + "\"";
-
- mimeHeaders.setHeader("SOAPAction", soapAction);
- }
- else
- {
- mimeHeaders.setHeader("SOAPAction", "\"\"");
- }
-
- Properties props = new Properties();
- metadata.put("HEADER", props);
-
- Iterator i = mimeHeaders.getAllHeaders();
- while (i.hasNext())
- {
- MimeHeader header = (MimeHeader)i.next();
- String currentValue = props.getProperty(header.getName());
-
- /*
- * Coalesce multiple headers into one
- *
- * From HTTP/1.1 RFC 2616:
- *
- * Multiple message-header fields with the same field-name MAY be
- * present in a message if and only if the entire field-value for that
- * header field is defined as a comma-separated list [i.e., #(values)].
- * It MUST be possible to combine the multiple header fields into one
- * "field-name: field-value" pair, without changing the semantics of
- * the message, by appending each subsequent field-value to the first,
- * each separated by a comma.
- */
- if (currentValue != null)
- {
- props.put(header.getName(), currentValue + "," + header.getValue());
- }
- else
- {
- props.put(header.getName(), header.getValue());
- }
- }
- }
}
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-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -42,6 +42,7 @@
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;
@@ -59,7 +60,7 @@
* @author Thomas.Diesler(a)jboss.org
* @author <a href="mailto:jason@stacksmash.com">Jason T. Greene</a>
*/
-public class SOAPMessageImpl extends SOAPMessage
+public class SOAPMessageImpl extends SOAPMessage implements SOAPMessageAbstraction
{
private boolean saveRequired = true;
private MimeHeaders mimeHeaders = new MimeHeaders();
@@ -68,6 +69,7 @@
private boolean isXOPMessage;
private boolean isSWARefMessage;
private SOAPPartImpl soapPart;
+ private boolean modified;
private MultipartRelatedEncoder multipartRelatedEncoder;
// Cache the associated operation meta data
@@ -251,7 +253,6 @@
}
mimeHeaders.setHeader(MimeConstants.CONTENT_TYPE, contentType);
-
}
catch (MessagingException ex)
{
@@ -278,27 +279,34 @@
return saveRequired;
}
- public void writeTo(OutputStream outs) throws SOAPException, IOException
+ public void writeTo(OutputStream outs) throws IOException
{
- // Save all changes
- saveChanges();
+ try
+ {
+ // Save all changes
+ saveChanges();
- // If there are attachments then we delegate encoding to MultipartRelatedEncoder
- if (attachments.size() > 0)
- {
- multipartRelatedEncoder.writeTo(outs);
- }
- else
- {
- SOAPEnvelope soapEnv = getSOAPPart().getEnvelope();
- if (soapEnv != null)
+ // If there are attachments then we delegate encoding to MultipartRelatedEncoder
+ if (attachments.size() > 0)
{
- boolean writeXML = isWriteXMLDeclaration();
- String charsetEncoding = getCharSetEncoding();
- SOAPElementWriter writer = new SOAPElementWriter(outs, charsetEncoding);
- writer.setWriteXMLDeclaration(writeXML).writeElement((SOAPEnvelopeImpl)soapEnv);
+ multipartRelatedEncoder.writeTo(outs);
}
+ else
+ {
+ SOAPEnvelope soapEnv = getSOAPPart().getEnvelope();
+ if (soapEnv != null)
+ {
+ boolean writeXML = isWriteXMLDeclaration();
+ String charsetEncoding = getCharSetEncoding();
+ SOAPElementWriter writer = new SOAPElementWriter(outs, charsetEncoding);
+ writer.setWriteXMLDeclaration(writeXML).writeElement((SOAPEnvelopeImpl)soapEnv);
+ }
+ }
}
+ catch (SOAPException ex)
+ {
+ WSException.rethrow(ex);
+ }
}
private String getCharSetEncoding() throws SOAPException
@@ -498,4 +506,14 @@
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/core/soap/SOAPMessageMarshaller.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -1,30 +1,29 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * 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.core.soap;
import java.io.IOException;
import java.io.OutputStream;
-import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
@@ -32,6 +31,7 @@
import org.jboss.remoting.InvocationRequest;
import org.jboss.remoting.invocation.OnewayInvocation;
import org.jboss.remoting.marshal.Marshaller;
+
/**
* @author Thomas.Diesler(a)jboss.org
* @since 25-Nov-2004
@@ -61,25 +61,8 @@
if ((dataObject instanceof SOAPMessage) == false)
throw new IllegalArgumentException("Not a SOAPMessage: " + dataObject);
- try
- {
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)dataObject;
-
- // debug the outgoing message
- if (log.isTraceEnabled())
- {
- SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, true);
- log.trace("Outgoing SOAPMessage\n" + envStr);
- }
-
- soapMessage.writeTo(output);
- }
- catch (SOAPException e)
- {
- log.error("Cannot marshall SOAPMessage", e);
- throw new IOException(e.toString());
- }
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)dataObject;
+ soapMessage.writeTo(output);
}
public Marshaller cloneMarshaller() throws CloneNotSupportedException
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/utils/DOMUtils.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/utils/DOMUtils.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/utils/DOMUtils.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -37,7 +37,9 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
@@ -570,7 +572,10 @@
TransformerFactory tf = TransformerFactory.newInstance();
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- tf.newTransformer().transform(source, new StreamResult(baos));
+ Transformer transformer = tf.newTransformer();
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+ transformer.transform(source, new StreamResult(baos));
retElement = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));
}
else
Modified: trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -113,8 +113,7 @@
{
if (wsClass.isAnnotationPresent(BindingType.class))
{
- if (log.isDebugEnabled())
- log.debug("processBindingType on: " + wsClass.getName());
+ log.debug("processBindingType on: " + wsClass.getName());
BindingType anBindingType = (BindingType)wsClass.getAnnotation(BindingType.class);
epMetaData.setBindingId(anBindingType.value());
}
@@ -124,8 +123,7 @@
{
if (wsClass.isAnnotationPresent(SOAPBinding.class))
{
- if (log.isDebugEnabled())
- log.debug("processSOAPBinding on: " + wsClass.getName());
+ log.debug("processSOAPBinding on: " + wsClass.getName());
SOAPBinding anSoapBinding = wsClass.getAnnotation(SOAPBinding.class);
SOAPBinding.Style attrStyle = anSoapBinding.style();
Modified: trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -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);
@@ -126,6 +125,9 @@
serviceMetaData.setWsdlLocation(wsdlURL);
}
+ // process binding type
+ processBindingType(sepMetaData, sepClass);
+
// process handler chain
processHandlerChain(sepMetaData, sepClass);
@@ -156,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());
Modified: trunk/jbossws-core/src/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-core/src/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -28,10 +28,12 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Observable;
import java.util.Properties;
+import java.util.Set;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import javax.xml.namespace.QName;
@@ -60,8 +62,8 @@
import org.jboss.ws.metadata.config.ConfigurationProvider;
import org.jboss.ws.metadata.config.EndpointFeature;
import org.jboss.ws.metadata.config.JBossWSConfigFactory;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
/**
* A Service component describes a set of endpoints.
@@ -79,6 +81,16 @@
JAXRPC, JAXWS
}
+ public static final Set<String> SUPPORTED_BINDINGS = new HashSet<String>();
+ static
+ {
+ SUPPORTED_BINDINGS.add(Constants.SOAP11HTTP_BINDING);
+ SUPPORTED_BINDINGS.add(Constants.SOAP12HTTP_BINDING);
+ SUPPORTED_BINDINGS.add(Constants.SOAP11HTTP_MTOM_BINDING);
+ SUPPORTED_BINDINGS.add(Constants.SOAP12HTTP_MTOM_BINDING);
+ SUPPORTED_BINDINGS.add(Constants.HTTP_BINDING);
+ }
+
// The parent meta data.
private ServiceMetaData serviceMetaData;
@@ -154,7 +166,7 @@
}
public void setPortName(QName portName)
- {
+ {
this.portName = portName;
}
@@ -180,11 +192,8 @@
public void setBindingId(String bindingId)
{
- if (!Constants.SOAP11HTTP_BINDING.equals(bindingId) && !Constants.SOAP12HTTP_BINDING.equals(bindingId) && !Constants.SOAP11HTTP_MTOM_BINDING.equals(bindingId)
- && !Constants.SOAP12HTTP_MTOM_BINDING.equals(bindingId))
- {
+ if (SUPPORTED_BINDINGS.contains(bindingId) == false)
throw new WSException("Unsupported binding: " + bindingId);
- }
this.bindingId = bindingId;
}
@@ -327,7 +336,7 @@
public Properties getProperties()
{
- if(null == this.properties)
+ if (null == this.properties)
this.properties = new Properties();
return this.properties;
}
@@ -734,8 +743,7 @@
boolean match;
if (seiName != null && portName != null)
match = getServiceEndpointInterfaceName().equals(seiName) && portName.equals(portName);
- else
- match = getServiceEndpointInterfaceName().equals(seiName) || getPortName().equals(portName);
+ else match = getServiceEndpointInterfaceName().equals(seiName) || getPortName().equals(portName);
return match;
}
Modified: trunk/jbossws-tests/ant-import/build-samples-jaxws.xml
===================================================================
--- trunk/jbossws-tests/ant-import/build-samples-jaxws.xml 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-tests/ant-import/build-samples-jaxws.xml 2007-04-04 10:38:07 UTC (rev 2755)
@@ -80,6 +80,28 @@
</manifest>
</jar>
+ <!-- jaxws-samples-httpbinding -->
+ <war warfile="${tests.output.dir}/libs/jaxws-samples-httpbinding-jaxb.war" webxml="${tests.output.dir}/resources/jaxws/samples/httpbinding/jaxb/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.class"/>
+ <include name="org/jboss/test/ws/jaxws/samples/httpbinding/WebServiceEndpoint.class"/>
+ <include name="org/jboss/test/ws/jaxws/samples/httpbinding/UserType.class"/>
+ </classes>
+ <webinf dir="${tests.output.dir}/resources/jaxws/samples/httpbinding/shared">
+ <include name="wsdl/HttpBinding.wsdl"/>
+ </webinf>
+ </war>
+ <war warfile="${tests.output.dir}/libs/jaxws-samples-httpbinding-payload.war" webxml="${tests.output.dir}/resources/jaxws/samples/httpbinding/payload/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.class"/>
+ <include name="org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.class"/>
+ <include name="org/jboss/test/ws/jaxws/samples/httpbinding/httpbinding-handlers.xml"/>
+ </classes>
+ <webinf dir="${tests.output.dir}/resources/jaxws/samples/httpbinding/shared">
+ <include name="wsdl/HttpBinding.wsdl"/>
+ </webinf>
+ </war>
+
<!-- jaxws-samples-jsr181ejb -->
<jar jarfile="${tests.output.dir}/libs/jaxws-samples-jsr181ejb.jar">
<fileset dir="${tests.output.dir}/classes">
Modified: trunk/jbossws-tests/build.xml
===================================================================
--- trunk/jbossws-tests/build.xml 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-tests/build.xml 2007-04-04 10:38:07 UTC (rev 2755)
@@ -474,7 +474,7 @@
<antcall target="tests-main">
<param name="include.wildcard" value="org/jboss/test/ws/tools/**/*TestCase.class"/>
<param name="exclude.wildcard" value="no-wildcard-exclude-see-excludesfile"/>
- <param name="haltonfailure" value="false"/>
+ <param name="haltonfailure" value="true"/>
</antcall>
<antcall target="tests-report"/>
</target>
@@ -487,7 +487,7 @@
<antcall target="tests-main">
<param name="include.wildcard" value="org/jboss/test/ws/${test}/**/*TestCase.class"/>
<param name="exclude.wildcard" value="no-wildcard-exclude-see-excludesfile"/>
- <param name="haltonfailure" value="false"/>
+ <param name="haltonfailure" value="true"/>
</antcall>
</target>
Modified: trunk/jbossws-tests/src/etc/log4j.xml
===================================================================
--- trunk/jbossws-tests/src/etc/log4j.xml 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-tests/src/etc/log4j.xml 2007-04-04 10:38:07 UTC (rev 2755)
@@ -56,6 +56,10 @@
<priority value="DEBUG"/>
</category>
+ <category name="org.jboss.ws.core.MessageTrace">
+ <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+ </category>
+
<category name="org.jboss.remoting">
<priority value="INFO"/>
</category>
@@ -65,11 +69,6 @@
<priority value="INFO"/>
</category>
- <!-- Enable SOAP message tracing -->
- <category name="jbossws.SOAPMessage">
- <priority value="TRACE" class="org.jboss.logging.XLevel"/>
- </category>
-
<!--
<category name="org.jboss.xb">
<priority value="TRACE" class="org.jboss.logging.XLevel"/>
Modified: trunk/jbossws-tests/src/java/org/jboss/test/ws/JBossWSTest.java
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/JBossWSTest.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/JBossWSTest.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -31,15 +31,12 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.xml.transform.Source;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMResult;
import junit.framework.TestCase;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.core.utils.DOMWriter;
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -149,14 +146,9 @@
return JBossWSTestHelper.getServerHost();
}
- public Element getElementFromSource(Source retObj) throws TransformerException
+ public Element getElementFromSource(Source retObj) throws Exception
{
- DOMResult domResult = new DOMResult();
- TransformerFactory tf = TransformerFactory.newInstance();
- tf.newTransformer().transform(retObj, domResult);
- Document doc = (Document)domResult.getNode();
- Element docElement = doc.getDocumentElement();
- return docElement;
+ return DOMUtils.sourceToElement(retObj);
}
public static void assertEquals(Element expElement, Element wasElement, boolean ignoreWhitespace)
Modified: trunk/jbossws-tests/src/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -45,6 +45,7 @@
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -250,7 +251,7 @@
ByteArrayInputStream inputStream = new ByteArrayInputStream(reqEnvelope.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage reqMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl reqMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(reqMessage);
@@ -277,7 +278,7 @@
ByteArrayInputStream inputStream = new ByteArrayInputStream(reqEnvelopeWithBoundHeader.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage reqMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl reqMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(reqMessage);
@@ -300,7 +301,7 @@
ByteArrayInputStream inputStream = new ByteArrayInputStream(reqEnvelopeWithUnboundHeader.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage reqMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl reqMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(reqMessage);
@@ -344,7 +345,7 @@
ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelope.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage resMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(resMessage);
@@ -364,7 +365,7 @@
ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelopeWithBoundHeader.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage resMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(resMessage);
@@ -395,7 +396,7 @@
ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelopeWithUnboundHeader.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage resMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(resMessage);
@@ -423,7 +424,7 @@
ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelopeWithFault.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage resMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(resMessage);
Modified: trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/SOAPFaultTestCase.java
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/SOAPFaultTestCase.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/SOAPFaultTestCase.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -49,9 +49,19 @@
*/
public class SOAPFaultTestCase extends JBossWSTest
{
- private String envStr = "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" + " <env:Header/>" + " <env:Body>" + " <env:Fault>"
- + " <faultcode>env:Client</faultcode>" + " <faultstring>Some fault message</faultstring>" + " <faultactor>Some fault actor</faultactor>" + " <detail>"
- + " <ns1:name xmlns:ns1='http://somens'>Kermit</ns1:name>" + " </detail>" + " </env:Fault>" + " </env:Body>" + "</env:Envelope>";
+ private String envStr = "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
+ " <env:Header/>" +
+ " <env:Body>" +
+ " <env:Fault>" +
+ " <faultcode>env:Client</faultcode>" +
+ " <faultstring>Some fault message</faultstring>" +
+ " <faultactor>Some fault actor</faultactor>" +
+ " <detail>" +
+ " <ns1:name xmlns:ns1='http://somens'>Kermit</ns1:name>" +
+ " </detail>" +
+ " </env:Fault>" +
+ " </env:Body>" +
+ "</env:Envelope>";
public void testExceptionToFault() throws Exception
{
Modified: trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2007-04-04 10:34:50 UTC (rev 2754)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -49,6 +49,7 @@
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.attachment.MimeConstants;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
@@ -165,7 +166,7 @@
MimeHeaders headers = new MimeHeaders();
headers.addHeader(MimeConstants.CONTENT_TYPE, type);
- SOAPMessage msg2 = new MessageFactoryImpl().createMessage(headers, in);
+ SOAPMessageImpl msg2 = (SOAPMessageImpl)new MessageFactoryImpl().createMessage(headers, in);
epInv = binding.unbindRequestMessage(opMetaData, msg2);
@@ -185,7 +186,7 @@
headers = new MimeHeaders();
headers.addHeader(MimeConstants.CONTENT_TYPE, type);
- SOAPMessage msg3 = new MessageFactoryImpl().createMessage(headers, in);
+ SOAPMessageImpl msg3 = (SOAPMessageImpl)new MessageFactoryImpl().createMessage(headers, in);
binding.unbindResponseMessage(opMetaData, msg3, epInv, null);
Copied: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding)
Deleted: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java 2007-04-04 10:08:31 UTC (rev 2753)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -1,91 +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.samples.httpbinding;
-
-// $Id$
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.namespace.QName;
-import javax.xml.ws.Dispatch;
-import javax.xml.ws.Service;
-import javax.xml.ws.Service.Mode;
-import javax.xml.ws.http.HTTPBinding;
-
-import junit.framework.Test;
-
-import org.jboss.test.ws.JBossWSTest;
-import org.jboss.test.ws.JBossWSTestSetup;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
-
-/**
- * Test HTTP Binding
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 02-Apr-2007
- */
-public class HttpJAXBTestCase extends JBossWSTest
-{
- public static Test suite()
- {
- return JBossWSTestSetup.newTestSetup(HttpJAXBTestCase.class, "jaxws-samples-httpbinding-jaxb.war");
- }
-
- public void testWSDLAccess() throws Exception
- {
- URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-httpbinding-jaxb/ProviderEndpoint?wsdl");
- WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
- WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL);
- assertNotNull(wsdlDefinitions);
- }
-
- public void testProviderDispatch() throws Exception
- {
- Dispatch<Object> dispatch = createDispatch("ProviderEndpoint");
-
- UserType user = new UserType();
- user.setString("Kermit");
- user.setQname(new QName("TheFrog"));
- UserType userRes = (UserType)dispatch.invoke(user);
- assertEquals(user.getString(), userRes.getString());
- assertEquals(user.getQname(), userRes.getQname());
- }
-
- private Dispatch<Object> createDispatch(String target) throws MalformedURLException, JAXBException
- {
- String targetNS = "http://org.jboss.ws/httpbinding";
- QName serviceName = new QName(targetNS, "ProviderService");
- QName portName = new QName(targetNS, "ProviderPort");
- URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-httpbinding-jaxb/" + target + "?wsdl");
-
- Service service = Service.create(serviceName);
- service.addPort(portName, HTTPBinding.HTTP_BINDING, wsdlURL.toExternalForm());
-
- JAXBContext jbc = JAXBContext.newInstance(new Class[] { UserType.class });
- Dispatch<Object> dispatch = service.createDispatch(portName, jbc, Mode.PAYLOAD);
- return dispatch;
- }
-}
\ No newline at end of file
Copied: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java)
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java (rev 0)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,91 @@
+/*
+ * 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.samples.httpbinding;
+
+// $Id$
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+import javax.xml.ws.http.HTTPBinding;
+
+import junit.framework.Test;
+
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+
+/**
+ * Test HTTP Binding
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 02-Apr-2007
+ */
+public class HttpJAXBTestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return JBossWSTestSetup.newTestSetup(HttpJAXBTestCase.class, "jaxws-samples-httpbinding-jaxb.war");
+ }
+
+ public void testWSDLAccess() throws Exception
+ {
+ URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-httpbinding-jaxb/ProviderEndpoint?wsdl");
+ WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
+ WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL);
+ assertNotNull(wsdlDefinitions);
+ }
+
+ public void testProviderDispatch() throws Exception
+ {
+ Dispatch<Object> dispatch = createDispatch("ProviderEndpoint");
+
+ UserType user = new UserType();
+ user.setString("Kermit");
+ user.setQname(new QName("TheFrog"));
+ UserType userRes = (UserType)dispatch.invoke(user);
+ assertEquals(user.getString(), userRes.getString());
+ assertEquals(user.getQname(), userRes.getQname());
+ }
+
+ private Dispatch<Object> createDispatch(String target) throws MalformedURLException, JAXBException
+ {
+ String targetNS = "http://org.jboss.ws/httpbinding";
+ QName serviceName = new QName(targetNS, "ProviderService");
+ QName portName = new QName(targetNS, "ProviderPort");
+ URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-httpbinding-jaxb/" + target + "?wsdl");
+
+ Service service = Service.create(serviceName);
+ service.addPort(portName, HTTPBinding.HTTP_BINDING, wsdlURL.toExternalForm());
+
+ JAXBContext jbc = JAXBContext.newInstance(new Class[] { UserType.class });
+ Dispatch<Object> dispatch = service.createDispatch(portName, jbc, Mode.PAYLOAD);
+ return dispatch;
+ }
+}
\ No newline at end of file
Deleted: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java 2007-04-04 10:08:31 UTC (rev 2753)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -1,94 +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.samples.httpbinding;
-
-// $Id$
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.xml.bind.JAXBException;
-import javax.xml.namespace.QName;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.ws.Dispatch;
-import javax.xml.ws.Service;
-import javax.xml.ws.Service.Mode;
-import javax.xml.ws.http.HTTPBinding;
-
-import junit.framework.Test;
-
-import org.jboss.test.ws.JBossWSTest;
-import org.jboss.test.ws.JBossWSTestSetup;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
-import org.w3c.dom.Element;
-
-/**
- * Test a Provider<SOAPMessage>
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 29-Jun-2006
- */
-public class HttpPayloadTestCase extends JBossWSTest
-{
- private String reqString = "<ns1:somePayload xmlns:ns1='http://org.jboss.ws/httpbinding'>Hello</ns1:somePayload>";
-
- private String resString = "<ns1:somePayload xmlns:ns1='http://org.jboss.ws/httpbinding'>Hello:InboundLogicalHandler:OutboundLogicalHandler</ns1:somePayload>";
-
- public static Test suite()
- {
- return JBossWSTestSetup.newTestSetup(HttpPayloadTestCase.class, "jaxws-samples-httpbinding-payload.war");
- }
-
- public void testWSDLAccess() throws Exception
- {
- URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-httpbinding-payload?wsdl");
- WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
- WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL);
- assertNotNull(wsdlDefinitions);
- }
-
- public void testProviderDispatch() throws Exception
- {
- Dispatch<Source> dispatch = createDispatch("ProviderEndpoint");
- Source resPayload = dispatch.invoke(new DOMSource(DOMUtils.parse(reqString)));
-
- Element docElement = getElementFromSource(resPayload);
- assertEquals(DOMUtils.parse(resString), docElement);
- }
-
- private Dispatch<Source> createDispatch(String target) throws MalformedURLException, JAXBException
- {
- String targetNS = "http://org.jboss.ws/httpbinding";
- QName serviceName = new QName(targetNS, "ProviderService");
- QName portName = new QName(targetNS, "ProviderPort");
- URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-httpbinding-payload/" + target + "?wsdl");
-
- Service service = Service.create(serviceName);
- service.addPort(portName, HTTPBinding.HTTP_BINDING, wsdlURL.toExternalForm());
-
- Dispatch<Source> dispatch = service.createDispatch(portName, Source.class, Mode.PAYLOAD);
- return dispatch;
- }
-}
Copied: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java)
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java (rev 0)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,94 @@
+/*
+ * 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.samples.httpbinding;
+
+// $Id$
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+import javax.xml.ws.http.HTTPBinding;
+
+import junit.framework.Test;
+
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.w3c.dom.Element;
+
+/**
+ * Test a Provider<SOAPMessage>
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 29-Jun-2006
+ */
+public class HttpPayloadTestCase extends JBossWSTest
+{
+ private String reqString = "<ns1:somePayload xmlns:ns1='http://org.jboss.ws/httpbinding'>Hello</ns1:somePayload>";
+
+ private String resString = "<ns1:somePayload xmlns:ns1='http://org.jboss.ws/httpbinding'>Hello:InboundLogicalHandler:OutboundLogicalHandler</ns1:somePayload>";
+
+ public static Test suite()
+ {
+ return JBossWSTestSetup.newTestSetup(HttpPayloadTestCase.class, "jaxws-samples-httpbinding-payload.war");
+ }
+
+ public void testWSDLAccess() throws Exception
+ {
+ URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-httpbinding-payload?wsdl");
+ WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
+ WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL);
+ assertNotNull(wsdlDefinitions);
+ }
+
+ public void testProviderDispatch() throws Exception
+ {
+ Dispatch<Source> dispatch = createDispatch("ProviderEndpoint");
+ Source resPayload = dispatch.invoke(new DOMSource(DOMUtils.parse(reqString)));
+
+ Element docElement = getElementFromSource(resPayload);
+ assertEquals(DOMUtils.parse(resString), docElement);
+ }
+
+ private Dispatch<Source> createDispatch(String target) throws MalformedURLException, JAXBException
+ {
+ String targetNS = "http://org.jboss.ws/httpbinding";
+ QName serviceName = new QName(targetNS, "ProviderService");
+ QName portName = new QName(targetNS, "ProviderPort");
+ URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-httpbinding-payload/" + target + "?wsdl");
+
+ Service service = Service.create(serviceName);
+ service.addPort(portName, HTTPBinding.HTTP_BINDING, wsdlURL.toExternalForm());
+
+ Dispatch<Source> dispatch = service.createDispatch(portName, Source.class, Mode.PAYLOAD);
+ return dispatch;
+ }
+}
Deleted: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java 2007-04-04 10:08:31 UTC (rev 2753)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -1,101 +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.samples.httpbinding;
-
-// $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.logging.Logger;
-import org.jboss.ws.core.jaxws.handler.GenericLogicalHandler;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.w3c.dom.Element;
-
-/**
- * A jaxws logical handler
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 24-Nov-2005
- */
-public class LogicalSourceHandler extends GenericLogicalHandler
-{
- // provide logging
- private static final Logger log = Logger.getLogger(LogicalSourceHandler.class);
-
- @Override
- public boolean handleOutbound(MessageContext msgContext)
- {
- return appendHandlerName(msgContext, "Outbound");
- }
-
- @Override
- public boolean handleInbound(MessageContext msgContext)
- {
- return appendHandlerName(msgContext, "Inbound");
- }
-
- public boolean appendHandlerName(MessageContext msgContext, String direction)
- {
- 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()));
-
- String oldValue = DOMUtils.getTextContent(root);
- String newValue = oldValue + ":" + direction + getHandlerName();
- root.setTextContent(newValue);
-
- log.debug("oldValue: " + oldValue);
- log.debug("newValue: " + newValue);
-
- // 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/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java)
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java (rev 0)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,101 @@
+/*
+ * 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.samples.httpbinding;
+
+// $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.logging.Logger;
+import org.jboss.ws.core.jaxws.handler.GenericLogicalHandler;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.w3c.dom.Element;
+
+/**
+ * A jaxws logical handler
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 24-Nov-2005
+ */
+public class LogicalSourceHandler extends GenericLogicalHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(LogicalSourceHandler.class);
+
+ @Override
+ public boolean handleOutbound(MessageContext msgContext)
+ {
+ return appendHandlerName(msgContext, "Outbound");
+ }
+
+ @Override
+ public boolean handleInbound(MessageContext msgContext)
+ {
+ return appendHandlerName(msgContext, "Inbound");
+ }
+
+ public boolean appendHandlerName(MessageContext msgContext, String direction)
+ {
+ 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()));
+
+ String oldValue = DOMUtils.getTextContent(root);
+ String newValue = oldValue + ":" + direction + getHandlerName();
+ root.setTextContent(newValue);
+
+ log.debug("oldValue: " + oldValue);
+ log.debug("newValue: " + newValue);
+
+ // 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);
+ }
+ }
+}
Deleted: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java 2007-04-04 10:08:31 UTC (rev 2753)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -1,76 +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.samples.httpbinding;
-
-// $Id$
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.util.JAXBSource;
-import javax.xml.transform.Source;
-import javax.xml.ws.BindingType;
-import javax.xml.ws.Provider;
-import javax.xml.ws.Service;
-import javax.xml.ws.ServiceMode;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.WebServiceProvider;
-import javax.xml.ws.http.HTTPBinding;
-
-import org.jboss.logging.Logger;
-
-import com.sun.xml.bind.api.JAXBRIContext;
-
-/**
- * Test a Provider<Source> with JAXB
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 29-Jun-2006
- */
-@WebServiceProvider(serviceName = "ProviderService", portName = "ProviderPort", targetNamespace = "http://org.jboss.ws/httpbinding", wsdlLocation = "WEB-INF/wsdl/HttpBinding.wsdl")
-
-@BindingType(value = HTTPBinding.HTTP_BINDING)
-@ServiceMode(value = Service.Mode.MESSAGE)
-public class ProviderBeanJAXB implements Provider<Source>
-{
- // provide logging
- private static Logger log = Logger.getLogger(ProviderBeanJAXB.class);
-
- public Source invoke(Source request)
- {
- try
- {
- JAXBContext jc = JAXBRIContext.newInstance(new Class[] { UserType.class });
- UserType user = (UserType)jc.createUnmarshaller().unmarshal(request);
-
- log.info("[string=" + user.getString() + ",qname=" + user.getQname() + "]");
-
- return new JAXBSource(jc, user);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new WebServiceException(e);
- }
- }
-}
\ No newline at end of file
Copied: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java)
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java (rev 0)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,76 @@
+/*
+ * 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.samples.httpbinding;
+
+// $Id$
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.util.JAXBSource;
+import javax.xml.transform.Source;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.jboss.logging.Logger;
+
+import com.sun.xml.bind.api.JAXBRIContext;
+
+/**
+ * Test a Provider<Source> with JAXB
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 29-Jun-2006
+ */
+@WebServiceProvider(serviceName = "ProviderService", portName = "ProviderPort", targetNamespace = "http://org.jboss.ws/httpbinding", wsdlLocation = "WEB-INF/wsdl/HttpBinding.wsdl")
+
+@BindingType(value = HTTPBinding.HTTP_BINDING)
+@ServiceMode(value = Service.Mode.MESSAGE)
+public class ProviderBeanJAXB implements Provider<Source>
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(ProviderBeanJAXB.class);
+
+ public Source invoke(Source request)
+ {
+ try
+ {
+ JAXBContext jc = JAXBRIContext.newInstance(new Class[] { UserType.class });
+ UserType user = (UserType)jc.createUnmarshaller().unmarshal(request);
+
+ log.info("[string=" + user.getString() + ",qname=" + user.getQname() + "]");
+
+ return new JAXBSource(jc, user);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WebServiceException(e);
+ }
+ }
+}
\ No newline at end of file
Deleted: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java 2007-04-04 10:08:31 UTC (rev 2753)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -1,88 +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.samples.httpbinding;
-
-// $Id$
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-
-import javax.jws.HandlerChain;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.ws.BindingType;
-import javax.xml.ws.Provider;
-import javax.xml.ws.Service;
-import javax.xml.ws.ServiceMode;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.WebServiceProvider;
-import javax.xml.ws.http.HTTPBinding;
-
-/**
- * Test a Provider<Source>
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 29-Jun-2006
- */
-
-@WebServiceProvider(serviceName = "ProviderService", portName = "ProviderPort", targetNamespace = "http://org.jboss.ws/httpbinding", wsdlLocation = "WEB-INF/wsdl/HttpBinding.wsdl")
-
-@BindingType(value = HTTPBinding.HTTP_BINDING)
-@ServiceMode(value = Service.Mode.MESSAGE)
-@HandlerChain(file = "httpbinding-handlers.xml")
-public class ProviderBeanPayload implements Provider<Source>
-{
- public Source invoke(Source req)
- {
- try
- {
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
- OutputStream out = new ByteArrayOutputStream();
- StreamResult streamResult = new StreamResult();
- streamResult.setOutputStream(out);
- transformer.transform(req, streamResult);
- String xmlReq = streamResult.getOutputStream().toString();
-
- String expReq = "<ns1:somePayload xmlns:ns1=\"http://org.jboss.ws/httpbinding\">Hello:InboundLogicalHandler</ns1:somePayload>";
- if (!expReq.equals(xmlReq))
- throw new WebServiceException("Unexpected payload: " + xmlReq);
-
- return new StreamSource(new ByteArrayInputStream(xmlReq.getBytes()));
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new WebServiceException(e);
- }
- }
-
-}
\ No newline at end of file
Copied: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java)
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java (rev 0)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,88 @@
+/*
+ * 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.samples.httpbinding;
+
+// $Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+
+import javax.jws.HandlerChain;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.http.HTTPBinding;
+
+/**
+ * Test a Provider<Source>
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 29-Jun-2006
+ */
+
+@WebServiceProvider(serviceName = "ProviderService", portName = "ProviderPort", targetNamespace = "http://org.jboss.ws/httpbinding", wsdlLocation = "WEB-INF/wsdl/HttpBinding.wsdl")
+
+@BindingType(value = HTTPBinding.HTTP_BINDING)
+@ServiceMode(value = Service.Mode.MESSAGE)
+@HandlerChain(file = "httpbinding-handlers.xml")
+public class ProviderBeanPayload implements Provider<Source>
+{
+ public Source invoke(Source req)
+ {
+ try
+ {
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+ OutputStream out = new ByteArrayOutputStream();
+ StreamResult streamResult = new StreamResult();
+ streamResult.setOutputStream(out);
+ transformer.transform(req, streamResult);
+ String xmlReq = streamResult.getOutputStream().toString();
+
+ String expReq = "<ns1:somePayload xmlns:ns1=\"http://org.jboss.ws/httpbinding\">Hello:InboundLogicalHandler</ns1:somePayload>";
+ if (!expReq.equals(xmlReq))
+ throw new WebServiceException("Unexpected payload: " + xmlReq);
+
+ return new StreamSource(new ByteArrayInputStream(xmlReq.getBytes()));
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WebServiceException(e);
+ }
+ }
+
+}
\ No newline at end of file
Deleted: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/UserType.java
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/UserType.java 2007-04-04 10:08:31 UTC (rev 2753)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/UserType.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -1,114 +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.samples.httpbinding;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.namespace.QName;
-
-/**
- * <p>Java class for UserType complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="UserType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="string" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="qname" type="{http://www.w3.org/2001/XMLSchema}QName"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlRootElement(namespace = "http://org.jboss.ws/httpbinding", name = "user")
-(a)XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "UserType", propOrder = { "string", "qname" })
-public class UserType
-{
-
- @XmlElement(required = true)
- protected String string;
- @XmlElement(required = true)
- protected QName qname;
-
- /**
- * Gets the value of the string property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getString()
- {
- return string;
- }
-
- /**
- * Sets the value of the string property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setString(String value)
- {
- this.string = value;
- }
-
- /**
- * Gets the value of the qname property.
- *
- * @return
- * possible object is
- * {@link QName }
- *
- */
- public QName getQname()
- {
- return qname;
- }
-
- /**
- * Sets the value of the qname property.
- *
- * @param value
- * allowed object is
- * {@link QName }
- *
- */
- public void setQname(QName value)
- {
- this.qname = value;
- }
-
-}
Copied: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/UserType.java (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/UserType.java)
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/UserType.java (rev 0)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/UserType.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,114 @@
+/*
+ * 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.samples.httpbinding;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+
+/**
+ * <p>Java class for UserType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="UserType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="string" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="qname" type="{http://www.w3.org/2001/XMLSchema}QName"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlRootElement(namespace = "http://org.jboss.ws/httpbinding", name = "user")
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "UserType", propOrder = { "string", "qname" })
+public class UserType
+{
+
+ @XmlElement(required = true)
+ protected String string;
+ @XmlElement(required = true)
+ protected QName qname;
+
+ /**
+ * Gets the value of the string property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getString()
+ {
+ return string;
+ }
+
+ /**
+ * Sets the value of the string property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setString(String value)
+ {
+ this.string = value;
+ }
+
+ /**
+ * Gets the value of the qname property.
+ *
+ * @return
+ * possible object is
+ * {@link QName }
+ *
+ */
+ public QName getQname()
+ {
+ return qname;
+ }
+
+ /**
+ * Sets the value of the qname property.
+ *
+ * @param value
+ * allowed object is
+ * {@link QName }
+ *
+ */
+ public void setQname(QName value)
+ {
+ this.qname = value;
+ }
+
+}
Deleted: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/WebServiceEndpoint.java
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/WebServiceEndpoint.java 2007-04-04 10:08:31 UTC (rev 2753)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/WebServiceEndpoint.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.samples.httpbinding;
-
-import javax.jws.WebParam;
-import javax.jws.WebResult;
-import javax.jws.WebService;
-import javax.jws.soap.SOAPBinding;
-import javax.jws.soap.SOAPBinding.ParameterStyle;
-
-@WebService(serviceName = "ProviderService", portName = "ProviderPort", targetNamespace = "http://org.jboss.ws/httpbinding", wsdlLocation = "WEB-INF/wsdl/HttpBinding.wsdl")
-@SOAPBinding(parameterStyle = ParameterStyle.BARE)
-public class WebServiceEndpoint
-{
- @WebResult(name = "user")
- public UserType echo(@WebParam(name = "user")
- UserType type)
- {
- return type;
- }
-}
\ No newline at end of file
Copied: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/WebServiceEndpoint.java (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/WebServiceEndpoint.java)
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/WebServiceEndpoint.java (rev 0)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/WebServiceEndpoint.java 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.httpbinding;
+
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.ParameterStyle;
+
+@WebService(serviceName = "ProviderService", portName = "ProviderPort", targetNamespace = "http://org.jboss.ws/httpbinding", wsdlLocation = "WEB-INF/wsdl/HttpBinding.wsdl")
+@SOAPBinding(parameterStyle = ParameterStyle.BARE)
+public class WebServiceEndpoint
+{
+ @WebResult(name = "user")
+ public UserType echo(@WebParam(name = "user")
+ UserType type)
+ {
+ return type;
+ }
+}
\ No newline at end of file
Deleted: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/httpbinding-handlers.xml
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/httpbinding-handlers.xml 2007-04-04 10:08:31 UTC (rev 2753)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/httpbinding-handlers.xml 2007-04-04 10:38:07 UTC (rev 2755)
@@ -1,14 +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"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">
-
- <handler-chain>
- <handler>
- <handler-name> LogicalHandler </handler-name>
- <handler-class> org.jboss.test.ws.jaxws.samples.httpbinding.LogicalSourceHandler </handler-class>
- </handler>
- </handler-chain>
-
-</handler-chains>
\ No newline at end of file
Copied: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/httpbinding-handlers.xml (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/httpbinding-handlers.xml)
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/httpbinding-handlers.xml (rev 0)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/httpbinding-handlers.xml 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,14 @@
+<?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"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">
+
+ <handler-chain>
+ <handler>
+ <handler-name> LogicalHandler </handler-name>
+ <handler-class> org.jboss.test.ws.jaxws.samples.httpbinding.LogicalSourceHandler </handler-class>
+ </handler>
+ </handler-chain>
+
+</handler-chains>
\ No newline at end of file
Copied: trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding)
Copied: trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb)
Copied: trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/WEB-INF (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/WEB-INF)
Deleted: trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/WEB-INF/web.xml
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/WEB-INF/web.xml 2007-04-04 10:08:31 UTC (rev 2753)
+++ trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/WEB-INF/web.xml 2007-04-04 10:38:07 UTC (rev 2755)
@@ -1,25 +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>ProviderEndpoint</servlet-name>
- <servlet-class>org.jboss.test.ws.jaxws.samples.httpbinding.ProviderBeanJAXB</servlet-class>
- </servlet>
- <servlet>
- <servlet-name>WebServiceEndpoint</servlet-name>
- <servlet-class>org.jboss.test.ws.jaxws.samples.httpbinding.WebServiceEndpoint</servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>ProviderEndpoint</servlet-name>
- <url-pattern>/ProviderEndpoint</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>WebServiceEndpoint</servlet-name>
- <url-pattern>/WebServiceEndpoint</url-pattern>
- </servlet-mapping>
-</web-app>
-
Copied: trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/WEB-INF/web.xml (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/WEB-INF/web.xml)
===================================================================
--- trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/WEB-INF/web.xml (rev 0)
+++ trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/WEB-INF/web.xml 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,25 @@
+<?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>ProviderEndpoint</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.samples.httpbinding.ProviderBeanJAXB</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>WebServiceEndpoint</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.samples.httpbinding.WebServiceEndpoint</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>ProviderEndpoint</servlet-name>
+ <url-pattern>/ProviderEndpoint</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>WebServiceEndpoint</servlet-name>
+ <url-pattern>/WebServiceEndpoint</url-pattern>
+ </servlet-mapping>
+</web-app>
+
Deleted: trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/usertype.xsd
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/usertype.xsd 2007-04-04 10:08:31 UTC (rev 2753)
+++ trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/usertype.xsd 2007-04-04 10:38:07 UTC (rev 2755)
@@ -1,29 +0,0 @@
-
-<!--
- xjc usertype.xsd
--->
-
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
- xmlns:ns1="http://org.jboss.ws/httpbinding"
- targetNamespace="http://org.jboss.ws/httpbinding"
- elementFormDefault="qualified"
- jxb:version="1.0">
-
- <xsd:annotation>
- <xsd:appinfo>
- <jxb:schemaBindings>
- <jxb:package name="org.jboss.test.ws.jaxws.httpbinding"/>
- </jxb:schemaBindings>
- </xsd:appinfo>
- </xsd:annotation>
-
- <xsd:element name="user" type="ns1:UserType"/>
- <xsd:complexType name="UserType">
- <xsd:sequence>
- <xsd:element name="string" type="xsd:string"/>
- <xsd:element name="qname" type="xsd:QName"/>
- </xsd:sequence>
- </xsd:complexType>
-
-</xsd:schema>
\ No newline at end of file
Copied: trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/usertype.xsd (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/usertype.xsd)
===================================================================
--- trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/usertype.xsd (rev 0)
+++ trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/jaxb/usertype.xsd 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,29 @@
+
+<!--
+ xjc usertype.xsd
+-->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+ xmlns:ns1="http://org.jboss.ws/httpbinding"
+ targetNamespace="http://org.jboss.ws/httpbinding"
+ elementFormDefault="qualified"
+ jxb:version="1.0">
+
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jxb:schemaBindings>
+ <jxb:package name="org.jboss.test.ws.jaxws.httpbinding"/>
+ </jxb:schemaBindings>
+ </xsd:appinfo>
+ </xsd:annotation>
+
+ <xsd:element name="user" type="ns1:UserType"/>
+ <xsd:complexType name="UserType">
+ <xsd:sequence>
+ <xsd:element name="string" type="xsd:string"/>
+ <xsd:element name="qname" type="xsd:QName"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
\ No newline at end of file
Copied: trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload)
Copied: trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload/WEB-INF (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload/WEB-INF)
Deleted: trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload/WEB-INF/web.xml
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload/WEB-INF/web.xml 2007-04-04 10:08:31 UTC (rev 2753)
+++ trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload/WEB-INF/web.xml 2007-04-04 10:38:07 UTC (rev 2755)
@@ -1,17 +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>TestEndpoint</servlet-name>
- <servlet-class>org.jboss.test.ws.jaxws.samples.httpbinding.ProviderBeanPayload</servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>TestEndpoint</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
-</web-app>
-
Copied: trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload/WEB-INF/web.xml (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload/WEB-INF/web.xml)
===================================================================
--- trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload/WEB-INF/web.xml (rev 0)
+++ trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/payload/WEB-INF/web.xml 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,17 @@
+<?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>TestEndpoint</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.samples.httpbinding.ProviderBeanPayload</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>TestEndpoint</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+</web-app>
+
Copied: trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared)
Copied: trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared/wsdl (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared/wsdl)
Deleted: trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared/wsdl/HttpBinding.wsdl
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared/wsdl/HttpBinding.wsdl 2007-04-04 10:08:31 UTC (rev 2753)
+++ trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared/wsdl/HttpBinding.wsdl 2007-04-04 10:38:07 UTC (rev 2755)
@@ -1,43 +0,0 @@
-<?xml version='1.0'?>
-<definitions name='ProviderService' targetNamespace='http://org.jboss.ws/httpbinding' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://org.jboss.ws/httpbinding' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
- <types>
- <xs:schema targetNamespace='http://org.jboss.ws/httpbinding' xmlns:tns='http://org.jboss.ws/httpbinding' version='1.0' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
- <xs:element name='user' type='tns:UserType'/>
- <xs:complexType name='UserType'>
- <xs:sequence>
- <xs:element name='string' type='xs:string'/>
- <xs:element name='qname' type='xs:QName'/>
- </xs:sequence>
- </xs:complexType>
- </xs:schema>
- </types>
- <message name='echo'>
- <part element='tns:user' name='user'/>
- </message>
- <message name='echoResponse'>
- <part element='tns:user' name='user'/>
- </message>
- <portType name='Provider'>
- <operation name='echo'>
- <input message='tns:echo'/>
- <output message='tns:echoResponse'/>
- </operation>
- </portType>
- <binding name='ProviderBinding' type='tns:Provider'>
- <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
- <operation name='echo'>
- <soap:operation soapAction=''/>
- <input>
- <soap:body use='literal'/>
- </input>
- <output>
- <soap:body use='literal'/>
- </output>
- </operation>
- </binding>
- <service name='ProviderService'>
- <port binding='tns:ProviderBinding' name='ProviderPort'>
- <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
- </port>
- </service>
-</definitions>
Copied: trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared/wsdl/HttpBinding.wsdl (from rev 2753, branches/tdiesler/trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared/wsdl/HttpBinding.wsdl)
===================================================================
--- trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared/wsdl/HttpBinding.wsdl (rev 0)
+++ trunk/jbossws-tests/src/resources/jaxws/samples/httpbinding/shared/wsdl/HttpBinding.wsdl 2007-04-04 10:38:07 UTC (rev 2755)
@@ -0,0 +1,43 @@
+<?xml version='1.0'?>
+<definitions name='ProviderService' targetNamespace='http://org.jboss.ws/httpbinding' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://org.jboss.ws/httpbinding' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ <types>
+ <xs:schema targetNamespace='http://org.jboss.ws/httpbinding' xmlns:tns='http://org.jboss.ws/httpbinding' version='1.0' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+ <xs:element name='user' type='tns:UserType'/>
+ <xs:complexType name='UserType'>
+ <xs:sequence>
+ <xs:element name='string' type='xs:string'/>
+ <xs:element name='qname' type='xs:QName'/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:schema>
+ </types>
+ <message name='echo'>
+ <part element='tns:user' name='user'/>
+ </message>
+ <message name='echoResponse'>
+ <part element='tns:user' name='user'/>
+ </message>
+ <portType name='Provider'>
+ <operation name='echo'>
+ <input message='tns:echo'/>
+ <output message='tns:echoResponse'/>
+ </operation>
+ </portType>
+ <binding name='ProviderBinding' type='tns:Provider'>
+ <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
+ <operation name='echo'>
+ <soap:operation soapAction=''/>
+ <input>
+ <soap:body use='literal'/>
+ </input>
+ <output>
+ <soap:body use='literal'/>
+ </output>
+ </operation>
+ </binding>
+ <service name='ProviderService'>
+ <port binding='tns:ProviderBinding' name='ProviderPort'>
+ <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
+ </port>
+ </service>
+</definitions>
17 years
JBossWS SVN: r2754 - trunk/jbossws-core/src/java/org/jboss/ws/core/soap/attachment.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-04-04 06:34:50 -0400 (Wed, 04 Apr 2007)
New Revision: 2754
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/attachment/AttachmentPartImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/attachment/MimeConstants.java
Log:
Implement missing Attachmentpart pieces for SAAJ 1.3
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/attachment/AttachmentPartImpl.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/attachment/AttachmentPartImpl.java 2007-04-04 10:08:31 UTC (rev 2753)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/attachment/AttachmentPartImpl.java 2007-04-04 10:34:50 UTC (rev 2754)
@@ -21,18 +21,19 @@
*/
package org.jboss.ws.core.soap.attachment;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
+import org.jboss.util.Base64;
+import org.jboss.ws.core.utils.IOUtils;
+import org.jboss.ws.WSException;
import javax.activation.DataHandler;
+import javax.activation.DataSource;
import javax.mail.internet.MimeMultipart;
import javax.xml.soap.AttachmentPart;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPException;
+import java.io.*;
+import java.util.Iterator;
-import org.jboss.util.NotImplementedException;
-
/**
* Implementation of the <code>AttachmentPart</code> interface.
* @see javax.xml.soap.AttachmentPart
@@ -188,6 +189,16 @@
mimeHeaders.removeHeader(name);
}
+ /**
+ * Sets the content of this attachment part to that of the given Object and sets the value of the Content-Type header
+ * to the given type. The type of the Object should correspond to the value given for the Content-Type.
+ * This depends on the particular set of DataContentHandler objects in use.
+ *
+ * @param object the Java object that makes up the content for this attachment part
+ * @param contentType the MIME string that specifies the type of the content
+ * @throws IllegalArgumentException if the contentType does not match the type of the content object,
+ * or if there was no DataContentHandler object for this content object
+ */
public void setContent(Object object, String contentType)
{
@@ -264,45 +275,216 @@
cachedContentType = contentType;
}
+ /**
+ * Returns an InputStream which can be used to obtain the content of AttachmentPart as Base64 encoded character data,
+ * this method would base64 encode the raw bytes of the attachment and return.
+ *
+ * @return an InputStream from which the Base64 encoded AttachmentPart can be read.
+ * @throws SOAPException if there is no content set into this AttachmentPart object or if there was a data transformation error.
+ * @since SAAJ 1.3
+ */
@Override
public InputStream getBase64Content() throws SOAPException
{
- //TODO: SAAJ 1.3
- throw new NotImplementedException();
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ try
+ {
+ // TODO: we might skip the buffer and encode lazily
+ IOUtils.copyStream(bout, getDataHandler().getInputStream());
+ String base64 = Base64.encodeBytes(bout.toByteArray());
+ return new ByteArrayInputStream(base64.getBytes());
+ }
+ catch (IOException e)
+ {
+ throw new SOAPException(e);
+ }
}
+ /**
+ * Gets the content of this AttachmentPart object as an InputStream
+ * as if a call had been made to getContent and no DataContentHandler
+ * had been registered for the content-type of this AttachmentPart.
+ *
+ * Note that reading from the returned InputStream would result in consuming the data in the stream.
+ * It is the responsibility of the caller to reset the InputStream appropriately before calling a Subsequent API.
+ * If a copy of the raw attachment content is required then the getRawContentBytes() API should be used instead.
+ *
+ * @return an InputStream from which the raw data contained by the AttachmentPart can be accessed.
+ * @throws SOAPException if there is no content set into this AttachmentPart object or if there was a data transformation error.
+ * @since SAAJ 1.3
+ */
@Override
public InputStream getRawContent() throws SOAPException
{
- //TODO: SAAJ 1.3
- throw new NotImplementedException();
+ try
+ {
+ return getDataHandler().getInputStream();
+ }
+ catch (IOException e)
+ {
+ throw new SOAPException(e);
+ }
}
+ /**
+ * Gets the content of this AttachmentPart object as a byte[] array as if a call had been
+ * made to getContent and no DataContentHandler had been registered for the content-type of this AttachmentPart.
+ *
+ * @return a byte[] array containing the raw data of the AttachmentPart.
+ * @throws SOAPException if there is no content set into this AttachmentPart object or if there was a data transformation error.
+ * @since SAAJ 1.3
+ */
@Override
public byte[] getRawContentBytes() throws SOAPException
{
- //TODO: SAAJ 1.3
- throw new NotImplementedException();
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ try
+ {
+ IOUtils.copyStream(bout, getDataHandler().getInputStream());
+ return bout.toByteArray();
+ }
+ catch (IOException e)
+ {
+ throw new SOAPException(e);
+ }
}
+ /**
+ * Sets the content of this attachment part from the Base64 source InputStream
+ * and sets the value of the Content-Type header to the value contained in contentType,
+ * This method would first decode the base64 input and write the resulting raw bytes to the attachment.
+ *
+ * A subsequent call to getSize() may not be an exact measure of the content size.
+ *
+ * @param content the base64 encoded data to add to the attachment part
+ * @param contentType the value to set into the Content-Type header
+ * @throws SOAPException if an there is an error in setting the content
+ * @throws NullPointerException if content is null
+ * @since SAAJ 1.3
+ */
@Override
public void setBase64Content(InputStream content, String contentType) throws SOAPException
{
- //TODO: SAAJ 1.3
- throw new NotImplementedException();
+ if(null == content)
+ throw new SOAPException("Content is null");
+
+ try
+ {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ IOUtils.copyStream(bout, content);
+ content.close();
+ byte[] bytes = bout.toByteArray();
+ byte[] raw;
+
+ try
+ {
+ // CTS passes contents that are not base64 encoded
+ raw = Base64.decode(bytes, 0, bytes.length);
+ }
+ catch (Throwable e)
+ {
+ throw new SOAPException(e);
+ }
+
+ dataHandler = new DataHandler(new ByteArrayDataSource(raw, contentType));
+ setContentType(contentType);
+
+ }
+ catch (IOException e)
+ {
+ throw new SOAPException(e);
+ }
}
+ /**
+ * Sets the content of this attachment part to that contained by the InputStream content and sets the value of the Content-Type header to the value contained in contentType.
+ *
+ * A subsequent call to getSize() may not be an exact measure of the content size.
+ *
+ * @param content the raw data to add to the attachment part
+ * @param contentType the value to set into the Content-Type header
+ * @throws SOAPException if an there is an error in setting the content
+ * @throws NullPointerException if content is null
+ * @since SAAJ 1.3
+ */
@Override
public void setRawContent(InputStream content, String contentType) throws SOAPException
{
- //TODO: SAAJ 1.3
- throw new NotImplementedException();
+ if(null == content)
+ throw new SOAPException("Content is null");
+
+ dataHandler = new DataHandler(new ByteArrayDataSource(content, contentType));
+ setContentType(contentType);
}
+ /**
+ * Sets the content of this attachment part to that contained
+ * by the byte[] array content and sets the value of the Content-Type
+ * header to the value contained in contentType.
+ *
+ * @param content the raw data to add to the attachment part
+ * @param contentType the value to set into the Content-Type header
+ * @param offset the offset in the byte array of the content
+ * @param len the number of bytes that form the content
+ * @throws SOAPException if an there is an error in setting the content or content is null
+ * @since SAAJ 1.3
+ */
@Override
public void setRawContentBytes(byte[] content, int offset, int len, String contentType) throws SOAPException
{
- //TODO: SAAJ 1.3
- throw new NotImplementedException();
+ setRawContent(new ByteArrayInputStream(content, offset, len), contentType);
}
+
+ class ByteArrayDataSource implements DataSource
+ {
+ private byte[] data;
+ private String type;
+
+ ByteArrayDataSource(InputStream is, String type) {
+ this.type = type;
+ try {
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ int ch;
+
+ while ((ch = is.read()) != -1)
+ os.write(ch);
+
+ data = os.toByteArray();
+ } catch (IOException ioex) {
+ throw new WSException(ioex);
+ }
+ }
+
+ ByteArrayDataSource(byte[] data, String type) {
+ this.data = data;
+ this.type = type;
+ }
+
+ ByteArrayDataSource(String data, String type) {
+ try {
+ this.data = data.getBytes("iso-8859-1");
+ } catch (UnsupportedEncodingException uex) {
+ throw new WSException(uex);
+ }
+ this.type = type;
+ }
+
+ public InputStream getInputStream() throws IOException {
+ if (data == null)
+ throw new IOException("no data");
+ return new ByteArrayInputStream(data);
+ }
+
+ public OutputStream getOutputStream() throws IOException {
+ throw new IOException("cannot do this");
+ }
+
+ public String getContentType() {
+ return type;
+ }
+
+ public String getName() {
+ return "ByteArrayDataSource";
+ }
+ }
}
\ No newline at end of file
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/attachment/MimeConstants.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/attachment/MimeConstants.java 2007-04-04 10:08:31 UTC (rev 2753)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/attachment/MimeConstants.java 2007-04-04 10:34:50 UTC (rev 2754)
@@ -31,7 +31,7 @@
// Header constants
public static final String CONTENT_TYPE = "Content-Type";
public static final String CONTENT_LOCATION = "Content-Location";
- public static final String CONTENT_ID = "Content-Id";
+ public static final String CONTENT_ID = "Content-ID";
public static final String CONTENT_DESCRIPTION = "Content-Description";
public static final String CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
17 years
JBossWS SVN: r2753 - in branches/tdiesler/trunk: jbossws-core/src/java/org/jboss/ws/core/client and 8 other directories.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-04-04 06:08:31 -0400 (Wed, 04 Apr 2007)
New Revision: 2753
Added:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTrace.java
Removed:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.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/client/DispatchImpl.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/ServiceEndpoint.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPBodyImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
branches/tdiesler/trunk/jbossws-tests/build.xml
branches/tdiesler/trunk/jbossws-tests/src/etc/log4j.xml
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/JBossWSTest.java
Log:
HTTPBinding, samples pass
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java 2007-04-03 21:36:00 UTC (rev 2752)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java 2007-04-04 10:08:31 UTC (rev 2753)
@@ -38,7 +38,6 @@
import javax.xml.soap.AttachmentPart;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
import javax.xml.ws.addressing.AddressingProperties;
import javax.xml.ws.addressing.JAXWSAConstants;
@@ -47,11 +46,10 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.DirectionHolder.Direction;
import org.jboss.ws.core.client.EndpointInfo;
+import org.jboss.ws.core.client.SOAPRemotingConnection;
import org.jboss.ws.core.jaxrpc.ParameterWrapping;
import org.jboss.ws.core.jaxrpc.Style;
import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.SOAPBodyImpl;
-import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.core.utils.HolderUtils;
import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
@@ -75,9 +73,9 @@
{
// provide logging
private static Logger log = Logger.getLogger(CommonClient.class);
-
+
public static String SESSION_COOKIES = "org.jboss.ws.maintain.session.cookies";
-
+
// The endpoint together with the operationName uniquely identify the call operation
protected EndpointMetaData epMetaData;
// The current operation name
@@ -223,7 +221,7 @@
protected abstract void setInboundContextProperties();
protected abstract void setOutboundContextProperties();
-
+
protected abstract boolean shouldMaintainSession();
/** Call invokation goes as follows:
@@ -273,7 +271,7 @@
setOutboundContextProperties();
// Bind the request message
- SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData, epInv, unboundHeaders);
+ MessageAbstraction reqMessage = binding.bindRequestMessage(opMetaData, epInv, unboundHeaders);
// Add possible attachment parts
addAttachmentParts(reqMessage);
@@ -284,8 +282,8 @@
handlerPass = handlerPass && callRequestHandlerChain(portName, handlerType[2]);
// Handlers might have replaced the message
- reqMessage = msgContext.getSOAPMessage();
-
+ reqMessage = msgContext.getMessageAbstraction();
+
if (handlerPass)
{
String targetAddress = getTargetEndpointAddress();
@@ -315,32 +313,25 @@
if (targetAddress == null)
throw new WSException("Target endpoint address not set");
- Map<String, Object> callProps = new HashMap<String, Object>(getRequestContext());
+ Map<String, Object> callProps = new HashMap<String, Object>(getRequestContext());
EndpointInfo epInfo = new EndpointInfo(epMetaData, targetAddress, callProps);
if (shouldMaintainSession())
addSessionInfo(reqMessage, callProps);
- SOAPMessage resMessage;
- if (oneway)
- {
- resMessage = new SOAPConnectionImpl().callOneWay(reqMessage, epInfo);
- }
- else
- {
- resMessage = new SOAPConnectionImpl().call(reqMessage, epInfo);
- }
-
+ SOAPRemotingConnection remotingConnection = new SOAPRemotingConnection();
+ MessageAbstraction resMessage = remotingConnection.invoke(reqMessage, epInfo, oneway);
+
if (shouldMaintainSession())
saveSessionInfo(callProps, getRequestContext());
// At pivot the message context might be replaced
msgContext = processPivotInternal(msgContext, direction);
-
+
// Copy the remoting meta data
msgContext.put(CommonMessageContext.REMOTING_METADATA, callProps);
// Associate response message with message context
- msgContext.setSOAPMessage(resMessage);
+ msgContext.setMessageAbstraction(resMessage);
}
setInboundContextProperties();
@@ -371,7 +362,7 @@
faultType[0] = null;
// Check if protocol handlers modified the payload
- if (((SOAPBodyImpl)reqMessage.getSOAPBody()).isModifiedFromSource())
+ if (reqMessage.isModified())
{
log.debug("Handler modified body payload, unbind message again");
MessageAbstraction resMessage = msgContext.getMessageAbstraction();
@@ -403,53 +394,53 @@
closeHandlerChain(portName, handlerType[0]);
}
}
-
+
private void saveSessionInfo(Map<String, Object> remotingMetadata, Map<String, Object> requestContext)
{
- Map<String, String> cookies = (Map) remotingMetadata.get(SESSION_COOKIES);
+ Map<String, String> cookies = (Map)remotingMetadata.get(SESSION_COOKIES);
if (cookies == null)
{
cookies = new HashMap<String, String>();
requestContext.put(SESSION_COOKIES, cookies);
}
-
+
List<String> setCookies = new ArrayList<String>();
-
+
List<String> setCookies1 = (List)remotingMetadata.get("Set-Cookie");
if (setCookies1 != null)
setCookies.addAll(setCookies1);
-
+
List<String> setCookies2 = (List)remotingMetadata.get("Set-Cookie2");
if (setCookies2 != null)
setCookies.addAll(setCookies2);
-
+
// TODO: The parsing here should be improved to be fully compliant with the RFC
for (String setCookie : setCookies)
{
int index = setCookie.indexOf(';');
if (index == -1)
continue;
-
+
String pair = setCookie.substring(0, index);
index = pair.indexOf('=');
if (index == -1)
continue;
-
+
String name = pair.substring(0, index);
String value = pair.substring(index + 1);
-
+
cookies.put(name, value);
}
}
- protected void addSessionInfo(SOAPMessage reqMessage, Map<String, Object> callProperties)
+ protected void addSessionInfo(MessageAbstraction reqMessage, Map<String, Object> callProperties)
{
- Map<String, String> cookies = (Map) callProperties.get(SESSION_COOKIES);
+ Map<String, String> cookies = (Map)callProperties.get(SESSION_COOKIES);
if (cookies != null)
{
for (Map.Entry<String, String> cookie : cookies.entrySet())
{
- reqMessage.getMimeHeaders().addHeader("Cookie" , cookie.getKey() + "=" + cookie.getValue());
+ reqMessage.getMimeHeaders().addHeader("Cookie", cookie.getKey() + "=" + cookie.getValue());
}
}
}
@@ -464,12 +455,11 @@
return msgContext;
}
- protected void addAttachmentParts(SOAPMessage reqMessage)
+ protected void addAttachmentParts(MessageAbstraction reqMessage)
{
for (AttachmentPart part : attachmentParts)
{
- if (log.isDebugEnabled())
- log.debug("Adding attachment part: " + part.getContentId());
+ log.debug("Adding attachment part: " + part.getContentId());
reqMessage.addAttachmentPart(part);
}
}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java 2007-04-03 21:36:00 UTC (rev 2752)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java 2007-04-04 10:08:31 UTC (rev 2753)
@@ -25,11 +25,13 @@
import java.io.InputStream;
import java.io.OutputStream;
+import javax.xml.soap.AttachmentPart;
import javax.xml.soap.MimeHeaders;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
+import org.jboss.util.NotImplementedException;
import org.jboss.ws.core.soap.XMLFragment;
import org.jboss.ws.core.soap.attachment.MimeConstants;
@@ -43,6 +45,7 @@
{
private MimeHeaders mimeHeaders;
private XMLFragment xmlFragment;
+ private boolean modified;
public HTTPMessageImpl(MimeHeaders mimeHeaders, InputStream inputStream)
{
@@ -103,4 +106,20 @@
{
return false;
}
+
+ public void addAttachmentPart(AttachmentPart part)
+ {
+ throw new NotImplementedException();
+ }
+
+ public boolean isModified()
+ {
+ return modified;
+ }
+
+ public void setModified(boolean modifiedInHandler)
+ {
+ this.modified = modifiedInHandler;
+ }
+
}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java 2007-04-03 21:36:00 UTC (rev 2752)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java 2007-04-04 10:08:31 UTC (rev 2753)
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.io.OutputStream;
+import javax.xml.soap.AttachmentPart;
import javax.xml.soap.MimeHeaders;
/**
@@ -39,4 +40,11 @@
void writeTo(OutputStream outputStream) throws IOException;
boolean isFaultMessage();
+
+ boolean isModified();
+
+ void setModified(boolean flag);
+
+ void addAttachmentPart(AttachmentPart part);
+
}
Copied: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTrace.java (from rev 2752, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java)
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTrace.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTrace.java 2007-04-04 10:08:31 UTC (rev 2753)
@@ -0,0 +1,84 @@
+/*
+ * 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.core;
+
+// $Id$
+
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPElementWriter;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.w3c.dom.Element;
+
+/**
+ * Trace incomming/outgoing messages
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Apr-2007
+ */
+public final class MessageTrace
+{
+ private static Logger msgLog = Logger.getLogger(MessageTrace.class);
+
+ // Hide ctor
+ private MessageTrace()
+ {
+ }
+
+ public static void traceMessage(String messagePrefix, MessageAbstraction message)
+ {
+ if (msgLog.isTraceEnabled())
+ {
+ if (message instanceof SOAPMessage)
+ {
+ try
+ {
+ SOAPEnvelope soapEnv = ((SOAPMessage)message).getSOAPPart().getEnvelope();
+ if (soapEnv != null)
+ {
+ String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, true);
+ msgLog.trace(messagePrefix + "\n" + envStr);
+ }
+ }
+ catch (SOAPException ex)
+ {
+ msgLog.error("Cannot trace SOAPMessage", ex);
+ }
+ }
+ else if (message instanceof HTTPMessageImpl)
+ {
+ HTTPMessageImpl httpMessage = (HTTPMessageImpl)message;
+ Element root = httpMessage.getXmlFragment().toElement();
+ String xmlString = DOMWriter.printNode(root, true);
+ msgLog.trace(messagePrefix + "\n" + xmlString);
+ }
+ else
+ {
+ msgLog.warn("Unsupported message type: " + message);
+ }
+ }
+ }
+}
Deleted: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java 2007-04-03 21:36:00 UTC (rev 2752)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java 2007-04-04 10:08:31 UTC (rev 2753)
@@ -1,46 +0,0 @@
-package org.jboss.ws.core;
-
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.soap.SOAPElementImpl;
-import org.jboss.ws.core.soap.SOAPElementWriter;
-
-public final class MessageTracer
-{
- private static Logger msgLog = Logger.getLogger("jbossws.SOAPMessage");
-
- // Hide ctor
- private MessageTracer()
- {
- }
-
- public static void traceMessage(String string, MessageAbstraction message)
- {
- if (msgLog.isTraceEnabled())
- {
- if (message instanceof SOAPMessage)
- {
- try
- {
- SOAPEnvelope soapEnv = ((SOAPMessage)message).getSOAPPart().getEnvelope();
- if (soapEnv != null)
- {
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, true);
- msgLog.trace(string + "\n" + envStr);
- }
- }
- catch (SOAPException ex)
- {
- msgLog.error("Cannot trace SOAPMessage", ex);
- }
- }
- else
- {
- msgLog.warn("Unsupported message type: " + message);
- }
- }
- }
-}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java 2007-04-03 21:36:00 UTC (rev 2752)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java 2007-04-04 10:08:31 UTC (rev 2753)
@@ -45,7 +45,7 @@
import org.jboss.remoting.marshal.UnMarshaller;
import org.jboss.ws.WSException;
import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.MessageTracer;
+import org.jboss.ws.core.MessageTrace;
import org.jboss.ws.core.StubExt;
import org.jboss.ws.core.WSTimeoutException;
@@ -157,7 +157,7 @@
try
{
// debug the outgoing message
- MessageTracer.traceMessage("Outgoing Request Message", reqMessage);
+ MessageTrace.traceMessage("Outgoing Request Message", reqMessage);
MessageAbstraction resMessage = null;
try
@@ -186,7 +186,7 @@
callProps.putAll(metadata);
// trace the incomming response message
- MessageTracer.traceMessage("Incoming Response Message", resMessage);
+ MessageTrace.traceMessage("Incoming Response Message", resMessage);
return resMessage;
}
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 21:36:00 UTC (rev 2752)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java 2007-04-04 10:08:31 UTC (rev 2753)
@@ -31,6 +31,7 @@
import javax.xml.ws.EndpointReference;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.Service.Mode;
+import javax.xml.ws.http.HTTPBinding;
import org.jboss.util.NotImplementedException;
import org.jboss.ws.core.CommonBindingProvider;
@@ -63,13 +64,15 @@
protected void initBinding(String bindingId, Type type)
{
super.initBinding(bindingId, type);
- if (binding == null)
+
+ if (HTTPBinding.HTTP_BINDING.equals(bindingId) == false)
{
- if (epMetaData != null && epMetaData.getServiceMode() == Mode.MESSAGE)
+ Mode serviceMode = (epMetaData != null ? epMetaData.getServiceMode() : null);
+ if (serviceMode == Mode.MESSAGE)
{
binding = new MessageBinding();
}
- else if (epMetaData != null && epMetaData.getServiceMode() == Mode.PAYLOAD)
+ else if (serviceMode == Mode.PAYLOAD)
{
binding = new PayloadBinding();
}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-04-03 21:36:00 UTC (rev 2752)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-04-04 10:08:31 UTC (rev 2753)
@@ -72,7 +72,7 @@
public DispatchImpl(ExecutorService executor, EndpointMetaData epMetaData, Class<T> type, Mode mode)
{
- this.bindingProvider = new BindingProviderImpl(epMetaData.getBindingId());
+ this.bindingProvider = new BindingProviderImpl(epMetaData);
this.epMetaData = epMetaData;
this.executor = executor;
this.type = type;
@@ -82,7 +82,7 @@
public DispatchImpl(ExecutorService executor, EndpointMetaData epMetaData, JAXBContext jbc, Mode mode)
{
- this.bindingProvider = new BindingProviderImpl(epMetaData.getBindingId());
+ this.bindingProvider = new BindingProviderImpl(epMetaData);
this.epMetaData = epMetaData;
this.executor = executor;
this.type = Object.class;
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 21:36:00 UTC (rev 2752)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java 2007-04-04 10:08:31 UTC (rev 2753)
@@ -142,14 +142,13 @@
{
soapBody.setSource(source);
}
- // The body payload has been modified
- soapBody.setModifiedFromSource(true);
}
else if (message instanceof HTTPMessageImpl)
{
HTTPMessageImpl httpMessage = (HTTPMessageImpl)message;
httpMessage.setXmlFragment(new XMLFragment(source));
}
+ message.setModified(true);
}
public Object getPayload(JAXBContext jaxbContext)
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 21:36:00 UTC (rev 2752)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-04-04 10:08:31 UTC (rev 2753)
@@ -37,7 +37,6 @@
import javax.xml.soap.SOAPBodyElement;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPMessage;
import javax.xml.ws.http.HTTPBinding;
import org.jboss.logging.Logger;
@@ -56,7 +55,6 @@
import org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS;
import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.SOAPBodyImpl;
import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.extensions.xop.XOPContext;
@@ -198,15 +196,10 @@
try
{
// Check if protocol handlers modified the payload
- if (reqMessage instanceof SOAPMessage)
+ if (reqMessage.isModified())
{
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)reqMessage;
- SOAPBodyImpl soapBody = (SOAPBodyImpl)soapMessage.getSOAPBody();
- if (soapBody.isModifiedFromSource())
- {
- log.debug("Handler modified body payload, unbind message again");
- epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
- }
+ log.debug("Handler modified payload, unbind message again");
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
}
// Invoke the service endpoint
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java 2007-04-03 21:36:00 UTC (rev 2752)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java 2007-04-04 10:08:31 UTC (rev 2753)
@@ -43,7 +43,7 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.HTTPMessageImpl;
import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.MessageTracer;
+import org.jboss.ws.core.MessageTrace;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
@@ -201,7 +201,7 @@
msgContext.setMessageAbstraction(reqMessage);
// debug the incomming message
- MessageTracer.traceMessage("Incoming Request Message", reqMessage);
+ MessageTrace.traceMessage("Incoming Request Message", reqMessage);
// Set the thread context class loader
ClassLoader classLoader = sepMetaData.getClassLoader();
@@ -278,7 +278,7 @@
}
// debug the outgoing message
- MessageTracer.traceMessage("Outgoing Response Message", resMessage);
+ MessageTrace.traceMessage("Outgoing Response Message", resMessage);
}
catch (Exception ex)
{
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPBodyImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPBodyImpl.java 2007-04-03 21:36:00 UTC (rev 2752)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPBodyImpl.java 2007-04-04 10:08:31 UTC (rev 2753)
@@ -68,7 +68,6 @@
// Generic JAXWS payload
private XMLFragment xmlFragment;
private boolean isDOMValid = true;
- private boolean isModifiedFromSource;
public SOAPBodyImpl(String prefix, String namespace)
{
@@ -80,16 +79,6 @@
return isDOMValid;
}
- public boolean isModifiedFromSource()
- {
- return isModifiedFromSource;
- }
-
- public void setModifiedFromSource(boolean isModified)
- {
- this.isModifiedFromSource = isModified;
- }
-
public Source getSource()
{
Source source;
@@ -372,7 +361,8 @@
}
finally
{
- isModifiedFromSource = true;
+ // Mark the message as modified
+
log.trace("END expandToDOM");
}
}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2007-04-03 21:36:00 UTC (rev 2752)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2007-04-04 10:08:31 UTC (rev 2753)
@@ -69,6 +69,7 @@
private boolean isXOPMessage;
private boolean isSWARefMessage;
private SOAPPartImpl soapPart;
+ private boolean modified;
private MultipartRelatedEncoder multipartRelatedEncoder;
// Cache the associated operation meta data
@@ -505,4 +506,14 @@
while (attachmentItr.next() != null)
attachmentItr.remove();
}
+
+ public boolean isModified()
+ {
+ return modified;
+ }
+
+ public void setModified(boolean modifiedInHandler)
+ {
+ this.modified = modifiedInHandler;
+ }
}
Modified: branches/tdiesler/trunk/jbossws-tests/build.xml
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/build.xml 2007-04-03 21:36:00 UTC (rev 2752)
+++ branches/tdiesler/trunk/jbossws-tests/build.xml 2007-04-04 10:08:31 UTC (rev 2753)
@@ -474,7 +474,7 @@
<antcall target="tests-main">
<param name="include.wildcard" value="org/jboss/test/ws/tools/**/*TestCase.class"/>
<param name="exclude.wildcard" value="no-wildcard-exclude-see-excludesfile"/>
- <param name="haltonfailure" value="false"/>
+ <param name="haltonfailure" value="true"/>
</antcall>
<antcall target="tests-report"/>
</target>
@@ -487,7 +487,7 @@
<antcall target="tests-main">
<param name="include.wildcard" value="org/jboss/test/ws/${test}/**/*TestCase.class"/>
<param name="exclude.wildcard" value="no-wildcard-exclude-see-excludesfile"/>
- <param name="haltonfailure" value="false"/>
+ <param name="haltonfailure" value="true"/>
</antcall>
</target>
Modified: branches/tdiesler/trunk/jbossws-tests/src/etc/log4j.xml
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/etc/log4j.xml 2007-04-03 21:36:00 UTC (rev 2752)
+++ branches/tdiesler/trunk/jbossws-tests/src/etc/log4j.xml 2007-04-04 10:08:31 UTC (rev 2753)
@@ -56,6 +56,10 @@
<priority value="DEBUG"/>
</category>
+ <category name="org.jboss.ws.core.MessageTrace">
+ <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+ </category>
+
<category name="org.jboss.remoting">
<priority value="INFO"/>
</category>
@@ -65,11 +69,6 @@
<priority value="INFO"/>
</category>
- <!-- Enable SOAP message tracing -->
- <category name="jbossws.SOAPMessage">
- <priority value="TRACE" class="org.jboss.logging.XLevel"/>
- </category>
-
<!--
<category name="org.jboss.xb">
<priority value="TRACE" class="org.jboss.logging.XLevel"/>
Modified: branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/JBossWSTest.java
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/JBossWSTest.java 2007-04-03 21:36:00 UTC (rev 2752)
+++ branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/JBossWSTest.java 2007-04-04 10:08:31 UTC (rev 2753)
@@ -30,7 +30,9 @@
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
@@ -151,9 +153,12 @@
public Element getElementFromSource(Source retObj) throws TransformerException
{
+ TransformerFactory tf = TransformerFactory.newInstance();
+ Transformer transformer = tf.newTransformer();
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+
DOMResult domResult = new DOMResult();
- TransformerFactory tf = TransformerFactory.newInstance();
- tf.newTransformer().transform(retObj, domResult);
+ transformer.transform(retObj, domResult);
Document doc = (Document)domResult.getNode();
Element docElement = doc.getDocumentElement();
return docElement;
17 years
JBossWS SVN: r2752 - in branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws: core/jaxrpc and 4 other directories.
by jbossws-commits@lists.jboss.org
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());
17 years
JBossWS SVN: r2751 - in trunk: jbossws-tests/src/java/org/jboss/test/ws/common/soap and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-04-03 12:36:52 -0400 (Tue, 03 Apr 2007)
New Revision: 2751
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/XMLFragment.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/XMLFragmentTestCase.java
Log:
Skip processing instructions in xml fragments
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/XMLFragment.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/XMLFragment.java 2007-04-03 16:28:03 UTC (rev 2750)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/XMLFragment.java 2007-04-03 16:36:52 UTC (rev 2751)
@@ -67,6 +67,8 @@
private Source source;
+ private final static String XML_PROC = "<?xml";
+
// An exception that is created when a client
// accesses a StreamSource that can only be read once
private RuntimeException streamSourceAccessMarker;
@@ -148,7 +150,10 @@
public void writeTo(OutputStream out) throws IOException
{
- writeSourceInternal(new PrintWriter(out));
+ PrintWriter printWriter = new PrintWriter(out);
+ writeSourceInternal(printWriter);
+ printWriter.flush();
+ printWriter.close();
}
/**
@@ -170,18 +175,45 @@
StreamSource streamSource = (StreamSource)source;
Reader reader = streamSource.getReader();
+ {
if (reader == null)
reader = new InputStreamReader(streamSource.getInputStream());
+ }
- char[] cbuf = new char[1024];
+ char[] cbuf = new char[5];
int r = reader.read(cbuf);
+ int xmlProc = -1;
if (r == -1)
throw new IOException("StreamSource already exhausted");
while (r > 0)
{
- writer.write(cbuf, 0, r);
+ if(xmlProc<0 && new String(cbuf).equals(XML_PROC)) // new fragment
+ {
+ xmlProc = 0;
+ }
+ else if(xmlProc<0) // no processing instruction
+ {
+ xmlProc = 1;
+ }
+ else if(xmlProc==0) // within processing instruction
+ {
+ String tmp = new String(cbuf);
+ int i = tmp.indexOf(">");
+ if(i!=-1)
+ {
+ if(i<tmp.length()) writer.write(tmp.substring(i+1));
+ xmlProc=1;
+ r = reader.read(cbuf);
+ continue;
+ }
+
+ }
+
+ // regular contents
+ if(xmlProc>0)
+ writer.write(cbuf, 0, r);
r = reader.read(cbuf);
}
}
@@ -200,8 +232,12 @@
private Source beginSourceAccess(Source source)
{
+
+ if(source instanceof BufferedStreamSource)
+ return source; // no need to buffer those
+
// Buffer the source content
- if (source instanceof StreamSource && !(source instanceof BufferedStreamSource))
+ if (source instanceof StreamSource)
{
source = new BufferedStreamSource((StreamSource)source);
}
Modified: trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/XMLFragmentTestCase.java
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/XMLFragmentTestCase.java 2007-04-03 16:28:03 UTC (rev 2750)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/XMLFragmentTestCase.java 2007-04-03 16:36:52 UTC (rev 2751)
@@ -40,6 +40,10 @@
public static String XML_STRING = "<parent><child/></parent>";
+ public static String JAXB_FRAGMENT = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
+ "<ns2:sayHelloResponse xmlns:ns2=\"http://hello.org/wsdl\">\n" +
+ "<return>WSEjbWebServiceProvider-SayHello</return></ns2:sayHelloResponse>";
+
public void testDOMSourceFragment() throws Exception
{
Element srcElement = DOMUtils.parse(XML_STRING);
@@ -60,4 +64,36 @@
xmlFragment.writeTo(writer);
assertEquals(XML_STRING, new String(bout.toByteArray()));
}
+
+ public void testJAXBFragments() throws Exception
+ {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ PrintWriter writer = new PrintWriter( bout);
+
+ XMLFragment fragment = new XMLFragment(JAXB_FRAGMENT);
+ fragment.writeTo(writer);
+ writer.flush();
+
+ String s = bout.toString();
+ //System.out.println(s);
+
+ assertTrue("Empty result returned", s.length()>0);
+ assertFalse("Should not contain processing instruction", s.startsWith("<?xml"));
+ }
+
+ public void testJAXBFragments2() throws Exception
+ {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ PrintWriter writer = new PrintWriter( bout);
+
+ XMLFragment fragment = new XMLFragment(XML_STRING);
+ fragment.writeTo(writer);
+ writer.flush();
+
+ String s = bout.toString();
+
+ assertTrue("Empty result returned", s.length()>0);
+ assertFalse("Should not contain processing instruction", s.startsWith("<?xml"));
+ assertEquals(XML_STRING, s);
+ }
}
17 years
JBossWS SVN: r2750 - trunk/jbossws-core/src/java/org/jboss/ws/core/server.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-04-03 12:28:03 -0400 (Tue, 03 Apr 2007)
New Revision: 2750
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java
Log:
Typo
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java 2007-04-03 14:54:13 UTC (rev 2749)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java 2007-04-03 16:28:03 UTC (rev 2750)
@@ -282,7 +282,7 @@
}
catch (Exception ex)
{
- throw new JAXRPCException("Faild to post process response message", ex);
+ throw new JAXRPCException("Failed to post process response message", ex);
}
}
17 years
JBossWS SVN: r2749 - in branches/tdiesler/trunk: integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms and 18 other directories.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-04-03 10:54:13 -0400 (Tue, 03 Apr 2007)
New Revision: 2749
Added:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBinding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
Removed:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java
Modified:
branches/tdiesler/trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java
branches/tdiesler/trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java
branches/tdiesler/trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonMessageContext.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP11Binding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP12Binding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.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/jaxrpc/SOAPFaultHelperJAXRPC.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.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/client/DispatchImpl.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/server/AbstractServiceEndpointInvoker.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/eventing/mgmt/Subscription.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/xop/XOPContext.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/SOAPFaultTestCase.java
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java
Log:
Partial commit
Modified: branches/tdiesler/trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java
===================================================================
--- branches/tdiesler/trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -33,7 +33,9 @@
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
Modified: branches/tdiesler/trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java
===================================================================
--- branches/tdiesler/trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -36,6 +36,7 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.server.ServiceEndpoint;
import org.jboss.ws.core.server.ServiceEndpointInvoker;
@@ -90,7 +91,7 @@
// Process the request message and return the already serialized response
// Legacy implementations of the JMSTransportSupport dont provide a msg
// context which is needed for serialization.
- resMessage = sep.handleRequest(null, null, reqMessage);
+ resMessage = (SOAPMessage)sep.processRequest(null, null, reqMessage);
resMessage.writeTo(new ByteArrayOutputStream());
return resMessage;
}
Modified: branches/tdiesler/trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java
===================================================================
--- branches/tdiesler/trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -33,6 +33,7 @@
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
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-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -26,6 +26,7 @@
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;
@@ -40,19 +41,19 @@
public interface CommonBinding
{
/** On the client side, generate the Object from IN parameters. */
- Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
+ MessageAbstraction bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
/** On the server side, extract the IN parameters from the Object and populate an Invocation object */
- EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object reqMessage) throws BindingException;
+ EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, MessageAbstraction reqMessage) throws BindingException;
/** On the server side, generate the Object from OUT parameters in the Invocation object. */
- Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException;
+ MessageAbstraction bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException;
/** On the client side, extract the OUT parameters from the Object and return them to the client. */
- void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
+ void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
/** bind an exception to a fault message */
- Object bindFaultMessage(Exception ex);
+ MessageAbstraction bindFaultMessage(Exception ex);
void setHeaderSource(HeaderSource source);
}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -47,11 +47,11 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.DirectionHolder.Direction;
import org.jboss.ws.core.client.EndpointInfo;
-import org.jboss.ws.core.client.SOAPConnectionImpl;
import org.jboss.ws.core.jaxrpc.ParameterWrapping;
import org.jboss.ws.core.jaxrpc.Style;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.SOAPBodyImpl;
+import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.core.utils.HolderUtils;
import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
@@ -361,7 +361,7 @@
if (handlerPass)
{
// unbind the return values
- SOAPMessage resMessage = msgContext.getSOAPMessage();
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
binding.unbindResponseMessage(opMetaData, resMessage, epInv, unboundHeaders);
}
@@ -374,7 +374,7 @@
if (((SOAPBodyImpl)reqMessage.getSOAPBody()).isModifiedFromSource())
{
log.debug("Handler modified body payload, unbind message again");
- SOAPMessage resMessage = msgContext.getSOAPMessage();
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
binding.unbindResponseMessage(opMetaData, resMessage, epInv, unboundHeaders);
}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonMessageContext.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonMessageContext.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonMessageContext.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -35,6 +35,7 @@
import org.jboss.logging.Logger;
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.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.xb.binding.NamespaceRegistry;
@@ -61,8 +62,8 @@
private EndpointMetaData epMetaData;
// The operation for this message ctx
private OperationMetaData opMetaData;
- // The SOAPMessage in this message context
- private SOAPMessage soapMessage;
+ // The Message in this message context
+ private MessageAbstraction message;
// The map of scoped properties
protected Map<String, ScopedProperty> scopedProps = new HashMap<String, ScopedProperty>();
// The current property scope
@@ -77,7 +78,7 @@
{
this.epMetaData = msgContext.epMetaData;
this.opMetaData = msgContext.opMetaData;
- this.soapMessage = msgContext.soapMessage;
+ this.message = msgContext.message;
this.serContext = msgContext.serContext;
this.scopedProps = new HashMap<String, ScopedProperty>(msgContext.scopedProps);
this.currentScope = msgContext.currentScope;
@@ -118,14 +119,24 @@
public SOAPMessage getSOAPMessage()
{
- return soapMessage;
+ return (SOAPMessage)message;
}
public void setSOAPMessage(SOAPMessage soapMessage)
{
- this.soapMessage = soapMessage;
+ this.message = (MessageAbstraction)soapMessage;
}
+ public MessageAbstraction getMessageAbstraction()
+ {
+ return message;
+ }
+
+ public void setMessageAbstraction(MessageAbstraction message)
+ {
+ this.message = message;
+ }
+
public SerializationContext getSerializationContext()
{
if (serContext == null)
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP11Binding.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP11Binding.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP11Binding.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -35,6 +35,7 @@
import org.jboss.ws.core.jaxrpc.Use;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.SOAPFaultImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
@@ -50,11 +51,11 @@
}
/** Create the SOAP-1.1 message */
- protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException
+ protected MessageAbstraction createMessage(OperationMetaData opMetaData) throws SOAPException
{
MessageFactoryImpl factory = new MessageFactoryImpl();
factory.setEnvNamespace(Constants.NS_SOAP11_ENV);
- SOAPMessage soapMessage = factory.createMessage();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage();
Use encStyle = opMetaData.getEndpointMetaData().getEncodingStyle();
if (Use.ENCODED.equals(encStyle))
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP12Binding.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP12Binding.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP12Binding.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -52,11 +52,11 @@
}
/** Create the SOAP-1.1 message */
- protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException
+ protected MessageAbstraction createMessage(OperationMetaData opMetaData) throws SOAPException
{
MessageFactoryImpl factory = new MessageFactoryImpl();
factory.setEnvNamespace(Constants.NS_SOAP12_ENV);
- return factory.createMessage();
+ return (MessageAbstraction)factory.createMessage();
}
protected abstract Set<String> getRoles();
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -129,11 +129,11 @@
this.mtomEnabled = flag;
}
- /** Create the SOAP-1.1 message */
- protected abstract SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException;
+ /** Create the message */
+ protected abstract MessageAbstraction createMessage(OperationMetaData opMetaData) throws SOAPException;
/** On the client side, generate the payload from IN parameters. */
- public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ public MessageAbstraction bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
{
if (log.isDebugEnabled())
log.debug("bindRequestMessage: " + opMetaData.getQName());
@@ -250,7 +250,7 @@
public abstract void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage);
/** On the server side, extract the IN parameters from the payload and populate an Invocation object */
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object payload) throws BindingException
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, MessageAbstraction payload) throws BindingException
{
if (log.isDebugEnabled())
log.debug("unbindRequestMessage: " + opMetaData.getQName());
@@ -346,7 +346,7 @@
}
/** On the server side, generate the payload from OUT parameters. */
- public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
+ public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
{
if (log.isDebugEnabled())
log.debug("bindResponseMessage: " + opMetaData.getQName());
@@ -475,7 +475,7 @@
}
/** On the client side, extract the OUT parameters from the payload and return them to the client. */
- public void unbindResponseMessage(OperationMetaData opMetaData, Object payload, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction payload, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
throws BindingException
{
if (log.isDebugEnabled())
@@ -610,9 +610,9 @@
}
}
- public Object bindFaultMessage(Exception ex)
+ public MessageAbstraction bindFaultMessage(Exception ex)
{
- SOAPMessage faultMessage = createFaultMessageFromException(ex);
+ SOAPMessageImpl faultMessage = (SOAPMessageImpl)createFaultMessageFromException(ex);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext != null)
{
Added: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -0,0 +1,106 @@
+/*
+ * 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.core;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.xml.soap.MimeHeaders;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+import org.jboss.ws.core.soap.XMLFragment;
+import org.jboss.ws.core.soap.attachment.MimeConstants;
+
+/**
+ * A generic HTTP message
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Apr-2007
+ */
+public class HTTPMessageImpl implements HTTPMessageAbstraction
+{
+ private MimeHeaders mimeHeaders;
+ private XMLFragment xmlFragment;
+
+ public HTTPMessageImpl(MimeHeaders mimeHeaders, InputStream inputStream)
+ {
+ this.mimeHeaders = mimeHeaders;
+ this.xmlFragment = new XMLFragment(new StreamSource(inputStream));
+ }
+
+ public HTTPMessageImpl(Source source)
+ {
+ this.mimeHeaders = new MimeHeaders();
+ this.xmlFragment = new XMLFragment(source);
+
+ initDefaultMimeHeaders();
+ }
+
+ public HTTPMessageImpl(Result result)
+ {
+ this.mimeHeaders = new MimeHeaders();
+ this.xmlFragment = new XMLFragment(result);
+
+ initDefaultMimeHeaders();
+ }
+
+ private void initDefaultMimeHeaders()
+ {
+ mimeHeaders.setHeader(MimeConstants.CONTENT_TYPE, MimeConstants.TYPE_XML_UTF8);
+ }
+
+ public XMLFragment getXmlFragment()
+ {
+ return xmlFragment;
+ }
+
+ public void setXmlFragment(XMLFragment xmlFragment)
+ {
+ this.xmlFragment = xmlFragment;
+ }
+
+ public MimeHeaders getMimeHeaders()
+ {
+ if (mimeHeaders == null)
+ mimeHeaders = new MimeHeaders();
+
+ return mimeHeaders;
+ }
+
+ public void setMimeHeaders(MimeHeaders mimeHeaders)
+ {
+ this.mimeHeaders = mimeHeaders;
+ }
+
+ public void writeTo(OutputStream outputStream) throws IOException
+ {
+ xmlFragment.writeTo(outputStream);
+ }
+
+ public boolean isFaultMessage()
+ {
+ return false;
+ }
+}
Property changes on: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -21,6 +21,9 @@
*/
package org.jboss.ws.core;
+import java.io.IOException;
+import java.io.OutputStream;
+
import javax.xml.soap.MimeHeaders;
/**
@@ -32,4 +35,8 @@
public interface MessageAbstraction
{
MimeHeaders getMimeHeaders();
+
+ void writeTo(OutputStream outputStream) throws IOException;
+
+ boolean isFaultMessage();
}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -8,10 +8,15 @@
import org.jboss.ws.core.soap.SOAPElementImpl;
import org.jboss.ws.core.soap.SOAPElementWriter;
-public class MessageTracer
+public final class MessageTracer
{
private static Logger msgLog = Logger.getLogger("jbossws.SOAPMessage");
+ // Hide ctor
+ private MessageTracer()
+ {
+ }
+
public static void traceMessage(String string, MessageAbstraction message)
{
if (msgLog.isTraceEnabled())
@@ -20,19 +25,21 @@
{
try
{
- SOAPEnvelope soapReqEnv = ((SOAPMessage)message).getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapReqEnv, true);
- msgLog.trace(string + "\n" + envStr);
+ SOAPEnvelope soapEnv = ((SOAPMessage)message).getSOAPPart().getEnvelope();
+ if (soapEnv != null)
+ {
+ String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, true);
+ msgLog.trace(string + "\n" + envStr);
+ }
}
- catch (SOAPException e)
+ catch (SOAPException ex)
{
- // TODO Auto-generated catch block
- e.printStackTrace();
+ msgLog.error("Cannot trace SOAPMessage", ex);
}
}
else
{
- msgLog.trace("Unsupported message type: " + message);
+ msgLog.warn("Unsupported message type: " + message);
}
}
}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -25,9 +25,8 @@
import org.jboss.remoting.marshal.Marshaller;
import org.jboss.remoting.marshal.UnMarshaller;
-import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.soap.SOAPMessageMarshaller;
-import org.jboss.ws.core.soap.SOAPMessageUnMarshaller;
+import org.jboss.ws.core.jaxws.binding.HTTPMessageMarshaller;
+import org.jboss.ws.core.jaxws.binding.HTTPMessageUnMarshaller;
/**
* @since 02-Apr-2007
@@ -36,17 +35,11 @@
{
protected UnMarshaller getUnmarshaller()
{
- return new SOAPMessageUnMarshaller();
+ return new HTTPMessageUnMarshaller();
}
protected Marshaller getMarshaller()
{
- return new SOAPMessageMarshaller();
+ return new HTTPMessageMarshaller();
}
-
- public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway)
- {
- // TODO Auto-generated method stub
- return null;
- }
}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -21,6 +21,7 @@
*/
package org.jboss.ws.core.client;
+
import java.io.IOException;
import org.jboss.ws.core.MessageAbstraction;
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -115,7 +115,7 @@
*
* A null reqMessage signifies a HTTP GET request.
*/
- protected MessageAbstraction invokeInternal(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException
+ public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException
{
if (endpoint == null)
throw new IllegalArgumentException("Given endpoint cannot be null");
@@ -216,7 +216,7 @@
{
// Get the invoker from Remoting for a given endpoint address
log.debug("Get locator for: " + endpoint);
- targetAddress = addURLParameter(targetAddress, InvokerLocator.DATATYPE, "SOAPMessage");
+ targetAddress = addURLParameter(targetAddress, InvokerLocator.DATATYPE, "JBossWSMessage");
InvokerLocator locator = new InvokerLocator(targetAddress);
/* An HTTPClientInvoker may disconnect from the server and recreated by the remoting layer.
@@ -228,9 +228,9 @@
*/
Marshaller marshaller = getMarshaller();
UnMarshaller unmarshaller = getUnmarshaller();
- MarshalFactory.addMarshaller("SOAPMessage", marshaller, unmarshaller);
+ MarshalFactory.addMarshaller("JBossWSMessage", marshaller, unmarshaller);
- client = new Client(locator, "saaj", clientConfig);
+ client = new Client(locator, "jbossws", clientConfig);
client.connect();
client.setMarshaller(marshaller);
@@ -263,8 +263,13 @@
metadata.put("NoThrowOnError", "true");
if (reqMessage != null)
+ {
populateHeaders(reqMessage, metadata);
- else metadata.put("TYPE", "GET");
+ }
+ else
+ {
+ metadata.put("TYPE", "GET");
+ }
if (callProps != null)
{
@@ -314,34 +319,10 @@
return metadata;
}
- private void populateHeaders(MessageAbstraction reqMessage, Map<String, Object> metadata)
+ protected void populateHeaders(MessageAbstraction reqMessage, Map<String, Object> metadata)
{
- // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
- // with a quoted value equal to the value of the soapAction attribute of
- // soapbind:operation, if present in the corresponding WSDL description.
-
- // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
- // with a quoted empty string value, if in the corresponding WSDL description,
- // the soapAction attribute of soapbind:operation is either not present, or
- // present with an empty string as its value.
-
MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
- String[] action = mimeHeaders.getHeader("SOAPAction");
- if (action != null && action.length > 0)
- {
- String soapAction = action[0];
-
- // R1109 The value of the SOAPAction HTTP header field in a HTTP request MESSAGE MUST be a quoted string.
- if (soapAction.startsWith("\"") == false || soapAction.endsWith("\"") == false)
- soapAction = "\"" + soapAction + "\"";
-
- mimeHeaders.setHeader("SOAPAction", soapAction);
- }
- else
- {
- mimeHeaders.setHeader("SOAPAction", "\"\"");
- }
-
+
Properties props = new Properties();
metadata.put("HEADER", props);
Deleted: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -1,121 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.core.client;
-
-// $Id$
-
-import java.io.IOException;
-
-import javax.xml.soap.SOAPConnection;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
-import org.jboss.ws.extensions.xop.XOPContext;
-
-/**
- * SOAPConnection implementation
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason@stacksmash.com">Jason T. Greene</a>
- *
- * @since 02-Feb-2005
- */
-public class SOAPConnectionImpl extends SOAPConnection
-{
- // provide logging
- private static Logger log = Logger.getLogger(SOAPConnectionImpl.class);
-
- private RemotingConnectionImpl remotingConnection;
-
- public SOAPConnectionImpl()
- {
- remotingConnection = new SOAPRemotingConnection();
- }
-
- /**
- * Sends the given message to the specified endpoint and blocks until it has
- * returned the response.
- */
- public SOAPMessage call(SOAPMessage reqMessage, Object endpoint) throws SOAPException
- {
- if (reqMessage == null)
- throw new IllegalArgumentException("Given SOAPMessage cannot be null");
-
- MessageAbstraction resMessage = callInternal(reqMessage, endpoint, false);
- return (SOAPMessage)resMessage;
- }
-
- /**
- * Sends an HTTP GET request to an endpoint and blocks until a SOAP message is received
- */
- public SOAPMessage get(Object endpoint) throws SOAPException
- {
- MessageAbstraction resMessage = callInternal(null, endpoint, false);
- return (SOAPMessage)resMessage;
- }
-
- /**
- * Sends the given message to the specified endpoint. This method is logically
- * non blocking.
- */
- public SOAPMessage callOneWay(SOAPMessage reqMessage, Object endpoint) throws SOAPException
- {
- if (reqMessage == null)
- throw new IllegalArgumentException("Given SOAPMessage cannot be null");
-
- MessageAbstraction resMessage = callInternal((SOAPMessageImpl)reqMessage, endpoint, true);
- return (SOAPMessage)resMessage;
- }
-
- /** Closes this SOAPConnection
- */
- public void close() throws SOAPException
- {
- if (remotingConnection.isClosed())
- throw new SOAPException("SOAPConnection is already closed");
-
- remotingConnection.setClosed(true);
- }
-
- private MessageAbstraction callInternal(SOAPMessage reqMessage, Object endpoint, boolean oneway) throws SOAPException
- {
- MessageAbstraction resMessage;
- try
- {
- resMessage = remotingConnection.invoke((SOAPMessageImpl)reqMessage, endpoint, oneway);
- }
- catch (IOException ex)
- {
- Throwable cause = ex.getCause();
- if (cause instanceof SOAPException)
- {
- throw (SOAPException)cause;
- }
- }
- return resMessage;
- }
-
-}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -24,17 +24,19 @@
// $Id$
import java.io.IOException;
-import java.net.SocketTimeoutException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
-import org.jboss.logging.Logger;
import org.jboss.remoting.marshal.Marshaller;
import org.jboss.remoting.marshal.UnMarshaller;
import org.jboss.ws.WSException;
import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.WSTimeoutException;
import org.jboss.ws.core.soap.SOAPMessageMarshaller;
import org.jboss.ws.core.soap.SOAPMessageUnMarshaller;
import org.jboss.ws.extensions.xop.XOPContext;
@@ -59,7 +61,7 @@
return new SOAPMessageMarshaller();
}
- public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException
+ public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException
{
try
{
@@ -72,24 +74,47 @@
if (reqMessage != null && soapMessage.saveRequired())
soapMessage.saveChanges();
- return invokeInternal(reqMessage, endpoint, oneway);
+ return super.invoke(reqMessage, endpoint, oneway);
}
- catch (RuntimeException rte)
+ catch (SOAPException ex)
{
- Throwable cause = rte.getCause();
-
- // The CTS expects only SOAPException to be thrown.
- if (cause instanceof IOException && cause.getCause() instanceof SOAPException)
- {
-
- }
- throw new WSException((SOAPException)cause.getCause());
-
- else throw rte;
+ IOException io = new IOException();
+ io.initCause(ex);
+ throw io;
}
- catch (SOAPException ex)
+ }
+
+ protected void populateHeaders(MessageAbstraction reqMessage, Map<String, Object> metadata)
+ {
+ super.populateHeaders(reqMessage, metadata);
+
+ Properties props = (Properties)metadata.get("HEADER");
+
+ // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+ // with a quoted value equal to the value of the soapAction attribute of
+ // soapbind:operation, if present in the corresponding WSDL description.
+
+ // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+ // with a quoted empty string value, if in the corresponding WSDL description,
+ // the soapAction attribute of soapbind:operation is either not present, or
+ // present with an empty string as its value.
+
+ MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+ String[] action = mimeHeaders.getHeader("SOAPAction");
+ if (action != null && action.length > 0)
{
- throw new WSException(ex);
+ String soapAction = action[0];
+
+ // R1109 The value of the SOAPAction HTTP header field in a HTTP request MESSAGE MUST be a quoted string.
+ if (soapAction.startsWith("\"") == false || soapAction.endsWith("\"") == false)
+ soapAction = "\"" + soapAction + "\"";
+
+ props.put("SOAPAction", soapAction);
}
+ else
+ {
+ props.put("SOAPAction", "\"\"");
+ }
+
}
}
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-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -28,8 +28,8 @@
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.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
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-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -28,6 +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;
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -48,6 +48,7 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.jaxrpc.binding.DeserializerFactoryBase;
import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
@@ -59,6 +60,7 @@
import org.jboss.ws.core.soap.NameImpl;
import org.jboss.ws.core.soap.SOAPEnvelopeImpl;
import org.jboss.ws.core.soap.SOAPFactoryImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.XMLFragment;
import org.jboss.ws.metadata.umdm.FaultMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -171,7 +173,7 @@
/** Translate the request exception into a SOAPFault message.
*/
- public static SOAPMessage exceptionToFaultMessage(Exception reqEx)
+ public static SOAPMessageImpl exceptionToFaultMessage(Exception reqEx)
{
// Get or create the SOAPFaultException
SOAPFaultException faultEx;
@@ -192,7 +194,7 @@
try
{
- SOAPMessage faultMessage = toSOAPMessage(faultEx);
+ SOAPMessageImpl faultMessage = toSOAPMessage(faultEx);
return faultMessage;
}
catch (RuntimeException rte)
@@ -206,7 +208,7 @@
}
}
- private static SOAPMessage toSOAPMessage(SOAPFaultException faultEx) throws SOAPException
+ private static SOAPMessageImpl toSOAPMessage(SOAPFaultException faultEx) throws SOAPException
{
assertFaultCode(faultEx.getFaultCode());
@@ -215,7 +217,7 @@
NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage soapMessage = factory.createMessage();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage();
SOAPEnvelopeImpl soapEnvelope = (SOAPEnvelopeImpl)soapMessage.getSOAPPart().getEnvelope();
SOAPBody soapBody = soapEnvelope.getBody();
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -284,7 +284,7 @@
if (log.isTraceEnabled())
{
- SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ SOAPPart soapPart = jaxrpcContext.getSOAPMessage().getSOAPPart();
lastMessageTrace = traceSOAPPart("BEFORE handleRequest - " + currHandler, soapPart, lastMessageTrace);
}
@@ -292,7 +292,7 @@
if (log.isTraceEnabled())
{
- SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ SOAPPart soapPart = jaxrpcContext.getSOAPMessage().getSOAPPart();
lastMessageTrace = traceSOAPPart("AFTER handleRequest - " + currHandler, soapPart, lastMessageTrace);
}
}
@@ -366,7 +366,7 @@
if (log.isTraceEnabled())
{
- SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ SOAPPart soapPart = jaxrpcContext.getSOAPMessage().getSOAPPart();
lastMessageTrace = traceSOAPPart("BEFORE handleResponse - " + currHandler, soapPart, lastMessageTrace);
}
@@ -374,7 +374,7 @@
if (log.isTraceEnabled())
{
- SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ SOAPPart soapPart = jaxrpcContext.getSOAPMessage().getSOAPPart();
lastMessageTrace = traceSOAPPart("AFTER handleResponse - " + currHandler, soapPart, lastMessageTrace);
}
}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -74,7 +74,7 @@
public void setMessage(SOAPMessage message)
{
- setSOAPMessage(message);
+ setMessage(message);
}
/** Create the serialization context
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -36,6 +36,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.jaxrpc.binding.DeserializerFactoryBase;
@@ -46,6 +47,7 @@
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.NameImpl;
import org.jboss.ws.core.soap.SOAPFactoryImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.XMLFragment;
import org.jboss.ws.metadata.umdm.FaultMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -140,13 +142,13 @@
}
/** Translate the request exception into a SOAPFault message. */
- public static SOAPMessage exceptionToFaultMessage(Exception reqEx)
+ public static SOAPMessageImpl exceptionToFaultMessage(Exception reqEx)
{
log.error("SOAP request exception", reqEx);
try
{
- SOAPMessage faultMessage;
+ SOAPMessageImpl faultMessage;
if (reqEx instanceof SOAPFaultException)
{
faultMessage = toSOAPMessage((SOAPFaultException)reqEx);
@@ -171,10 +173,10 @@
}
}
- private static SOAPMessage toSOAPMessage(SOAPFaultException faultEx) throws SOAPException
+ private static SOAPMessageImpl toSOAPMessage(SOAPFaultException faultEx) throws SOAPException
{
MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage soapMessage = factory.createMessage();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage();
SOAPBody soapBody = soapMessage.getSOAPBody();
populateSOAPFault(soapBody, faultEx);
@@ -227,10 +229,10 @@
targetFault.setFaultActor(faultActor);
}
- private static SOAPMessage toSOAPMessage(Exception ex) throws SOAPException
+ private static SOAPMessageImpl toSOAPMessage(Exception ex) throws SOAPException
{
MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage soapMessage = factory.createMessage();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage();
SOAPBody soapBody = soapMessage.getSOAPBody();
SOAPFault soapFault;
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-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -31,9 +31,11 @@
import javax.xml.ws.http.HTTPBinding;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.EndpointInvocation;
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.UnboundHeader;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -49,27 +51,27 @@
{
private BindingImpl delegate = new BindingImpl();
- public Object 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 Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
+ public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
{
throw new NotImplementedException();
}
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object reqMessage) throws BindingException
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, MessageAbstraction reqMessage) throws BindingException
{
throw new NotImplementedException();
}
- public void unbindResponseMessage(OperationMetaData opMetaData, Object 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();
}
- public Object bindFaultMessage(Exception ex)
+ public MessageAbstraction bindFaultMessage(Exception ex)
{
throw new NotImplementedException();
}
@@ -96,7 +98,7 @@
public String getBindingID()
{
- throw new NotImplementedException();
+ return Constants.HTTP_BINDING;
}
public void setHeaderSource(HeaderSource source)
Added: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -0,0 +1,80 @@
+/*
+ * 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.core.jaxws.binding;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.invocation.OnewayInvocation;
+import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.ws.core.HTTPMessageImpl;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.w3c.dom.Element;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Nov-2004
+ */
+public class HTTPMessageMarshaller implements Marshaller
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(HTTPMessageMarshaller.class);
+
+ /**
+ * Marshaller will need to take the dataObject and convert
+ * into primitive java data types and write to the
+ * given output.
+ *
+ * @param dataObject Object to be writen to output
+ * @param output The data output to write the object
+ * data to.
+ */
+ public void write(Object dataObject, OutputStream output) throws IOException
+ {
+ if (dataObject instanceof InvocationRequest)
+ dataObject = ((InvocationRequest)dataObject).getParameter();
+
+ if (dataObject instanceof OnewayInvocation)
+ dataObject = ((OnewayInvocation)dataObject).getParameters()[0];
+
+ if ((dataObject instanceof HTTPMessageImpl) == false)
+ throw new IllegalArgumentException("Not a HTTPMessage: " + dataObject);
+
+ HTTPMessageImpl httpMessage = (HTTPMessageImpl)dataObject;
+ Element root = httpMessage.getXmlFragment().toElement();
+
+ // debug the outgoing message
+ if (log.isTraceEnabled())
+ {
+ log.trace("Outgoing Message\n" + DOMWriter.printNode(root, true));
+ }
+
+ new DOMWriter(output).print(root);
+ }
+
+ public Marshaller cloneMarshaller() throws CloneNotSupportedException
+ {
+ return new HTTPMessageMarshaller();
+ }
+}
Property changes on: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -0,0 +1,114 @@
+/*
+ * 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.core.jaxws.binding;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.soap.MimeHeaders;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.transport.http.HTTPMetadataConstants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.HTTPMessageImpl;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Nov-2004
+ */
+public class HTTPMessageUnMarshaller implements UnMarshaller
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(HTTPMessageUnMarshaller.class);
+
+ private static List validResponseCodes = new ArrayList();
+ static
+ {
+ validResponseCodes.add(HttpServletResponse.SC_OK);
+ validResponseCodes.add(HttpServletResponse.SC_ACCEPTED);
+ validResponseCodes.add(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+
+ public Object read(InputStream inputStream, Map metadata) throws IOException, ClassNotFoundException
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("Read input stream with metadata=" + metadata);
+ }
+
+ Integer resCode = (Integer)metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
+ String resMessage = (String)metadata.get(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE);
+ if (resCode != null && validResponseCodes.contains(resCode) == false)
+ throw new WSException("Invalid HTTP server response [" + resCode + "] - " + resMessage);
+
+ MimeHeaders mimeHeaders = getMimeHeaders(metadata);
+ HTTPMessageImpl soapMsg = new HTTPMessageImpl(mimeHeaders, inputStream);
+ return soapMsg;
+ }
+
+ /**
+ * Set the class loader to use for unmarhsalling. This may
+ * be needed when need to have access to class definitions that
+ * are not part of this unmarshaller's parent classloader (especially
+ * when doing remote classloading).
+ *
+ * @param classloader
+ */
+ public void setClassLoader(ClassLoader classloader)
+ {
+ //NO OP
+ }
+
+ public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
+ {
+ return new HTTPMessageUnMarshaller();
+ }
+
+ private MimeHeaders getMimeHeaders(Map metadata)
+ {
+ log.debug("getMimeHeaders from: " + metadata);
+
+ MimeHeaders headers = new MimeHeaders();
+ Iterator i = metadata.keySet().iterator();
+ while (i.hasNext())
+ {
+ String key = (String)i.next();
+ Object value = metadata.get(key);
+ if (key != null && value instanceof List)
+ {
+ for (Object listValue : (List)value)
+ {
+ headers.addHeader(key, listValue.toString());
+ }
+ }
+ }
+ return headers;
+ }
+}
Property changes on: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
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-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -37,11 +37,13 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
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.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;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
@@ -61,13 +63,13 @@
private BindingImpl delegate = new BindingImpl();
/** On the client side, generate the payload from IN parameters. */
- public SOAPMessage 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();
}
/** On the server side, extract the IN parameters from the payload and populate an Invocation object */
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object reqMessage) throws BindingException
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, MessageAbstraction reqMessage) throws BindingException
{
if(log.isDebugEnabled()) log.debug("unbindRequestMessage: " + opMetaData.getQName());
@@ -94,7 +96,7 @@
}
/** On the server side, generate the payload from OUT parameters. */
- public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
+ public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
{
if(log.isDebugEnabled()) log.debug("bindResponseMessage: " + opMetaData.getQName());
@@ -105,8 +107,8 @@
throw new WSException("MessageContext not available");
// Associate current message with message context
- SOAPMessage resMessage = (SOAPMessage)epInv.getReturnValue();
- msgContext.setMessage(resMessage);
+ MessageAbstraction resMessage = (MessageAbstraction)epInv.getReturnValue();
+ msgContext.setMessageAbstraction(resMessage);
return resMessage;
}
@@ -118,15 +120,15 @@
}
/** On the client side, extract the OUT parameters from the payload and return them to the client. */
- public void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
throws BindingException
{
throw new NotImplementedException();
}
- public Object bindFaultMessage(Exception ex)
+ public MessageAbstraction bindFaultMessage(Exception ex)
{
- SOAPMessage faultMessage = SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
+ SOAPMessageImpl faultMessage = SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext != null)
{
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-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -39,6 +39,7 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
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.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
@@ -66,13 +67,13 @@
private BindingImpl delegate = new BindingImpl();
/** On the client side, generate the payload from IN parameters. */
- public Object 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();
}
/** On the server side, extract the IN parameters from the payload and populate an Invocation object */
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object payload) throws BindingException
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, MessageAbstraction payload) throws BindingException
{
if(log.isDebugEnabled()) log.debug("unbindRequestMessage: " + opMetaData.getQName());
@@ -107,7 +108,7 @@
}
/** On the server side, generate the payload from OUT parameters. */
- public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
+ public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
{
if(log.isDebugEnabled()) log.debug("bindResponseMessage: " + opMetaData.getQName());
@@ -121,7 +122,7 @@
MessageFactoryImpl factory = new MessageFactoryImpl();
factory.setEnvNamespace(Constants.NS_SOAP11_ENV);
SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage();
- msgContext.setMessage(resMessage);
+ msgContext.setSOAPMessage(resMessage);
Source payload = (Source)epInv.getReturnValue();
SOAPBodyImpl soapBody = (SOAPBodyImpl)resMessage.getSOAPBody();
@@ -137,15 +138,15 @@
}
/** On the client side, extract the OUT parameters from the payload and return them to the client. */
- public void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
throws BindingException
{
throw new NotImplementedException();
}
- public Object bindFaultMessage(Exception ex)
+ public MessageAbstraction bindFaultMessage(Exception ex)
{
- SOAPMessage faultMessage = SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
+ SOAPMessageImpl faultMessage = SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext != null)
{
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-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -38,6 +38,7 @@
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;
@@ -118,6 +119,6 @@
public String getBindingID()
{
- throw new NotImplementedException();
+ return Constants.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-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -34,7 +34,9 @@
import javax.xml.ws.soap.SOAPBinding;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonSOAP12Binding;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -120,6 +122,6 @@
public String getBindingID()
{
- throw new NotImplementedException();
+ return Constants.SOAP12HTTP_BINDING;
}
}
Copied: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java (from rev 2748, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java)
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.core.jaxws.client;
+
+// $Id$
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.HTTPMessageImpl;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.jaxrpc.binding.BufferedStreamResult;
+
+/**
+ * The Dispatch interface provides support for the dynamic invocation of a service endpoint operations.
+ * The javax.xml.ws.Service interface acts as a factory for the creation of Dispatch instances.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public class DispatchHTTPBinding
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(DispatchHTTPBinding.class);
+
+ private JAXBContext jaxbContext;
+ private Class type;
+ private Mode mode;
+
+ public DispatchHTTPBinding(Mode mode, Class type, JAXBContext jaxbContext)
+ {
+ this.mode = mode;
+ this.type = type;
+ this.jaxbContext = jaxbContext;
+ }
+
+ public MessageAbstraction getRequestMessage(Object obj)
+ {
+ HTTPMessageImpl reqMsg = null;
+ try
+ {
+ if (Source.class.isAssignableFrom(type))
+ {
+ Source source = (Source)obj;
+ reqMsg = new HTTPMessageImpl(source);
+ }
+ else if (jaxbContext != null)
+ {
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
+ BufferedStreamResult result = new BufferedStreamResult();
+ marshaller.marshal(obj, result);
+
+ reqMsg = new HTTPMessageImpl(result);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Cannot create request message", ex);
+ }
+
+ if (reqMsg == null)
+ throw new WebServiceException("Cannot create request message for: " + obj);
+
+ return reqMsg;
+ }
+
+ public Object getReturnObject(MessageAbstraction message)
+ {
+ HTTPMessageImpl resMsg = (HTTPMessageImpl)message;
+
+ Object retObj = null;
+ try
+ {
+ if (Source.class.isAssignableFrom(type))
+ {
+ retObj = resMsg.getXmlFragment().getSource();
+ }
+ else if (jaxbContext != null)
+ {
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ Source source = resMsg.getXmlFragment().getSource();
+ retObj = unmarshaller.unmarshal(source);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Cannot process response message", ex);
+ }
+ return retObj;
+ }
+}
Deleted: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -1,65 +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.core.jaxws.client;
-
-// $Id$
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.ws.Service.Mode;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.core.MessageAbstraction;
-
-/**
- * The Dispatch interface provides support for the dynamic invocation of a service endpoint operations.
- * The javax.xml.ws.Service interface acts as a factory for the creation of Dispatch instances.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Jul-2006
- */
-public class DispatchHTTPBindingHelper
-{
- // provide logging
- private final Logger log = Logger.getLogger(DispatchHTTPBindingHelper.class);
-
- private JAXBContext jaxbContext;
- private Class type;
- private Mode mode;
-
- public DispatchHTTPBindingHelper(Mode mode, Class type, JAXBContext jaxbContext)
- {
- this.mode = mode;
- this.type = type;
- this.jaxbContext = jaxbContext;
- }
-
- public MessageAbstraction getRequestMessage(Object obj)
- {
- throw new NotImplementedException();
- }
-
- public Object getReturnObject(MessageAbstraction message)
- {
- throw new NotImplementedException();
- }
-}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -23,12 +23,12 @@
// $Id$
+import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import javax.xml.bind.JAXBContext;
-import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
import javax.xml.ws.AsyncHandler;
@@ -45,11 +45,10 @@
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.client.HTTPRemotingConnection;
import org.jboss.ws.core.client.RemotingConnection;
-import org.jboss.ws.core.client.SOAPConnectionImpl;
import org.jboss.ws.core.client.SOAPRemotingConnection;
import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
/**
@@ -106,11 +105,11 @@
return retObj;
}
- private Object invokeInternal(Object obj, Map<String, Object> resContext) throws SOAPException
+ private Object invokeInternal(Object obj, Map<String, Object> resContext) throws IOException
{
MessageAbstraction reqMsg = getRequestMessage(obj);
String targetAddress = epMetaData.getEndpointAddress();
- MessageAbstraction resMsg = getRemotingConnection().invoke(reqMsg, targetAddress);
+ MessageAbstraction resMsg = getRemotingConnection().invoke(reqMsg, targetAddress, false);
Object retObj = getReturnObject(resMsg);
return retObj;
}
@@ -124,7 +123,7 @@
RemotingConnection remotingConnection;
if (HTTPBinding.HTTP_BINDING.equals(bindingID))
{
- remotingConnection = new SOAPRemotingConnection();
+ remotingConnection = new HTTPRemotingConnection();
}
else
{
@@ -157,7 +156,7 @@
try
{
String targetAddress = epMetaData.getEndpointAddress();
- new SOAPConnectionImpl().callOneWay((SOAPMessage)reqMsg, targetAddress);
+ getRemotingConnection().invoke(reqMsg, targetAddress, true);
}
catch (Exception ex)
{
@@ -232,12 +231,12 @@
MessageAbstraction message;
if (HTTPBinding.HTTP_BINDING.equals(bindingID))
{
- DispatchHTTPBindingHelper helper = new DispatchHTTPBindingHelper(mode, type, jaxbContext);
+ DispatchHTTPBinding helper = new DispatchHTTPBinding(mode, type, jaxbContext);
message = helper.getRequestMessage(obj);
}
else
{
- DispatchSOAPBindingHelper helper = new DispatchSOAPBindingHelper(mode, type, jaxbContext);
+ DispatchSOAPBinding helper = new DispatchSOAPBinding(mode, type, jaxbContext);
message = helper.getRequestMessage(obj);
}
return message;
@@ -252,12 +251,12 @@
Object retObj = null;
if (HTTPBinding.HTTP_BINDING.equals(bindingID))
{
- DispatchHTTPBindingHelper helper = new DispatchHTTPBindingHelper(mode, type, jaxbContext);
+ DispatchHTTPBinding helper = new DispatchHTTPBinding(mode, type, jaxbContext);
retObj = helper.getReturnObject(resMsg);
}
else
{
- DispatchSOAPBindingHelper helper = new DispatchSOAPBindingHelper(mode, type, jaxbContext);
+ DispatchSOAPBinding helper = new DispatchSOAPBinding(mode, type, jaxbContext);
retObj = helper.getReturnObject(resMsg);
}
return retObj;
Copied: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBinding.java (from rev 2748, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java)
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBinding.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBinding.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -0,0 +1,175 @@
+/*
+ * 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.core.jaxws.client;
+
+// $Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.StringReader;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPMessage;
+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.transform.stream.StreamSource;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.soap.SOAPBodyImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.utils.DOMWriter;
+
+/**
+ * A helper that
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Apr-2007
+ */
+public class DispatchSOAPBinding
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(DispatchSOAPBinding.class);
+
+ private JAXBContext jaxbContext;
+ private Class type;
+ private Mode mode;
+
+ public DispatchSOAPBinding(Mode mode, Class type, JAXBContext jaxbContext)
+ {
+ this.mode = mode;
+ this.type = type;
+ this.jaxbContext = jaxbContext;
+ }
+
+ public MessageAbstraction getRequestMessage(Object obj)
+ {
+ SOAPMessageImpl reqMsg = null;
+ try
+ {
+ MessageFactory factory = MessageFactory.newInstance();
+ if (SOAPMessage.class.isAssignableFrom(type))
+ {
+ reqMsg = (SOAPMessageImpl)obj;
+ }
+ else if (Source.class.isAssignableFrom(type))
+ {
+ Source source = (Source)obj;
+ if (mode == Mode.PAYLOAD)
+ {
+ reqMsg = (SOAPMessageImpl)factory.createMessage();
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
+ soapBody.setSource(source);
+ }
+ if (mode == Mode.MESSAGE)
+ {
+ TransformerFactory tf = TransformerFactory.newInstance();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ tf.newTransformer().transform(source, new StreamResult(baos));
+ reqMsg = (SOAPMessageImpl)factory.createMessage(null, new ByteArrayInputStream(baos.toByteArray()));
+ }
+ }
+ else if (jaxbContext != null)
+ {
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ marshaller.marshal(obj, baos);
+
+ reqMsg = (SOAPMessageImpl)factory.createMessage();
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
+ StreamSource source = new StreamSource(new ByteArrayInputStream(baos.toByteArray()));
+ soapBody.setSource(source);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Cannot create request message", ex);
+ }
+
+ if (reqMsg == null)
+ throw new WebServiceException("Cannot create request message for: " + obj);
+
+ return reqMsg;
+ }
+
+ public Object getReturnObject(MessageAbstraction message)
+ {
+ SOAPMessage resMsg = (SOAPMessage)message;
+
+ Object retObj = null;
+ try
+ {
+ if (SOAPMessage.class.isAssignableFrom(type))
+ {
+ retObj = resMsg;
+ }
+ else if (Source.class.isAssignableFrom(type))
+ {
+ if (mode == Mode.PAYLOAD)
+ {
+ SOAPBody soapBody = resMsg.getSOAPBody();
+ SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
+ retObj = new DOMSource(soapElement);
+ }
+ if (mode == Mode.MESSAGE)
+ {
+ SOAPEnvelope soapEnvelope = resMsg.getSOAPPart().getEnvelope();
+ String xmlMessage = DOMWriter.printNode(soapEnvelope, false);
+ retObj = new StreamSource(new StringReader(xmlMessage));
+ }
+ }
+ else if (jaxbContext != null)
+ {
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();
+ SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
+
+ log.debug("JAXB unmarshal: " + DOMWriter.printNode(soapElement, false));
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ retObj = unmarshaller.unmarshal(soapElement);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Cannot process response message", ex);
+ }
+ return retObj;
+ }
+}
Deleted: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -1,175 +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.core.jaxws.client;
-
-// $Id$
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPMessage;
-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.transform.stream.StreamSource;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.Service.Mode;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.soap.SOAPBodyImpl;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
-import org.jboss.ws.core.utils.DOMWriter;
-
-/**
- * A helper that
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 02-Apr-2007
- */
-public class DispatchSOAPBindingHelper
-{
- // provide logging
- private final Logger log = Logger.getLogger(DispatchSOAPBindingHelper.class);
-
- private JAXBContext jaxbContext;
- private Class type;
- private Mode mode;
-
- public DispatchSOAPBindingHelper(Mode mode, Class type, JAXBContext jaxbContext)
- {
- this.mode = mode;
- this.type = type;
- this.jaxbContext = jaxbContext;
- }
-
- public MessageAbstraction getRequestMessage(Object obj)
- {
- SOAPMessageImpl reqMsg = null;
- try
- {
- MessageFactory factory = MessageFactory.newInstance();
- if (SOAPMessage.class.isAssignableFrom(type))
- {
- reqMsg = (SOAPMessageImpl)obj;
- }
- else if (Source.class.isAssignableFrom(type))
- {
- Source source = (Source)obj;
- if (mode == Mode.PAYLOAD)
- {
- reqMsg = (SOAPMessageImpl)factory.createMessage();
- SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
- soapBody.setSource(source);
- }
- if (mode == Mode.MESSAGE)
- {
- TransformerFactory tf = TransformerFactory.newInstance();
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- tf.newTransformer().transform(source, new StreamResult(baos));
- reqMsg = (SOAPMessageImpl)factory.createMessage(null, new ByteArrayInputStream(baos.toByteArray()));
- }
- }
- else if (jaxbContext != null)
- {
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- marshaller.marshal(obj, baos);
-
- reqMsg = (SOAPMessageImpl)factory.createMessage();
- SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
- StreamSource source = new StreamSource(new ByteArrayInputStream(baos.toByteArray()));
- soapBody.setSource(source);
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WebServiceException("Cannot create request message", ex);
- }
-
- if (reqMsg == null)
- throw new WebServiceException("Cannot create request message for: " + obj);
-
- return reqMsg;
- }
-
- public Object getReturnObject(MessageAbstraction message)
- {
- SOAPMessage resMsg = (SOAPMessage)message;
-
- Object retObj = null;
- try
- {
- if (SOAPMessage.class.isAssignableFrom(type))
- {
- retObj = resMsg;
- }
- else if (Source.class.isAssignableFrom(type))
- {
- if (mode == Mode.PAYLOAD)
- {
- SOAPBody soapBody = resMsg.getSOAPBody();
- SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
- retObj = new DOMSource(soapElement);
- }
- if (mode == Mode.MESSAGE)
- {
- SOAPEnvelope soapEnvelope = resMsg.getSOAPPart().getEnvelope();
- String xmlMessage = DOMWriter.printNode(soapEnvelope, false);
- retObj = new StreamSource(new StringReader(xmlMessage));
- }
- }
- else if (jaxbContext != null)
- {
- SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();
- SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
-
- log.debug("JAXB unmarshal: " + DOMWriter.printNode(soapElement, false));
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- retObj = unmarshaller.unmarshal(soapElement);
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WebServiceException("Cannot process response message", ex);
- }
- return retObj;
- }
-}
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-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageContextImpl.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -53,7 +53,7 @@
this.delegate = soapContext;
Style style = soapContext.getEndpointMetaData().getStyle();
- SOAPMessage soapMessage = soapContext.getMessage();
+ SOAPMessage soapMessage = soapContext.getSOAPMessage();
logicalMessage = new LogicalMessageImpl(soapMessage, style);
}
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-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -38,6 +38,7 @@
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.http.HTTPBinding;
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
@@ -47,6 +48,7 @@
import org.jboss.ws.core.CommonSOAPBinding;
import org.jboss.ws.core.DirectionHolder;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.DirectionHolder.Direction;
import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
@@ -128,11 +130,11 @@
}
/** Invoke the the service endpoint */
- public SOAPMessage invoke(Object context) throws Exception
+ public MessageAbstraction invoke(Object context) throws Exception
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)msgContext.getEndpointMetaData();
- SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
+ MessageAbstraction reqMessage = msgContext.getMessageAbstraction();
// Load the endpoint implementation bean
Class seImpl = loadServiceEndpoint();
@@ -149,7 +151,7 @@
// Set the required inbound context properties
setInboundContextProperties();
-
+
try
{
boolean oneway = false;
@@ -196,11 +198,15 @@
try
{
// Check if protocol handlers modified the payload
- SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMessage.getSOAPBody();
- if (soapBody.isModifiedFromSource())
+ if (reqMessage instanceof SOAPMessage)
{
- log.debug("Handler modified body payload, unbind message again");
- epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)reqMessage;
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)soapMessage.getSOAPBody();
+ if (soapBody.isModifiedFromSource())
+ {
+ log.debug("Handler modified body payload, unbind message again");
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ }
}
// Invoke the service endpoint
@@ -216,7 +222,7 @@
// Set the required outbound context properties
setOutboundContextProperties();
-
+
if (binding instanceof CommonSOAPBinding)
XOPContext.setMTOMEnabled(((CommonSOAPBinding)binding).isMTOMEnabled());
@@ -243,7 +249,7 @@
faultType[0] = null;
}
- SOAPMessage resMessage = msgContext.getSOAPMessage();
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
return resMessage;
}
catch (RuntimeException ex)
@@ -320,39 +326,54 @@
return msgContext;
}
- private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData, SOAPMessageImpl reqMessage) throws SOAPException
+ private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData, MessageAbstraction reqMessage) throws SOAPException
{
- OperationMetaData opMetaData = reqMessage.getOperationMetaData(epMetaData);
- SOAPHeader soapHeader = reqMessage.getSOAPHeader();
+ OperationMetaData opMetaData;
- // Report a MustUnderstand fault
- if (opMetaData == null)
+ String bindingID = epMetaData.getBindingId();
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
{
- String faultString;
- SOAPBody soapBody = reqMessage.getSOAPBody();
- if (soapBody.getChildElements().hasNext())
+ if (epMetaData.getOperations().size() != 1)
+ throw new IllegalStateException("Multiple operations not supported for HTTP binding");
+
+ opMetaData = epMetaData.getOperations().get(0);
+ }
+ else
+ {
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)reqMessage;
+
+ opMetaData = soapMessage.getOperationMetaData(epMetaData);
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+
+ // Report a MustUnderstand fault
+ if (opMetaData == null)
{
- SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
- Name soapName = soapBodyElement.getElementName();
- faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for: " + soapName;
- }
- else
- {
- faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for empty soap body";
- }
+ String faultString;
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+ if (soapBody.getChildElements().hasNext())
+ {
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ Name soapName = soapBodyElement.getElementName();
+ faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for: " + soapName;
+ }
+ else
+ {
+ faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for empty soap body";
+ }
- // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL description, it SHOULD generate a soap:Fault
- // with a faultcode of "Client", unless a "MustUnderstand" or "VersionMismatch" fault is generated.
- if (soapHeader != null && soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
- throw new SOAPFaultException(faultCode, faultString, null, null);
+ // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL description, it SHOULD generate a soap:Fault
+ // with a faultcode of "Client", unless a "MustUnderstand" or "VersionMismatch" fault is generated.
+ if (soapHeader != null && soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+ else
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
}
- else
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
- throw new SOAPFaultException(faultCode, faultString, null, null);
- }
}
return opMetaData;
}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -111,7 +111,7 @@
try
{
EndpointContext context = new EndpointContext(getServletContext(), req, res);
- epManager.processSOAPRequest(sepId, req.getInputStream(), res.getOutputStream(), context);
+ epManager.processRequest(sepId, req.getInputStream(), res.getOutputStream(), context);
}
catch (Exception ex)
{
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -30,22 +30,23 @@
import java.net.URL;
import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.soap.SOAPFaultException;
import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.http.HTTPBinding;
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.HTTPMessageImpl;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.MessageTracer;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
-import org.jboss.ws.core.soap.SOAPElementImpl;
-import org.jboss.ws.core.soap.SOAPElementWriter;
import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.utils.DOMWriter;
import org.jboss.ws.extensions.xop.XOPContext;
@@ -64,7 +65,6 @@
{
// provide logging
private static Logger log = Logger.getLogger(ServiceEndpoint.class);
- private static Logger msgLog = Logger.getLogger("jbossws.SOAPMessage");
/** Endpoint type enum */
public enum State
@@ -88,7 +88,7 @@
{
return seInfo.getState();
}
-
+
public ServiceEndpointInfo getServiceEndpointInfo()
{
return seInfo;
@@ -110,7 +110,7 @@
ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
UnifiedMetaData wsMetaData = epMetaData.getServiceMetaData().getUnifiedMetaData();
wsMetaData.eagerInitialize();
-
+
seMetrics.start();
seInfo.setState(State.STARTED);
}
@@ -119,7 +119,8 @@
{
seMetrics.stop();
seInfo.setState(State.STOPED);
- if(log.isDebugEnabled()) log.debug("Stop Endpoint" + seMetrics);
+ if (log.isDebugEnabled())
+ log.debug("Stop Endpoint" + seMetrics);
}
public void destroy()
@@ -143,7 +144,8 @@
{
wsdlHost = epManager.getWebServiceHost();
}
- if(log.isDebugEnabled()) log.debug("WSDL request, using host: " + wsdlHost);
+ if (log.isDebugEnabled())
+ log.debug("WSDL request, using host: " + wsdlHost);
WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(epMetaData);
Document document = wsdlRequestHandler.getDocumentForPath(reqURL, wsdlHost, resPath);
@@ -157,10 +159,10 @@
/**
* Handle a request to this web service endpoint
*/
- public SOAPMessage handleRequest(MimeHeaderSource headerSource, EndpointContext context, InputStream inputStream) throws BindingException
+ public MessageAbstraction processRequest(MimeHeaderSource headerSource, EndpointContext context, InputStream inputStream) throws BindingException
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
+ ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
long beginProcessing = 0;
ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
@@ -174,34 +176,40 @@
throw new SOAPFaultException(faultCode, faultString, null, null);
}
- if(log.isDebugEnabled()) log.debug("BEGIN handleRequest: " + seInfo.getServiceEndpointID());
+ log.debug("BEGIN handleRequest: " + seInfo.getServiceEndpointID());
beginProcessing = seMetrics.processRequestMessage();
- MessageFactoryImpl msgFactory = new MessageFactoryImpl();
- msgFactory.setServiceMode(epMetaData.getServiceMode());
- msgFactory.setStyle(epMetaData.getStyle());
-
MimeHeaders headers = (headerSource != null ? headerSource.getMimeHeaders() : null);
- SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers, inputStream);
+ MessageAbstraction reqMessage;
+
+ String bindingID = sepMetaData.getBindingId();
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
+ {
+ reqMessage = new HTTPMessageImpl(headers, inputStream);
+ }
+ else
+ {
+ MessageFactoryImpl msgFactory = new MessageFactoryImpl();
+ msgFactory.setServiceMode(sepMetaData.getServiceMode());
+ msgFactory.setStyle(sepMetaData.getStyle());
+
+ reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers, inputStream);
+ }
+
// Associate current message with message context
- msgContext.setSOAPMessage(reqMessage);
+ msgContext.setMessageAbstraction(reqMessage);
// debug the incomming message
- if (msgLog.isTraceEnabled())
- {
- SOAPEnvelope soapEnv = reqMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, true);
- msgLog.trace("Incoming SOAPMessage\n" + envStr);
- }
+ MessageTracer.traceMessage("Incoming Request Message", reqMessage);
// Set the thread context class loader
- ClassLoader classLoader = epMetaData.getClassLoader();
+ ClassLoader classLoader = sepMetaData.getClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
// Invoke the service endpoint
ServiceEndpointInvoker seInvoker = seInfo.getInvoker();
- SOAPMessage resMessage = seInvoker.invoke(context);
+ MessageAbstraction resMessage = seInvoker.invoke(context);
if (resMessage != null)
postProcessResponse(headerSource, resMessage);
@@ -210,15 +218,15 @@
}
catch (Exception ex)
{
- SOAPMessage resMessage = msgContext.getSOAPMessage();
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
// In case we have an exception before the invoker is called
// we create the fault message here.
- if (resMessage == null || ((SOAPMessageImpl)resMessage).isFaultMessage() == false)
+ if (resMessage == null || resMessage.isFaultMessage() == false)
{
CommonBindingProvider bindingProvider = getCommonBindingProvider();
CommonBinding binding = bindingProvider.getCommonBinding();
- resMessage = (SOAPMessage)binding.bindFaultMessage(ex);
+ resMessage = binding.bindFaultMessage(ex);
}
if (resMessage != null)
@@ -230,10 +238,10 @@
{
try
{
- SOAPMessage soapMessage = msgContext.getSOAPMessage();
- if (soapMessage != null && soapMessage.getSOAPPart().getEnvelope() != null)
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ if (resMessage != null)
{
- if (soapMessage.getSOAPPart().getEnvelope().getBody().hasFault())
+ if (resMessage.isFaultMessage())
{
seMetrics.processFaultMessage(beginProcessing);
}
@@ -250,39 +258,31 @@
// Reset the thread context class loader
Thread.currentThread().setContextClassLoader(ctxClassLoader);
- if(log.isDebugEnabled()) log.debug("END handleRequest: " + seInfo.getServiceEndpointID());
+ if (log.isDebugEnabled())
+ log.debug("END handleRequest: " + seInfo.getServiceEndpointID());
}
}
/** Set response mime headers
*/
- private void postProcessResponse(MimeHeaderSource headerSource, SOAPMessage resMessage)
+ private void postProcessResponse(MimeHeaderSource headerSource, MessageAbstraction resMessage)
{
try
{
// Set the outbound headers
- if (headerSource != null)
+ if (headerSource != null && resMessage instanceof SOAPMessage)
{
XOPContext.eagerlyCreateAttachments();
- resMessage.saveChanges();
+ ((SOAPMessage)resMessage).saveChanges();
headerSource.setMimeHeaders(resMessage.getMimeHeaders());
}
// debug the outgoing message
- if (msgLog.isTraceEnabled())
- {
- resMessage.saveChanges();
- SOAPEnvelope soapEnv = resMessage.getSOAPPart().getEnvelope();
- if (soapEnv != null)
- {
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, true);
- msgLog.trace("Outgoing SOAPMessage\n" + envStr);
- }
- }
+ MessageTracer.traceMessage("Outgoing Response Message", resMessage);
}
catch (Exception ex)
{
- throw new JAXRPCException("Faild to post process response message", ex);
+ WSException.rethrow("Faild to post process response message", ex);
}
}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -23,7 +23,7 @@
// $Id$
-import javax.xml.soap.SOAPMessage;
+import org.jboss.ws.core.MessageAbstraction;
/** An implementation handles invocations on the endpoint
*
@@ -36,5 +36,5 @@
void init(ServiceEndpointInfo seInfo);
/** Invoke the the service endpoint */
- SOAPMessage invoke(Object endpointContext) throws Exception;
+ MessageAbstraction invoke(Object endpointContext) throws Exception;
}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -59,12 +59,13 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.client.SOAPConnectionImpl;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.core.utils.ThreadLocalAssociation;
import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
@@ -397,7 +398,7 @@
wsEndpoint.handleWSDLRequest(outStream, requestURL, resourcePath);
}
- public void processSOAPRequest(ObjectName sepID, InputStream inStream, OutputStream outStream, EndpointContext context) throws Exception
+ public void processRequest(ObjectName sepID, InputStream inStream, OutputStream outStream, EndpointContext context) throws Exception
{
final String SESSION_COOKIES = "org.jboss.ws.cookies";
@@ -444,9 +445,9 @@
MessageContextAssociation.pushMessageContext(msgContext);
try
{
- SOAPMessage resMessage = wsEndpoint.handleRequest(headerSource, context, inStream);
+ MessageAbstraction resMessage = wsEndpoint.processRequest(headerSource, context, inStream);
- // REplace the message context with the response context
+ // Replace the message context with the response context
msgContext = MessageContextAssociation.peekMessageContext();
Map<String, List<String>> headers = (Map<String, List<String>>)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_HEADERS);
@@ -457,20 +458,24 @@
if (code != null)
httpResponse.setStatus(code.intValue());
- SOAPPart part = resMessage.getSOAPPart();
- if (part == null)
- throw new SOAPException("Cannot obtain SOAPPart from response message");
+ boolean isFault = false;
+ if (resMessage instanceof SOAPMessage)
+ {
+ SOAPPart part = ((SOAPMessage)resMessage).getSOAPPart();
+ if (part == null)
+ throw new SOAPException("Cannot obtain SOAPPart from response message");
- // R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP status code
- // if the response envelope is a Fault.
- //
- // Also, a one-way operation must show up as empty content, and can be detected
- // by a null envelope.
- SOAPEnvelope soapEnv = part.getEnvelope();
- boolean isFault = soapEnv != null && soapEnv.getBody().hasFault();
- if (isFault && httpResponse != null)
- {
- httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ // R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP status code
+ // if the response envelope is a Fault.
+ //
+ // Also, a one-way operation must show up as empty content, and can be detected
+ // by a null envelope.
+ SOAPEnvelope soapEnv = part.getEnvelope();
+ isFault = soapEnv != null && soapEnv.getBody().hasFault();
+ if (isFault && httpResponse != null)
+ {
+ httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
}
sendResponse(outStream, msgContext, isFault);
@@ -490,7 +495,7 @@
private void sendResponse(OutputStream outputStream, CommonMessageContext msgContext, boolean isFault) throws SOAPException, IOException
{
- SOAPMessage resMessage = msgContext.getSOAPMessage();
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
String wsaTo = null;
// Get the destination from the AddressingProperties
@@ -505,7 +510,7 @@
if (wsaTo != null)
{
log.debug("Sending response to addressing destination: " + wsaTo);
- new SOAPConnectionImpl().callOneWay(resMessage, wsaTo);
+ new SOAPConnectionImpl().callOneWay((SOAPMessage)resMessage, wsaTo);
}
else
{
@@ -515,14 +520,14 @@
/** Process the given SOAPRequest and return the corresponding SOAPResponse
*/
- public String processSOAPRequest(ObjectName sepID, String inMessage) throws Exception
+ public String processRequest(ObjectName sepID, String inMessage) throws Exception
{
log.debug("processSOAPRequest: " + sepID);
ByteArrayInputStream inputStream = new ByteArrayInputStream(inMessage.getBytes("UTF-8"));
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(512);
- processSOAPRequest(sepID, inputStream, outputStream, null);
+ processRequest(sepID, inputStream, outputStream, null);
String outMsg = new String(outputStream.toByteArray());
return outMsg;
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -60,7 +60,6 @@
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPException;
-import org.jboss.ws.core.client.SOAPConnectionImpl;
/**
* SOAP Connection Factory implementation
Copied: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java (from rev 2748, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java)
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -0,0 +1,122 @@
+/*
+ * 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.core.soap;
+
+// $Id$
+
+import java.io.IOException;
+
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.client.RemotingConnectionImpl;
+import org.jboss.ws.core.client.SOAPRemotingConnection;
+
+/**
+ * SOAPConnection implementation
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason@stacksmash.com">Jason T. Greene</a>
+ *
+ * @since 02-Feb-2005
+ */
+public class SOAPConnectionImpl extends SOAPConnection
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPConnectionImpl.class);
+
+ private RemotingConnectionImpl remotingConnection;
+
+ public SOAPConnectionImpl()
+ {
+ remotingConnection = new SOAPRemotingConnection();
+ }
+
+ /**
+ * Sends the given message to the specified endpoint and blocks until it has
+ * returned the response.
+ */
+ public SOAPMessage call(SOAPMessage reqMessage, Object endpoint) throws SOAPException
+ {
+ if (reqMessage == null)
+ throw new IllegalArgumentException("Given SOAPMessage cannot be null");
+
+ MessageAbstraction resMessage = callInternal(reqMessage, endpoint, false);
+ return (SOAPMessage)resMessage;
+ }
+
+ /**
+ * Sends an HTTP GET request to an endpoint and blocks until a SOAP message is received
+ */
+ public SOAPMessage get(Object endpoint) throws SOAPException
+ {
+ MessageAbstraction resMessage = callInternal(null, endpoint, false);
+ return (SOAPMessage)resMessage;
+ }
+
+ /**
+ * Sends the given message to the specified endpoint. This method is logically
+ * non blocking.
+ */
+ public SOAPMessage callOneWay(SOAPMessage reqMessage, Object endpoint) throws SOAPException
+ {
+ if (reqMessage == null)
+ throw new IllegalArgumentException("Given SOAPMessage cannot be null");
+
+ MessageAbstraction resMessage = callInternal((SOAPMessageImpl)reqMessage, endpoint, true);
+ return (SOAPMessage)resMessage;
+ }
+
+ /** Closes this SOAPConnection
+ */
+ public void close() throws SOAPException
+ {
+ if (remotingConnection.isClosed())
+ throw new SOAPException("SOAPConnection is already closed");
+
+ remotingConnection.setClosed(true);
+ }
+
+ private MessageAbstraction callInternal(SOAPMessage reqMessage, Object endpoint, boolean oneway) throws SOAPException
+ {
+ try
+ {
+ MessageAbstraction resMessage = remotingConnection.invoke((SOAPMessageImpl)reqMessage, endpoint, oneway);
+ return resMessage;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ Throwable cause = ex.getCause();
+ if (cause instanceof SOAPException)
+ throw (SOAPException)cause;
+
+ throw new SOAPException(ex);
+ }
+ }
+}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -252,7 +252,6 @@
}
mimeHeaders.setHeader(MimeConstants.CONTENT_TYPE, contentType);
-
}
catch (MessagingException ex)
{
@@ -279,27 +278,34 @@
return saveRequired;
}
- public void writeTo(OutputStream outs) throws SOAPException, IOException
+ public void writeTo(OutputStream outs) throws IOException
{
- // Save all changes
- saveChanges();
+ try
+ {
+ // Save all changes
+ saveChanges();
- // If there are attachments then we delegate encoding to MultipartRelatedEncoder
- if (attachments.size() > 0)
- {
- multipartRelatedEncoder.writeTo(outs);
- }
- else
- {
- SOAPEnvelope soapEnv = getSOAPPart().getEnvelope();
- if (soapEnv != null)
+ // If there are attachments then we delegate encoding to MultipartRelatedEncoder
+ if (attachments.size() > 0)
{
- boolean writeXML = isWriteXMLDeclaration();
- String charsetEncoding = getCharSetEncoding();
- SOAPElementWriter writer = new SOAPElementWriter(outs, charsetEncoding);
- writer.setWriteXMLDeclaration(writeXML).writeElement((SOAPEnvelopeImpl)soapEnv);
+ multipartRelatedEncoder.writeTo(outs);
}
+ else
+ {
+ SOAPEnvelope soapEnv = getSOAPPart().getEnvelope();
+ if (soapEnv != null)
+ {
+ boolean writeXML = isWriteXMLDeclaration();
+ String charsetEncoding = getCharSetEncoding();
+ SOAPElementWriter writer = new SOAPElementWriter(outs, charsetEncoding);
+ writer.setWriteXMLDeclaration(writeXML).writeElement((SOAPEnvelopeImpl)soapEnv);
+ }
+ }
}
+ catch (SOAPException ex)
+ {
+ WSException.rethrow(ex);
+ }
}
private String getCharSetEncoding() throws SOAPException
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -1,30 +1,29 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * 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.core.soap;
import java.io.IOException;
import java.io.OutputStream;
-import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
@@ -32,6 +31,7 @@
import org.jboss.remoting.InvocationRequest;
import org.jboss.remoting.invocation.OnewayInvocation;
import org.jboss.remoting.marshal.Marshaller;
+
/**
* @author Thomas.Diesler(a)jboss.org
* @since 25-Nov-2004
@@ -61,25 +61,8 @@
if ((dataObject instanceof SOAPMessage) == false)
throw new IllegalArgumentException("Not a SOAPMessage: " + dataObject);
- try
- {
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)dataObject;
-
- // debug the outgoing message
- if (log.isTraceEnabled())
- {
- SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, true);
- log.trace("Outgoing SOAPMessage\n" + envStr);
- }
-
- soapMessage.writeTo(output);
- }
- catch (SOAPException e)
- {
- log.error("Cannot marshall SOAPMessage", e);
- throw new IOException(e.toString());
- }
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)dataObject;
+ soapMessage.writeTo(output);
}
public Marshaller cloneMarshaller() throws CloneNotSupportedException
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/eventing/mgmt/Subscription.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/eventing/mgmt/Subscription.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/eventing/mgmt/Subscription.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -37,7 +37,7 @@
import org.apache.xpath.XPathAPI;
import org.apache.xpath.objects.XObject;
import org.jboss.logging.Logger;
-import org.jboss.ws.core.client.SOAPConnectionImpl;
+import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.core.utils.DOMWriter;
import org.jboss.ws.extensions.eventing.EventingConstants;
import org.jboss.ws.extensions.eventing.jaxws.AttributedURIType;
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/xop/XOPContext.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/xop/XOPContext.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/xop/XOPContext.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -202,7 +202,7 @@
* If we would do this lazily (i.e. upon remoting callback) the previous content-type
* would already have been written.
*
- * @see org.jboss.ws.core.client.SOAPConnectionImpl#callInternal(javax.xml.soap.SOAPMessage, Object, boolean)
+ * @see org.jboss.ws.core.soap.SOAPConnectionImpl#callInternal(javax.xml.soap.SOAPMessage, Object, boolean)
* @see org.jboss.ws.core.soap.SOAPMessageMarshaller#write(Object, java.io.OutputStream)
*/
public static void eagerlyCreateAttachments()
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -113,8 +113,7 @@
{
if (wsClass.isAnnotationPresent(BindingType.class))
{
- if (log.isDebugEnabled())
- log.debug("processBindingType on: " + wsClass.getName());
+ log.debug("processBindingType on: " + wsClass.getName());
BindingType anBindingType = (BindingType)wsClass.getAnnotation(BindingType.class);
epMetaData.setBindingId(anBindingType.value());
}
@@ -124,8 +123,7 @@
{
if (wsClass.isAnnotationPresent(SOAPBinding.class))
{
- if (log.isDebugEnabled())
- log.debug("processSOAPBinding on: " + wsClass.getName());
+ log.debug("processSOAPBinding on: " + wsClass.getName());
SOAPBinding anSoapBinding = wsClass.getAnnotation(SOAPBinding.class);
SOAPBinding.Style attrStyle = anSoapBinding.style();
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-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -126,6 +126,9 @@
serviceMetaData.setWsdlLocation(wsdlURL);
}
+ // process binding type
+ processBindingType(sepMetaData, sepClass);
+
// process handler chain
processHandlerChain(sepMetaData, sepClass);
Modified: branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -45,6 +45,7 @@
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -250,7 +251,7 @@
ByteArrayInputStream inputStream = new ByteArrayInputStream(reqEnvelope.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage reqMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl reqMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(reqMessage);
@@ -277,7 +278,7 @@
ByteArrayInputStream inputStream = new ByteArrayInputStream(reqEnvelopeWithBoundHeader.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage reqMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl reqMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(reqMessage);
@@ -300,7 +301,7 @@
ByteArrayInputStream inputStream = new ByteArrayInputStream(reqEnvelopeWithUnboundHeader.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage reqMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl reqMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(reqMessage);
@@ -344,7 +345,7 @@
ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelope.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage resMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(resMessage);
@@ -364,7 +365,7 @@
ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelopeWithBoundHeader.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage resMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(resMessage);
@@ -395,7 +396,7 @@
ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelopeWithUnboundHeader.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage resMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(resMessage);
@@ -423,7 +424,7 @@
ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelopeWithFault.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage resMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(resMessage);
Modified: branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/SOAPFaultTestCase.java
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/SOAPFaultTestCase.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/SOAPFaultTestCase.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -49,9 +49,19 @@
*/
public class SOAPFaultTestCase extends JBossWSTest
{
- private String envStr = "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" + " <env:Header/>" + " <env:Body>" + " <env:Fault>"
- + " <faultcode>env:Client</faultcode>" + " <faultstring>Some fault message</faultstring>" + " <faultactor>Some fault actor</faultactor>" + " <detail>"
- + " <ns1:name xmlns:ns1='http://somens'>Kermit</ns1:name>" + " </detail>" + " </env:Fault>" + " </env:Body>" + "</env:Envelope>";
+ private String envStr = "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
+ " <env:Header/>" +
+ " <env:Body>" +
+ " <env:Fault>" +
+ " <faultcode>env:Client</faultcode>" +
+ " <faultstring>Some fault message</faultstring>" +
+ " <faultactor>Some fault actor</faultactor>" +
+ " <detail>" +
+ " <ns1:name xmlns:ns1='http://somens'>Kermit</ns1:name>" +
+ " </detail>" +
+ " </env:Fault>" +
+ " </env:Body>" +
+ "</env:Envelope>";
public void testExceptionToFault() throws Exception
{
Modified: branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -49,6 +49,7 @@
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.attachment.MimeConstants;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
@@ -165,7 +166,7 @@
MimeHeaders headers = new MimeHeaders();
headers.addHeader(MimeConstants.CONTENT_TYPE, type);
- SOAPMessage msg2 = new MessageFactoryImpl().createMessage(headers, in);
+ SOAPMessageImpl msg2 = (SOAPMessageImpl)new MessageFactoryImpl().createMessage(headers, in);
epInv = binding.unbindRequestMessage(opMetaData, msg2);
@@ -185,7 +186,7 @@
headers = new MimeHeaders();
headers.addHeader(MimeConstants.CONTENT_TYPE, type);
- SOAPMessage msg3 = new MessageFactoryImpl().createMessage(headers, in);
+ SOAPMessageImpl msg3 = (SOAPMessageImpl)new MessageFactoryImpl().createMessage(headers, in);
binding.unbindResponseMessage(opMetaData, msg3, epInv, null);
Modified: branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -23,23 +23,16 @@
// $Id$
-import java.io.ByteArrayInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPConnection;
-import javax.xml.soap.SOAPConnectionFactory;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.transform.dom.DOMSource;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.Service.Mode;
-import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.http.HTTPBinding;
import junit.framework.Test;
@@ -47,14 +40,12 @@
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
-import org.w3c.dom.Element;
/**
- * Test a Provider<SOAPMessage>
+ * Test HTTP Binding
*
* @author Thomas.Diesler(a)jboss.org
- * @author <a href="jason.greene(a)jboss.com">Jason T. Greene</a>
- * @since 29-Jun-2006
+ * @since 02-Apr-2007
*/
public class HttpJAXBTestCase extends JBossWSTest
{
@@ -83,18 +74,6 @@
assertEquals(user.getQname(), userRes.getQname());
}
- public void testWebServiceDispatch() throws Exception
- {
- Dispatch<Object> dispatch = createDispatch("WebServiceEndpoint");
-
- UserType user = new UserType();
- user.setString("Kermit");
- user.setQname(new QName("TheFrog"));
- UserType userRes = (UserType)dispatch.invoke(user);
- assertEquals(user.getString(), userRes.getString());
- assertEquals(user.getQname(), userRes.getQname());
- }
-
private Dispatch<Object> createDispatch(String target) throws MalformedURLException, JAXBException
{
String targetNS = "http://org.jboss.ws/httpbinding";
@@ -103,39 +82,10 @@
URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-httpbinding-jaxb/" + target + "?wsdl");
Service service = Service.create(serviceName);
- service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, wsdlURL.toExternalForm());
-
+ service.addPort(portName, HTTPBinding.HTTP_BINDING, wsdlURL.toExternalForm());
+
JAXBContext jbc = JAXBContext.newInstance(new Class[] { UserType.class });
Dispatch<Object> dispatch = service.createDispatch(portName, jbc, Mode.PAYLOAD);
return dispatch;
}
-
- public void testProviderMessage() throws Exception
- {
- String reqString =
- "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
- " <env:Header/>" +
- " <env:Body>" +
- " <ns1:user xmlns:ns1='http://org.jboss.ws/httpbinding'>" +
- " <string>Kermit</string>" +
- " <qname>The Frog</qname>" +
- " </ns1:user>" +
- " </env:Body>" +
- "</env:Envelope>";
-
- MessageFactory msgFactory = MessageFactory.newInstance();
- SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
- SOAPMessage reqMsg = msgFactory.createMessage(null, new ByteArrayInputStream(reqString.getBytes()));
-
- URL epURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-httpbinding-jaxb/ProviderEndpoint");
- SOAPMessage resMsg = con.call(reqMsg, epURL);
- SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
-
- Element child = (Element)resEnv.getBody().getChildElements().next();
- JAXBContext jc = JAXBContext.newInstance(new Class[]{UserType.class});
- UserType user = (UserType)jc.createUnmarshaller().unmarshal(new DOMSource(child));
-
- assertEquals("Kermit", user.getString());
- assertEquals(new QName("The Frog"), user.getQname());
- }
}
\ No newline at end of file
Modified: branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -26,11 +26,13 @@
import javax.xml.bind.JAXBContext;
import javax.xml.bind.util.JAXBSource;
import javax.xml.transform.Source;
+import javax.xml.ws.BindingType;
import javax.xml.ws.Provider;
import javax.xml.ws.Service;
import javax.xml.ws.ServiceMode;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.http.HTTPBinding;
import org.jboss.logging.Logger;
@@ -43,7 +45,9 @@
* @since 29-Jun-2006
*/
@WebServiceProvider(serviceName = "ProviderService", portName = "ProviderPort", targetNamespace = "http://org.jboss.ws/httpbinding", wsdlLocation = "WEB-INF/wsdl/HttpBinding.wsdl")
-@ServiceMode(value = Service.Mode.PAYLOAD)
+
+@BindingType(value = HTTPBinding.HTTP_BINDING)
+@ServiceMode(value = Service.Mode.MESSAGE)
public class ProviderBeanJAXB implements Provider<Source>
{
// provide logging
Modified: branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java 2007-04-02 15:41:10 UTC (rev 2748)
+++ branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java 2007-04-03 14:54:13 UTC (rev 2749)
@@ -34,9 +34,13 @@
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.BindingType;
import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.http.HTTPBinding;
/**
* Test a Provider<Source>
@@ -45,9 +49,11 @@
* @since 29-Jun-2006
*/
+@WebServiceProvider(serviceName = "ProviderService", portName = "ProviderPort", targetNamespace = "http://org.jboss.ws/httpbinding", wsdlLocation = "WEB-INF/wsdl/HttpBinding.wsdl")
+
+@BindingType(value = HTTPBinding.HTTP_BINDING)
+@ServiceMode(value = Service.Mode.MESSAGE)
@HandlerChain(file = "httpbinding-handlers.xml")
-@WebServiceProvider(serviceName = "ProviderService", portName = "ProviderPort", targetNamespace = "http://org.jboss.ws/httpbinding", wsdlLocation = "WEB-INF/wsdl/HttpBinding.wsdl")
-// @ServiceMode(value = Service.Mode.PAYLOAD) - PAYLOAD is implicit
public class ProviderBeanPayload implements Provider<Source>
{
public Source invoke(Source req)
17 years
JBossWS SVN: r2748 - in branches/tdiesler/trunk/jbossws-core/src/java: org/jboss/ws and 8 other directories.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-04-02 11:41:10 -0400 (Mon, 02 Apr 2007)
New Revision: 2748
Added:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageAbstraction.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/SOAPMessageAbstraction.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/EndpointInfo.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java
Removed:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/EndpointInfo.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/javax/xml/ws/soap/SOAPBinding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/Constants.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/eventing/mgmt/Subscription.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/xop/XOPContext.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
Log:
Partial commit
Modified: branches/tdiesler/trunk/jbossws-core/src/java/javax/xml/ws/soap/SOAPBinding.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/javax/xml/ws/soap/SOAPBinding.java 2007-04-02 12:29:48 UTC (rev 2747)
+++ branches/tdiesler/trunk/jbossws-core/src/java/javax/xml/ws/soap/SOAPBinding.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -34,76 +34,75 @@
* the SOAP binding.
*
* @since JAX-WS 2.0
-**/
-public interface SOAPBinding extends Binding {
+ **/
+public interface SOAPBinding extends Binding
+{
+ /**
+ * A constant representing the identity of the SOAP 1.1 over HTTP binding.
+ */
+ public static final String SOAP11HTTP_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http";
- /**
- * A constant representing the identity of the SOAP 1.1 over HTTP binding.
- */
- public static final String SOAP11HTTP_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http";
+ /**
+ * A constant representing the identity of the SOAP 1.2 over HTTP binding.
+ */
+ public static final String SOAP12HTTP_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/";
- /**
- * A constant representing the identity of the SOAP 1.2 over HTTP binding.
- */
- public static final String SOAP12HTTP_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/";
+ /**
+ * A constant representing the identity of the SOAP 1.1 over HTTP binding
+ * with MTOM enabled by default.
+ */
+ public static final String SOAP11HTTP_MTOM_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true";
- /**
- * A constant representing the identity of the SOAP 1.1 over HTTP binding
- * with MTOM enabled by default.
- */
- public static final String SOAP11HTTP_MTOM_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true";
+ /**
+ * A constant representing the identity of the SOAP 1.2 over HTTP binding
+ * with MTOM enabled by default.
+ */
+ public static final String SOAP12HTTP_MTOM_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true";
- /**
- * A constant representing the identity of the SOAP 1.2 over HTTP binding
- * with MTOM enabled by default.
- */
- public static final String SOAP12HTTP_MTOM_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true";
-
-
- /** Gets the roles played by the SOAP binding instance.
- *
- * @return Set<String> The set of roles played by the binding instance.
- **/
- public Set<String> getRoles();
+ /** Gets the roles played by the SOAP binding instance.
+ *
+ * @return Set<String> The set of roles played by the binding instance.
+ **/
+ public Set<String> getRoles();
- /** Sets the roles played by the SOAP binding instance.
- *
- * @param roles The set of roles played by the binding instance.
- * @throws WebServiceException On an error in the configuration of
- * the list of roles.
- **/
- public void setRoles(Set<String> roles);
+ /** Sets the roles played by the SOAP binding instance.
+ *
+ * @param roles The set of roles played by the binding instance.
+ * @throws WebServiceException On an error in the configuration of
+ * the list of roles.
+ **/
+ public void setRoles(Set<String> roles);
- /**
- * Returns <code>true</code> if the use of MTOM is enabled.
- *
- * @return <code>true</code> if and only if the use of MTOM is enabled.
- **/
-
- public boolean isMTOMEnabled();
-
- /**
- * Enables or disables use of MTOM.
- *
- * @param flag A <code>boolean</code> specifying whether the use of MTOM should
- * be enabled or disabled.
- * @throws WebServiceException If the specified setting is not supported
- * by this binding instance.
- * *
- **/
- public void setMTOMEnabled(boolean flag);
-
- /**
- * Gets the SAAJ <code>SOAPFactory</code> instance used by this SOAP binding.
- *
- * @return SOAPFactory instance used by this SOAP binding.
- **/
- public SOAPFactory getSOAPFactory();
-
- /**
- * Gets the SAAJ <code>MessageFactory</code> instance used by this SOAP binding.
- *
- * @return MessageFactory instance used by this SOAP binding.
- **/
- public MessageFactory getMessageFactory();
+ /**
+ * Returns <code>true</code> if the use of MTOM is enabled.
+ *
+ * @return <code>true</code> if and only if the use of MTOM is enabled.
+ **/
+
+ public boolean isMTOMEnabled();
+
+ /**
+ * Enables or disables use of MTOM.
+ *
+ * @param flag A <code>boolean</code> specifying whether the use of MTOM should
+ * be enabled or disabled.
+ * @throws WebServiceException If the specified setting is not supported
+ * by this binding instance.
+ * *
+ **/
+ public void setMTOMEnabled(boolean flag);
+
+ /**
+ * Gets the SAAJ <code>SOAPFactory</code> instance used by this SOAP binding.
+ *
+ * @return SOAPFactory instance used by this SOAP binding.
+ **/
+ public SOAPFactory getSOAPFactory();
+
+ /**
+ * Gets the SAAJ <code>MessageFactory</code> instance used by this SOAP binding.
+ *
+ * @return MessageFactory instance used by this SOAP binding.
+ **/
+ public MessageFactory getMessageFactory();
}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/Constants.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/Constants.java 2007-04-02 12:29:48 UTC (rev 2747)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/Constants.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -25,6 +25,8 @@
import javax.xml.namespace.QName;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPConstants;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.soap.SOAPBinding;
import org.jboss.ws.core.soap.NameImpl;
@@ -72,28 +74,18 @@
static final String NS_XML_MIME = "http://www.w3.org/2005/05/xmlmime";
/** The namespace for XOP. */
static final String NS_XOP = "http://www.w3.org/2004/08/xop/include";
- /**
- * A constant representing the identity of the SOAP 1.1 over HTTP binding.
- */
- public static final String SOAP11HTTP_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http";
-
- /**
- * A constant representing the identity of the SOAP 1.2 over HTTP binding.
- */
- public static final String SOAP12HTTP_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/";
-
- /**
- * A constant representing the identity of the SOAP 1.1 over HTTP binding
- * with MTOM enabled by default.
- */
- public static final String SOAP11HTTP_MTOM_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true";
-
- /**
- * A constant representing the identity of the SOAP 1.2 over HTTP binding
- * with MTOM enabled by default.
- */
- public static final String SOAP12HTTP_MTOM_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true";
+ /** A constant representing the identity of the SOAP 1.1 over HTTP binding. */
+ public static final String SOAP11HTTP_BINDING = SOAPBinding.SOAP11HTTP_BINDING;
+ /** A constant representing the identity of the SOAP 1.2 over HTTP binding. */
+ public static final String SOAP12HTTP_BINDING = SOAPBinding.SOAP12HTTP_BINDING;
+ /** A constant representing the identity of the SOAP 1.1 over HTTP binding with MTOM enabled by default. */
+ public static final String SOAP11HTTP_MTOM_BINDING = SOAPBinding.SOAP11HTTP_MTOM_BINDING;
+ /** A constant representing the identity of the SOAP 1.2 over HTTP binding with MTOM enabled by default. */
+ public static final String SOAP12HTTP_MTOM_BINDING = SOAPBinding.SOAP12HTTP_MTOM_BINDING;
+ /** A constant representing the identity of the XML/HTTP binding. */
+ public static final String HTTP_BINDING = HTTPBinding.HTTP_BINDING;
+
/** SOAP-1.1 encoding URI */
static final String URI_SOAP11_ENC = SOAPConstants.URI_NS_SOAP_ENCODING;
/** SOAP-1.2 encoding URI */
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java 2007-04-02 12:29:48 UTC (rev 2747)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -46,12 +46,12 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.DirectionHolder.Direction;
+import org.jboss.ws.core.client.EndpointInfo;
+import org.jboss.ws.core.client.SOAPConnectionImpl;
import org.jboss.ws.core.jaxrpc.ParameterWrapping;
import org.jboss.ws.core.jaxrpc.Style;
-import org.jboss.ws.core.soap.EndpointInfo;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.SOAPBodyImpl;
-import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.core.utils.HolderUtils;
import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
Added: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageAbstraction.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageAbstraction.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageAbstraction.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -0,0 +1,33 @@
+/*
+ * 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.core;
+
+/**
+ * A generic HTTP message
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Apr-2007
+ */
+public interface HTTPMessageAbstraction extends MessageAbstraction
+{
+
+}
Property changes on: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageAbstraction.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -0,0 +1,35 @@
+/*
+ * 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.core;
+
+import javax.xml.soap.MimeHeaders;
+
+/**
+ * A generic message independent of the underlying protocol
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Apr-2007
+ */
+public interface MessageAbstraction
+{
+ MimeHeaders getMimeHeaders();
+}
Property changes on: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -0,0 +1,39 @@
+package org.jboss.ws.core;
+
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPElementWriter;
+
+public class MessageTracer
+{
+ private static Logger msgLog = Logger.getLogger("jbossws.SOAPMessage");
+
+ public static void traceMessage(String string, MessageAbstraction message)
+ {
+ if (msgLog.isTraceEnabled())
+ {
+ if (message instanceof SOAPMessage)
+ {
+ try
+ {
+ SOAPEnvelope soapReqEnv = ((SOAPMessage)message).getSOAPPart().getEnvelope();
+ String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapReqEnv, true);
+ msgLog.trace(string + "\n" + envStr);
+ }
+ catch (SOAPException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+ msgLog.trace("Unsupported message type: " + message);
+ }
+ }
+ }
+}
Property changes on: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/SOAPMessageAbstraction.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/SOAPMessageAbstraction.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/SOAPMessageAbstraction.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -0,0 +1,33 @@
+/*
+ * 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.core;
+
+/**
+ * A generic SOAP message
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Apr-2007
+ */
+public interface SOAPMessageAbstraction extends MessageAbstraction
+{
+
+}
Property changes on: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/SOAPMessageAbstraction.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/EndpointInfo.java (from rev 2744, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/EndpointInfo.java)
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/EndpointInfo.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/EndpointInfo.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -0,0 +1,99 @@
+/*
+* 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.core.client;
+
+// $Id$
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+
+/** A wrapper object that associates the target address with some metadata
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 20-Jul-2005
+ */
+public class EndpointInfo
+{
+ private String targetAddress;
+ private Map<String, Object> properties;
+ public EndpointInfo(EndpointMetaData epMetaData, String targetAddress, Map<String, Object> callProps)
+ {
+ this.targetAddress = targetAddress;
+ this.properties = callProps;
+
+ // Add the service properties
+ Properties serviceProps = epMetaData.getServiceMetaData().getProperties();
+ if (serviceProps != null)
+ {
+ Iterator it = serviceProps.entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+ String key = (String)entry.getKey();
+ Object val = entry.getValue();
+ properties.put(key, val);
+ }
+ }
+
+ // Add the endpoint properties
+ Properties epProps = epMetaData.getProperties();
+ Iterator it = epProps.entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+ String key = (String)entry.getKey();
+ Object val = entry.getValue();
+ properties.put(key, val);
+ }
+
+ }
+
+ public Map<String, Object> getProperties()
+ {
+ return properties;
+ }
+
+ public String getTargetAddress()
+ {
+ return targetAddress;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof EndpointInfo))
+ return false;
+ return toString().equals(obj.toString());
+ }
+
+ public int hashCode()
+ {
+ return toString().hashCode();
+ }
+
+ public String toString()
+ {
+ return "[addr=" + targetAddress + ",props=" + properties + "]";
+ }
+}
\ No newline at end of file
Added: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -0,0 +1,52 @@
+/*
+ * 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.core.client;
+
+// $Id$
+
+import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.soap.SOAPMessageMarshaller;
+import org.jboss.ws.core.soap.SOAPMessageUnMarshaller;
+
+/**
+ * @since 02-Apr-2007
+ */
+public class HTTPRemotingConnection extends RemotingConnectionImpl
+{
+ protected UnMarshaller getUnmarshaller()
+ {
+ return new SOAPMessageUnMarshaller();
+ }
+
+ protected Marshaller getMarshaller()
+ {
+ return new SOAPMessageMarshaller();
+ }
+
+ public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
Property changes on: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -0,0 +1,39 @@
+/*
+ * 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.core.client;
+
+import java.io.IOException;
+
+import org.jboss.ws.core.MessageAbstraction;
+
+// $Id$
+
+/**
+ * A remoting connection
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 02-Apr-2007
+ */
+public interface RemotingConnection
+{
+ MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException;
+}
Property changes on: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -0,0 +1,377 @@
+/*
+ * 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.core.client;
+
+// $Id$
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.SocketTimeoutException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.rpc.Stub;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.addressing.EndpointReference;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.marshal.MarshalFactory;
+import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.MessageTracer;
+import org.jboss.ws.core.StubExt;
+import org.jboss.ws.core.WSTimeoutException;
+
+/**
+ * SOAPConnection implementation
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason@stacksmash.com">Jason T. Greene</a>
+ *
+ * @since 02-Feb-2005
+ */
+public abstract class RemotingConnectionImpl implements RemotingConnection
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(RemotingConnectionImpl.class);
+
+ private Map<String, Object> clientConfig = new HashMap<String, Object>();
+
+ private static Map<String, String> metadataMap = new HashMap<String, String>();
+ static
+ {
+ metadataMap.put(Stub.USERNAME_PROPERTY, "http.basic.username");
+ metadataMap.put(Stub.PASSWORD_PROPERTY, "http.basic.password");
+ metadataMap.put(BindingProvider.USERNAME_PROPERTY, "http.basic.username");
+ metadataMap.put(BindingProvider.PASSWORD_PROPERTY, "http.basic.password");
+ }
+ private static Map<String, String> configMap = new HashMap<String, String>();
+ static
+ {
+ // Remoting constants since 2.0.0.GA
+ //configMap.put(StubExt.PROPERTY_KEY_STORE, SSLSocketBuilder.REMOTING_KEY_STORE_FILE_PATH);
+ //configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD, SSLSocketBuilder.REMOTING_KEY_STORE_PASSWORD);
+ //configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE, SSLSocketBuilder.REMOTING_KEY_STORE_TYPE);
+ //configMap.put(StubExt.PROPERTY_TRUST_STORE, SSLSocketBuilder.REMOTING_TRUST_STORE_FILE_PATH);
+ //configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD, SSLSocketBuilder.REMOTING_TRUST_STORE_PASSWORD);
+ //configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE, SSLSocketBuilder.REMOTING_TRUST_STORE_TYPE);
+
+ configMap.put(StubExt.PROPERTY_KEY_STORE, "org.jboss.remoting.keyStore");
+ configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD, "org.jboss.remoting.keyStorePassword");
+ configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE, "org.jboss.remoting.keyStoreType");
+ configMap.put(StubExt.PROPERTY_TRUST_STORE, "org.jboss.remoting.trustStore");
+ configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD, "org.jboss.remoting.trustStorePassword");
+ configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE, "org.jboss.remoting.trustStoreType");
+ }
+
+ private boolean closed;
+
+ public RemotingConnectionImpl()
+ {
+ // HTTPClientInvoker conect sends gratuitous POST
+ // http://jira.jboss.com/jira/browse/JBWS-711
+ clientConfig.put(Client.ENABLE_LEASE, false);
+ }
+
+ public boolean isClosed()
+ {
+ return closed;
+ }
+
+ public void setClosed(boolean closed)
+ {
+ this.closed = closed;
+ }
+
+ /**
+ * Sends the given message to the specified endpoint.
+ *
+ * A null reqMessage signifies a HTTP GET request.
+ */
+ protected MessageAbstraction invokeInternal(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException
+ {
+ if (endpoint == null)
+ throw new IllegalArgumentException("Given endpoint cannot be null");
+
+ if (closed)
+ throw new WSException("Connection is already closed");
+
+ Object timeout = null;
+ String targetAddress;
+ Map<String, Object> callProps = new HashMap<String, Object>();
+
+ if (endpoint instanceof EndpointInfo)
+ {
+ EndpointInfo epInfo = (EndpointInfo)endpoint;
+ targetAddress = epInfo.getTargetAddress();
+ callProps = epInfo.getProperties();
+
+ if (callProps.containsKey(StubExt.PROPERTY_CLIENT_TIMEOUT))
+ {
+ timeout = callProps.get(StubExt.PROPERTY_CLIENT_TIMEOUT);
+ targetAddress = addURLParameter(targetAddress, "timeout", timeout.toString());
+ }
+
+ }
+ else if (endpoint instanceof EndpointReference)
+ {
+ EndpointReference epr = (EndpointReference)endpoint;
+ targetAddress = epr.getAddress().toString();
+ }
+ else
+ {
+ targetAddress = endpoint.toString();
+ }
+
+ // setup remoting client
+ Map<String, Object> metadata = createRemotingMetaData(reqMessage, callProps);
+ Client client = createRemotingClient(endpoint, targetAddress, oneway);
+
+ try
+ {
+ // debug the outgoing message
+ MessageTracer.traceMessage("Outgoing Request Message", reqMessage);
+
+ MessageAbstraction resMessage = null;
+ try
+ {
+ if (oneway == true)
+ {
+ client.invokeOneway(reqMessage, metadata, false);
+ }
+ else
+ {
+ resMessage = (MessageAbstraction)client.invoke(reqMessage, metadata);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ Throwable cause = rte.getCause();
+ if (timeout != null && cause instanceof SocketTimeoutException)
+ throw new WSTimeoutException("Timeout after: " + timeout + "ms", new Long(timeout.toString()));
+ else throw rte;
+ }
+
+ // Disconnect the remoting client
+ client.disconnect();
+
+ callProps.clear();
+ callProps.putAll(metadata);
+
+ // trace the incomming response message
+ MessageTracer.traceMessage("Incoming Response Message", resMessage);
+
+ return resMessage;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Throwable th)
+ {
+ IOException io = new IOException("Could not transmit message");
+ io.initCause(th);
+ throw io;
+ }
+ }
+
+ private String addURLParameter(String url, String key, String value)
+ {
+ int qmIndex = url.indexOf("?");
+ url += (qmIndex < 0 ? "?" : "&") + key + "=" + value;
+ return url;
+ }
+
+ private Client createRemotingClient(Object endpoint, String targetAddress, boolean oneway)
+ {
+ Client client;
+ try
+ {
+ // Get the invoker from Remoting for a given endpoint address
+ log.debug("Get locator for: " + endpoint);
+ targetAddress = addURLParameter(targetAddress, InvokerLocator.DATATYPE, "SOAPMessage");
+ InvokerLocator locator = new InvokerLocator(targetAddress);
+
+ /* An HTTPClientInvoker may disconnect from the server and recreated by the remoting layer.
+ * In that case the new invoker does not inherit the marshaller/unmarshaller from the disconnected invoker.
+ * We therefore explicitly specify the invoker locator datatype and register the SOAP marshaller/unmarshaller
+ * with the MarshalFactory.
+ *
+ * This applies to remoting-1.4.5
+ */
+ Marshaller marshaller = getMarshaller();
+ UnMarshaller unmarshaller = getUnmarshaller();
+ MarshalFactory.addMarshaller("SOAPMessage", marshaller, unmarshaller);
+
+ client = new Client(locator, "saaj", clientConfig);
+ client.connect();
+
+ client.setMarshaller(marshaller);
+
+ if (oneway == false)
+ client.setUnMarshaller(unmarshaller);
+ }
+ catch (MalformedURLException e)
+ {
+ throw new IllegalArgumentException("Malformed endpoint address", e);
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Could not setup remoting client", e);
+ }
+ return client;
+ }
+
+ protected abstract UnMarshaller getUnmarshaller();
+
+ protected abstract Marshaller getMarshaller();
+
+ private Map<String, Object> createRemotingMetaData(MessageAbstraction reqMessage, Map callProps)
+ {
+
+ Map<String, Object> metadata = new HashMap<String, Object>();
+
+ // We need to unmarshall faults (HTTP 500)
+ // metadata.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true"); // since 2.0.0.GA
+ metadata.put("NoThrowOnError", "true");
+
+ if (reqMessage != null)
+ populateHeaders(reqMessage, metadata);
+ else metadata.put("TYPE", "GET");
+
+ if (callProps != null)
+ {
+ Iterator it = callProps.entrySet().iterator();
+
+ // Get authentication type, default to BASIC authetication
+ String authType = (String)callProps.get(StubExt.PROPERTY_AUTH_TYPE);
+ if (authType == null)
+ authType = StubExt.PROPERTY_AUTH_TYPE_BASIC;
+
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+ String key = (String)entry.getKey();
+ Object val = entry.getValue();
+
+ // pass properties to remoting meta data
+ if (metadataMap.containsKey(key))
+ {
+ String remotingKey = metadataMap.get(key);
+ if ("http.basic.username".equals(remotingKey) || "http.basic.password".equals(remotingKey))
+ {
+ if (authType.equals(StubExt.PROPERTY_AUTH_TYPE_BASIC))
+ {
+ metadata.put(remotingKey, val);
+ }
+ else
+ {
+ log.warn("Ignore '" + key + "' with auth typy: " + authType);
+ }
+ }
+ else
+ {
+ metadata.put(remotingKey, val);
+ }
+ }
+
+ // pass properties to remoting client config
+ if (configMap.containsKey(key))
+ {
+ String remotingKey = configMap.get(key);
+ clientConfig.put(remotingKey, val);
+ }
+ }
+ }
+
+ return metadata;
+ }
+
+ private void populateHeaders(MessageAbstraction reqMessage, Map<String, Object> metadata)
+ {
+ // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+ // with a quoted value equal to the value of the soapAction attribute of
+ // soapbind:operation, if present in the corresponding WSDL description.
+
+ // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+ // with a quoted empty string value, if in the corresponding WSDL description,
+ // the soapAction attribute of soapbind:operation is either not present, or
+ // present with an empty string as its value.
+
+ MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+ String[] action = mimeHeaders.getHeader("SOAPAction");
+ if (action != null && action.length > 0)
+ {
+ String soapAction = action[0];
+
+ // R1109 The value of the SOAPAction HTTP header field in a HTTP request MESSAGE MUST be a quoted string.
+ if (soapAction.startsWith("\"") == false || soapAction.endsWith("\"") == false)
+ soapAction = "\"" + soapAction + "\"";
+
+ mimeHeaders.setHeader("SOAPAction", soapAction);
+ }
+ else
+ {
+ mimeHeaders.setHeader("SOAPAction", "\"\"");
+ }
+
+ Properties props = new Properties();
+ metadata.put("HEADER", props);
+
+ Iterator i = mimeHeaders.getAllHeaders();
+ while (i.hasNext())
+ {
+ MimeHeader header = (MimeHeader)i.next();
+ String currentValue = props.getProperty(header.getName());
+
+ /*
+ * Coalesce multiple headers into one
+ *
+ * From HTTP/1.1 RFC 2616:
+ *
+ * Multiple message-header fields with the same field-name MAY be
+ * present in a message if and only if the entire field-value for that
+ * header field is defined as a comma-separated list [i.e., #(values)].
+ * It MUST be possible to combine the multiple header fields into one
+ * "field-name: field-value" pair, without changing the semantics of
+ * the message, by appending each subsequent field-value to the first,
+ * each separated by a comma.
+ */
+ if (currentValue != null)
+ {
+ props.put(header.getName(), currentValue + "," + header.getValue());
+ }
+ else
+ {
+ props.put(header.getName(), header.getValue());
+ }
+ }
+ }
+}
Property changes on: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java (from rev 2744, branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java)
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.core.client;
+
+// $Id$
+
+import java.io.IOException;
+
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.extensions.xop.XOPContext;
+
+/**
+ * SOAPConnection implementation
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason@stacksmash.com">Jason T. Greene</a>
+ *
+ * @since 02-Feb-2005
+ */
+public class SOAPConnectionImpl extends SOAPConnection
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPConnectionImpl.class);
+
+ private RemotingConnectionImpl remotingConnection;
+
+ public SOAPConnectionImpl()
+ {
+ remotingConnection = new SOAPRemotingConnection();
+ }
+
+ /**
+ * Sends the given message to the specified endpoint and blocks until it has
+ * returned the response.
+ */
+ public SOAPMessage call(SOAPMessage reqMessage, Object endpoint) throws SOAPException
+ {
+ if (reqMessage == null)
+ throw new IllegalArgumentException("Given SOAPMessage cannot be null");
+
+ MessageAbstraction resMessage = callInternal(reqMessage, endpoint, false);
+ return (SOAPMessage)resMessage;
+ }
+
+ /**
+ * Sends an HTTP GET request to an endpoint and blocks until a SOAP message is received
+ */
+ public SOAPMessage get(Object endpoint) throws SOAPException
+ {
+ MessageAbstraction resMessage = callInternal(null, endpoint, false);
+ return (SOAPMessage)resMessage;
+ }
+
+ /**
+ * Sends the given message to the specified endpoint. This method is logically
+ * non blocking.
+ */
+ public SOAPMessage callOneWay(SOAPMessage reqMessage, Object endpoint) throws SOAPException
+ {
+ if (reqMessage == null)
+ throw new IllegalArgumentException("Given SOAPMessage cannot be null");
+
+ MessageAbstraction resMessage = callInternal((SOAPMessageImpl)reqMessage, endpoint, true);
+ return (SOAPMessage)resMessage;
+ }
+
+ /** Closes this SOAPConnection
+ */
+ public void close() throws SOAPException
+ {
+ if (remotingConnection.isClosed())
+ throw new SOAPException("SOAPConnection is already closed");
+
+ remotingConnection.setClosed(true);
+ }
+
+ private MessageAbstraction callInternal(SOAPMessage reqMessage, Object endpoint, boolean oneway) throws SOAPException
+ {
+ MessageAbstraction resMessage;
+ try
+ {
+ resMessage = remotingConnection.invoke((SOAPMessageImpl)reqMessage, endpoint, oneway);
+ }
+ catch (IOException ex)
+ {
+ Throwable cause = ex.getCause();
+ if (cause instanceof SOAPException)
+ {
+ throw (SOAPException)cause;
+ }
+ }
+ return resMessage;
+ }
+
+}
Added: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -0,0 +1,95 @@
+/*
+ * 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.core.client;
+
+// $Id$
+
+import java.io.IOException;
+import java.net.SocketTimeoutException;
+
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.WSTimeoutException;
+import org.jboss.ws.core.soap.SOAPMessageMarshaller;
+import org.jboss.ws.core.soap.SOAPMessageUnMarshaller;
+import org.jboss.ws.extensions.xop.XOPContext;
+
+/**
+ * SOAPConnection implementation
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason@stacksmash.com">Jason T. Greene</a>
+ *
+ * @since 02-Apr-2007
+ */
+public class SOAPRemotingConnection extends RemotingConnectionImpl
+{
+ protected UnMarshaller getUnmarshaller()
+ {
+ return new SOAPMessageUnMarshaller();
+ }
+
+ protected Marshaller getMarshaller()
+ {
+ return new SOAPMessageMarshaller();
+ }
+
+ public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException
+ {
+ try
+ {
+ // enforce xop transitions
+ // TODO: there should be a clear transition to an immutable object model
+ XOPContext.eagerlyCreateAttachments();
+
+ // save object model changes
+ SOAPMessage soapMessage = (SOAPMessage)reqMessage;
+ if (reqMessage != null && soapMessage.saveRequired())
+ soapMessage.saveChanges();
+
+ return invokeInternal(reqMessage, endpoint, oneway);
+ }
+ catch (RuntimeException rte)
+ {
+ Throwable cause = rte.getCause();
+
+ // The CTS expects only SOAPException to be thrown.
+ if (cause instanceof IOException && cause.getCause() instanceof SOAPException)
+ {
+
+ }
+ throw new WSException((SOAPException)cause.getCause());
+
+ else throw rte;
+ }
+ catch (SOAPException ex)
+ {
+ throw new WSException(ex);
+ }
+ }
+}
Property changes on: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -0,0 +1,65 @@
+/*
+ * 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.core.jaxws.client;
+
+// $Id$
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.ws.Service.Mode;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.core.MessageAbstraction;
+
+/**
+ * The Dispatch interface provides support for the dynamic invocation of a service endpoint operations.
+ * The javax.xml.ws.Service interface acts as a factory for the creation of Dispatch instances.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public class DispatchHTTPBindingHelper
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(DispatchHTTPBindingHelper.class);
+
+ private JAXBContext jaxbContext;
+ private Class type;
+ private Mode mode;
+
+ public DispatchHTTPBindingHelper(Mode mode, Class type, JAXBContext jaxbContext)
+ {
+ this.mode = mode;
+ this.type = type;
+ this.jaxbContext = jaxbContext;
+ }
+
+ public MessageAbstraction getRequestMessage(Object obj)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Object getReturnObject(MessageAbstraction message)
+ {
+ throw new NotImplementedException();
+ }
+}
Property changes on: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-04-02 12:29:48 UTC (rev 2747)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -23,26 +23,14 @@
// $Id$
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
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.transform.stream.StreamSource;
import javax.xml.ws.AsyncHandler;
import javax.xml.ws.Binding;
import javax.xml.ws.BindingProvider;
@@ -51,14 +39,17 @@
import javax.xml.ws.Response;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.Service.Mode;
+import javax.xml.ws.http.HTTPBinding;
import javax.xml.ws.soap.SOAPFaultException;
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.client.RemotingConnection;
+import org.jboss.ws.core.client.SOAPConnectionImpl;
+import org.jboss.ws.core.client.SOAPRemotingConnection;
import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
-import org.jboss.ws.core.soap.SOAPBodyImpl;
-import org.jboss.ws.core.soap.SOAPConnectionImpl;
-import org.jboss.ws.core.utils.DOMWriter;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
/**
@@ -117,13 +108,31 @@
private Object invokeInternal(Object obj, Map<String, Object> resContext) throws SOAPException
{
- SOAPMessage reqMsg = getRequestMessage(obj);
+ MessageAbstraction reqMsg = getRequestMessage(obj);
String targetAddress = epMetaData.getEndpointAddress();
- SOAPMessage resMsg = new SOAPConnectionImpl().call(reqMsg, targetAddress);
+ MessageAbstraction resMsg = getRemotingConnection().invoke(reqMsg, targetAddress);
Object retObj = getReturnObject(resMsg);
return retObj;
}
+ private RemotingConnection getRemotingConnection()
+ {
+ String bindingID = bindingProvider.getBinding().getBindingID();
+ if (EndpointMetaData.SUPPORTED_BINDINGS.contains(bindingID) == false)
+ throw new IllegalStateException("Unsupported binding: " + bindingID);
+
+ RemotingConnection remotingConnection;
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
+ {
+ remotingConnection = new SOAPRemotingConnection();
+ }
+ else
+ {
+ remotingConnection = new SOAPRemotingConnection();
+ }
+ return remotingConnection;
+ }
+
public Response<T> invokeAsync(T msg)
{
ResponseImpl response = new ResponseImpl();
@@ -144,11 +153,11 @@
public void invokeOneWay(T msg)
{
- SOAPMessage reqMsg = getRequestMessage(msg);
+ MessageAbstraction reqMsg = getRequestMessage(msg);
try
{
String targetAddress = epMetaData.getEndpointAddress();
- new SOAPConnectionImpl().callOneWay(reqMsg, targetAddress);
+ new SOAPConnectionImpl().callOneWay((SOAPMessage)reqMsg, targetAddress);
}
catch (Exception ex)
{
@@ -169,7 +178,7 @@
{
throw (WebServiceException)ex;
}
-
+
String msg = "Cannot dispatch message";
log.error(msg, ex);
throw new WebServiceException(msg, ex);
@@ -210,107 +219,47 @@
}
}
- private SOAPMessage getRequestMessage(Object obj)
+ private MessageAbstraction getRequestMessage(Object obj)
{
// jaxws/api/javax_xml_ws/Dispatch/Client.java#invokeTestJAXBNull
if (obj == null)
throw new SOAPFaultException("Request object cannot be null");
-
- SOAPMessage reqMsg = null;
- try
- {
- MessageFactory factory = MessageFactory.newInstance();
- if (SOAPMessage.class.isAssignableFrom(type))
- {
- reqMsg = (SOAPMessage)obj;
- }
- else if (Source.class.isAssignableFrom(type))
- {
- Source source = (Source)obj;
- if (mode == Mode.PAYLOAD)
- {
- reqMsg = factory.createMessage();
- SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
- soapBody.setSource(source);
- }
- if (mode == Mode.MESSAGE)
- {
- TransformerFactory tf = TransformerFactory.newInstance();
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- tf.newTransformer().transform(source, new StreamResult(baos));
- reqMsg = factory.createMessage(null, new ByteArrayInputStream(baos.toByteArray()));
- }
- }
- else if (jaxbContext != null)
- {
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- marshaller.marshal(obj, baos);
- reqMsg = factory.createMessage();
- SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
- StreamSource source = new StreamSource(new ByteArrayInputStream(baos.toByteArray()));
- soapBody.setSource(source);
- }
- }
- catch (RuntimeException rte)
+ String bindingID = bindingProvider.getBinding().getBindingID();
+ if (EndpointMetaData.SUPPORTED_BINDINGS.contains(bindingID) == false)
+ throw new IllegalStateException("Unsupported binding: " + bindingID);
+
+ MessageAbstraction message;
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
{
- throw rte;
+ DispatchHTTPBindingHelper helper = new DispatchHTTPBindingHelper(mode, type, jaxbContext);
+ message = helper.getRequestMessage(obj);
}
- catch (Exception ex)
+ else
{
- throw new WebServiceException("Cannot create request message", ex);
+ DispatchSOAPBindingHelper helper = new DispatchSOAPBindingHelper(mode, type, jaxbContext);
+ message = helper.getRequestMessage(obj);
}
-
- if (reqMsg == null)
- throw new WebServiceException("Cannot create request message for: " + obj);
-
- return reqMsg;
+ return message;
}
- private Object getReturnObject(SOAPMessage resMsg)
+ private Object getReturnObject(MessageAbstraction resMsg)
{
+ String bindingID = bindingProvider.getBinding().getBindingID();
+ if (EndpointMetaData.SUPPORTED_BINDINGS.contains(bindingID) == false)
+ throw new IllegalStateException("Unsupported binding: " + bindingID);
+
Object retObj = null;
- try
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
{
- if (SOAPMessage.class.isAssignableFrom(type))
- {
- retObj = resMsg;
- }
- else if (Source.class.isAssignableFrom(type))
- {
- if (mode == Mode.PAYLOAD)
- {
- SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();
- SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
- retObj = new DOMSource(soapElement);
- }
- if (mode == Mode.MESSAGE)
- {
- SOAPEnvelope soapEnvelope = resMsg.getSOAPPart().getEnvelope();
- String xmlMessage = DOMWriter.printNode(soapEnvelope, false);
- retObj = new StreamSource(new StringReader(xmlMessage));
- }
- }
- else if (jaxbContext != null)
- {
- SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();
- SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
-
- if(log.isDebugEnabled()) log.debug("JAXB unmarshal: " + DOMWriter.printNode(soapElement, false));
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- retObj = unmarshaller.unmarshal(soapElement);
- }
+ DispatchHTTPBindingHelper helper = new DispatchHTTPBindingHelper(mode, type, jaxbContext);
+ retObj = helper.getReturnObject(resMsg);
}
- catch (RuntimeException rte)
+ else
{
- throw rte;
+ DispatchSOAPBindingHelper helper = new DispatchSOAPBindingHelper(mode, type, jaxbContext);
+ retObj = helper.getReturnObject(resMsg);
}
- catch (Exception ex)
- {
- throw new WebServiceException("Cannot process response message", ex);
- }
return retObj;
}
@@ -346,7 +295,7 @@
handler.handleResponse(response);
}
}
-
+
// 4.18 Conformance (Failed Dispatch.invokeAsync): When an operation is invoked using an invokeAsync
// method, an implementation MUST throw a WebServiceException if there is any error in the configuration
// of the Dispatch instance. Errors that occur during the invocation are reported when the client
@@ -355,7 +304,7 @@
{
String msg = "Cannot dispatch message";
log.error(msg, ex);
-
+
WebServiceException wsex;
if (ex instanceof WebServiceException)
{
Added: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java (rev 0)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -0,0 +1,175 @@
+/*
+ * 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.core.jaxws.client;
+
+// $Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.StringReader;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPMessage;
+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.transform.stream.StreamSource;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.soap.SOAPBodyImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.utils.DOMWriter;
+
+/**
+ * A helper that
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Apr-2007
+ */
+public class DispatchSOAPBindingHelper
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(DispatchSOAPBindingHelper.class);
+
+ private JAXBContext jaxbContext;
+ private Class type;
+ private Mode mode;
+
+ public DispatchSOAPBindingHelper(Mode mode, Class type, JAXBContext jaxbContext)
+ {
+ this.mode = mode;
+ this.type = type;
+ this.jaxbContext = jaxbContext;
+ }
+
+ public MessageAbstraction getRequestMessage(Object obj)
+ {
+ SOAPMessageImpl reqMsg = null;
+ try
+ {
+ MessageFactory factory = MessageFactory.newInstance();
+ if (SOAPMessage.class.isAssignableFrom(type))
+ {
+ reqMsg = (SOAPMessageImpl)obj;
+ }
+ else if (Source.class.isAssignableFrom(type))
+ {
+ Source source = (Source)obj;
+ if (mode == Mode.PAYLOAD)
+ {
+ reqMsg = (SOAPMessageImpl)factory.createMessage();
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
+ soapBody.setSource(source);
+ }
+ if (mode == Mode.MESSAGE)
+ {
+ TransformerFactory tf = TransformerFactory.newInstance();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ tf.newTransformer().transform(source, new StreamResult(baos));
+ reqMsg = (SOAPMessageImpl)factory.createMessage(null, new ByteArrayInputStream(baos.toByteArray()));
+ }
+ }
+ else if (jaxbContext != null)
+ {
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ marshaller.marshal(obj, baos);
+
+ reqMsg = (SOAPMessageImpl)factory.createMessage();
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
+ StreamSource source = new StreamSource(new ByteArrayInputStream(baos.toByteArray()));
+ soapBody.setSource(source);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Cannot create request message", ex);
+ }
+
+ if (reqMsg == null)
+ throw new WebServiceException("Cannot create request message for: " + obj);
+
+ return reqMsg;
+ }
+
+ public Object getReturnObject(MessageAbstraction message)
+ {
+ SOAPMessage resMsg = (SOAPMessage)message;
+
+ Object retObj = null;
+ try
+ {
+ if (SOAPMessage.class.isAssignableFrom(type))
+ {
+ retObj = resMsg;
+ }
+ else if (Source.class.isAssignableFrom(type))
+ {
+ if (mode == Mode.PAYLOAD)
+ {
+ SOAPBody soapBody = resMsg.getSOAPBody();
+ SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
+ retObj = new DOMSource(soapElement);
+ }
+ if (mode == Mode.MESSAGE)
+ {
+ SOAPEnvelope soapEnvelope = resMsg.getSOAPPart().getEnvelope();
+ String xmlMessage = DOMWriter.printNode(soapEnvelope, false);
+ retObj = new StreamSource(new StringReader(xmlMessage));
+ }
+ }
+ else if (jaxbContext != null)
+ {
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();
+ SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
+
+ log.debug("JAXB unmarshal: " + DOMWriter.printNode(soapElement, false));
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ retObj = unmarshaller.unmarshal(soapElement);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Cannot process response message", ex);
+ }
+ return retObj;
+ }
+}
Property changes on: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2007-04-02 12:29:48 UTC (rev 2747)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -59,12 +59,12 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.client.SOAPConnectionImpl;
import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.core.utils.ThreadLocalAssociation;
import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
Deleted: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/EndpointInfo.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/EndpointInfo.java 2007-04-02 12:29:48 UTC (rev 2747)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/EndpointInfo.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -1,100 +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.core.soap;
-
-// $Id$
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-
-/** A wrapper object that associates the target address with some metadata
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 20-Jul-2005
- */
-public class EndpointInfo
-{
- private String targetAddress;
- private Map<String, Object> properties;
- public EndpointInfo(EndpointMetaData epMetaData, String targetAddress, Map<String, Object> callProps)
- {
- this.targetAddress = targetAddress;
- this.properties = callProps;
-
- // Add the service properties
- Properties serviceProps = epMetaData.getServiceMetaData().getProperties();
- if (serviceProps != null)
- {
- Iterator it = serviceProps.entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- Object val = entry.getValue();
- properties.put(key, val);
- }
- }
-
- // Add the endpoint properties
- Properties epProps = epMetaData.getProperties();
- Iterator it = epProps.entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- Object val = entry.getValue();
- properties.put(key, val);
- }
-
- }
-
- public Map<String, Object> getProperties()
- {
- return properties;
- }
-
- public String getTargetAddress()
- {
- return targetAddress;
- }
-
- public boolean equals(Object obj)
- {
- if (!(obj instanceof EndpointInfo))
- return false;
- return toString().equals(obj.toString());
- }
-
- public int hashCode()
- {
- return toString().hashCode();
- }
-
- public String toString()
- {
- return "[addr=" + targetAddress + ",props=" + properties + "]";
- }
-}
\ No newline at end of file
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java 2007-04-02 12:29:48 UTC (rev 2747)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -60,6 +60,8 @@
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPException;
+import org.jboss.ws.core.client.SOAPConnectionImpl;
+
/**
* SOAP Connection Factory implementation
*
Deleted: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java 2007-04-02 12:29:48 UTC (rev 2747)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -1,426 +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.core.soap;
-
-// $Id$
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.SocketTimeoutException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.xml.rpc.Stub;
-import javax.xml.soap.MimeHeader;
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPConnection;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.addressing.EndpointReference;
-
-import org.jboss.logging.Logger;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.marshal.MarshalFactory;
-import org.jboss.ws.core.StubExt;
-import org.jboss.ws.core.WSTimeoutException;
-import org.jboss.ws.extensions.xop.XOPContext;
-
-/**
- * SOAPConnection implementation
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason@stacksmash.com">Jason T. Greene</a>
- *
- * @since 02-Feb-2005
- */
-public class SOAPConnectionImpl extends SOAPConnection
-{
- // provide logging
- private static Logger log = Logger.getLogger(SOAPConnectionImpl.class);
- private static Logger msgLog = Logger.getLogger("jbossws.SOAPMessage");
-
- private Map<String, Object> config = new HashMap<String, Object>();
-
- private static Map<String, String> metadataMap = new HashMap<String, String>();
- static
- {
- metadataMap.put(Stub.USERNAME_PROPERTY, "http.basic.username");
- metadataMap.put(Stub.PASSWORD_PROPERTY, "http.basic.password");
- metadataMap.put(BindingProvider.USERNAME_PROPERTY, "http.basic.username");
- metadataMap.put(BindingProvider.PASSWORD_PROPERTY, "http.basic.password");
- }
- private static Map<String, String> configMap = new HashMap<String, String>();
- static
- {
- // Remoting constants since 2.0.0.GA
- //configMap.put(StubExt.PROPERTY_KEY_STORE, SSLSocketBuilder.REMOTING_KEY_STORE_FILE_PATH);
- //configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD, SSLSocketBuilder.REMOTING_KEY_STORE_PASSWORD);
- //configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE, SSLSocketBuilder.REMOTING_KEY_STORE_TYPE);
- //configMap.put(StubExt.PROPERTY_TRUST_STORE, SSLSocketBuilder.REMOTING_TRUST_STORE_FILE_PATH);
- //configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD, SSLSocketBuilder.REMOTING_TRUST_STORE_PASSWORD);
- //configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE, SSLSocketBuilder.REMOTING_TRUST_STORE_TYPE);
-
- configMap.put(StubExt.PROPERTY_KEY_STORE, "org.jboss.remoting.keyStore");
- configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD, "org.jboss.remoting.keyStorePassword");
- configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE, "org.jboss.remoting.keyStoreType");
- configMap.put(StubExt.PROPERTY_TRUST_STORE, "org.jboss.remoting.trustStore");
- configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD, "org.jboss.remoting.trustStorePassword");
- configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE, "org.jboss.remoting.trustStoreType");
- }
-
- private boolean closed;
-
- public SOAPConnectionImpl()
- {
- // HTTPClientInvoker conect sends gratuitous POST
- // http://jira.jboss.com/jira/browse/JBWS-711
- config.put(Client.ENABLE_LEASE, false);
- }
-
- /**
- * Sends the given message to the specified endpoint and blocks until it has
- * returned the response.
- */
- public SOAPMessage call(SOAPMessage reqMessage, Object endpoint) throws SOAPException
- {
- if (reqMessage == null)
- throw new IllegalArgumentException("Given SOAPMessage cannot be null");
- return callInternal(reqMessage, endpoint, false);
- }
-
- /**
- * Sends an HTTP GET request to an endpoint and blocks until a SOAP message is received
- */
- public SOAPMessage get(Object endpoint) throws SOAPException
- {
- return callInternal(null, endpoint, false);
- }
-
- /**
- * Sends the given message to the specified endpoint. This method is logically
- * non blocking.
- */
- public SOAPMessage callOneWay(SOAPMessage reqMessage, Object endpoint) throws SOAPException
- {
- if (reqMessage == null)
- throw new IllegalArgumentException("Given SOAPMessage cannot be null");
- return callInternal(reqMessage, endpoint, true);
- }
-
- /**
- * Sends the given message to the specified endpoint.
- *
- * A null reqMessage signifies a HTTP GET request.
- */
- private SOAPMessage callInternal(SOAPMessage reqMessage, Object endpoint, boolean oneway) throws SOAPException
- {
- if (endpoint == null)
- throw new IllegalArgumentException("Given endpoint cannot be null");
-
- if (closed)
- throw new SOAPException("SOAPConnection is already closed");
-
- Object timeout = null;
- String targetAddress;
- Map<String, Object> callProps = new HashMap<String,Object>();
-
- if (endpoint instanceof EndpointInfo)
- {
- EndpointInfo epInfo = (EndpointInfo)endpoint;
- targetAddress = epInfo.getTargetAddress();
- callProps = epInfo.getProperties();
-
- if (callProps.containsKey(StubExt.PROPERTY_CLIENT_TIMEOUT))
- {
- timeout = callProps.get(StubExt.PROPERTY_CLIENT_TIMEOUT);
- targetAddress = addURLParameter(targetAddress, "timeout", timeout.toString());
- }
-
-
- }
- else if (endpoint instanceof EndpointReference)
- {
- EndpointReference epr = (EndpointReference)endpoint;
- targetAddress = epr.getAddress().toString();
- }
- else
- {
- targetAddress = endpoint.toString();
- }
-
- // enforce xop transitions
- // TODO: there should be a clear transition to an immutable object model
- XOPContext.eagerlyCreateAttachments();
-
- // save object model changes
- if (reqMessage != null && reqMessage.saveRequired())
- reqMessage.saveChanges();
-
- // setup remoting client
- Map<String, Object> metadata = createRemotingMetaData(reqMessage, callProps);
- Client client = createRemotingClient(endpoint, targetAddress, oneway);
-
- try
- {
- // debug the outgoing message
- if (reqMessage != null && msgLog.isTraceEnabled())
- {
- SOAPEnvelope soapReqEnv = reqMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapReqEnv, true);
- msgLog.trace("Remoting meta data: " + metadata);
- msgLog.trace("Outgoing SOAPMessage\n" + envStr);
- }
-
- SOAPMessage resMessage = null;
- try
- {
- if (oneway == true)
- {
- client.invokeOneway(reqMessage, metadata, false);
- }
- else
- {
- resMessage = (SOAPMessage)client.invoke(reqMessage, metadata);
- }
- }
- catch (RuntimeException rte)
- {
- Throwable cause = rte.getCause();
- // The CTS expects only SOAPException to be thrown.
- if (cause instanceof IOException && cause.getCause() instanceof SOAPException)
- throw cause.getCause();
- else if (timeout != null && cause instanceof SocketTimeoutException)
- throw new WSTimeoutException("Timeout after: " + timeout + "ms", new Long(timeout.toString()));
- else throw rte;
- }
-
- // Disconnect the remoting client
- client.disconnect();
-
- callProps.clear();
- callProps.putAll(metadata);
-
- // debug the incomming response message
- if (resMessage != null && msgLog.isTraceEnabled())
- {
- SOAPEnvelope soapResEnv = resMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapResEnv, true);
- msgLog.trace("Incoming Response SOAPMessage\n" + envStr);
- }
-
- return resMessage;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Throwable t)
- {
- throw new SOAPException("Could not transmit message", t);
- }
- }
-
- private String addURLParameter(String url, String key, String value)
- {
- int qmIndex = url.indexOf("?");
- url += (qmIndex < 0 ? "?" : "&") + key + "=" + value;
- return url;
- }
-
- /** Closes this SOAPConnection
- */
- public void close() throws SOAPException
- {
- if (closed)
- throw new SOAPException("SOAPConnection is already closed");
-
- closed = true;
- }
-
- private Client createRemotingClient(Object endpoint, String targetAddress, boolean oneway) throws SOAPException
- {
- Client client;
- try
- {
- // Get the invoker from Remoting for a given endpoint address
- if(log.isDebugEnabled()) log.debug("Get locator for: " + endpoint);
- targetAddress = addURLParameter(targetAddress, InvokerLocator.DATATYPE, "SOAPMessage");
- InvokerLocator locator = new InvokerLocator(targetAddress);
-
- /* An HTTPClientInvoker may disconnect from the server and recreated by the remoting layer.
- * In that case the new invoker does not inherit the marshaller/unmarshaller from the disconnected invoker.
- * We therefore explicitly specify the invoker locator datatype and register the SOAP marshaller/unmarshaller
- * with the MarshalFactory.
- *
- * This applies to remoting-1.4.5
- */
- SOAPMessageMarshaller marshaller = new SOAPMessageMarshaller();
- SOAPMessageUnMarshaller unmarshaller = new SOAPMessageUnMarshaller();
- MarshalFactory.addMarshaller("SOAPMessage", marshaller, unmarshaller);
-
- client = new Client(locator, "saaj", config);
- client.connect();
-
- client.setMarshaller(marshaller);
-
- if (oneway == false)
- client.setUnMarshaller(unmarshaller);
- }
- catch (MalformedURLException e)
- {
- throw new SOAPException("Malformed endpoint address", e);
- }
- catch (Exception e)
- {
- throw new SOAPException("Could not setup remoting client", e);
- }
- return client;
- }
-
- private Map<String, Object> createRemotingMetaData(SOAPMessage reqMessage, Map callProps) throws SOAPException
- {
-
- Map<String, Object> metadata = new HashMap<String, Object>();
-
- // We need to unmarshall faults (HTTP 500)
- // metadata.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true"); // since 2.0.0.GA
- metadata.put("NoThrowOnError", "true");
-
- if (reqMessage != null)
- populateHeaders(reqMessage, metadata);
- else
- metadata.put("TYPE", "GET");
-
- if (callProps != null)
- {
- Iterator it = callProps.entrySet().iterator();
-
- // Get authentication type, default to BASIC authetication
- String authType = (String)callProps.get(StubExt.PROPERTY_AUTH_TYPE);
- if (authType == null)
- authType = StubExt.PROPERTY_AUTH_TYPE_BASIC;
-
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- Object val = entry.getValue();
-
- // pass properties to remoting meta data
- if (metadataMap.containsKey(key))
- {
- String remotingKey = metadataMap.get(key);
- if ("http.basic.username".equals(remotingKey) || "http.basic.password".equals(remotingKey))
- {
- if (authType.equals(StubExt.PROPERTY_AUTH_TYPE_BASIC))
- {
- metadata.put(remotingKey, val);
- }
- else
- {
- log.warn("Ignore '" + key + "' with auth typy: " + authType);
- }
- }
- else
- {
- metadata.put(remotingKey, val);
- }
- }
-
- // pass properties to remoting client config
- if (configMap.containsKey(key))
- {
- String remotingKey = configMap.get(key);
- config.put(remotingKey, val);
- }
- }
- }
-
- return metadata;
- }
-
- private void populateHeaders(SOAPMessage reqMessage, Map<String, Object> metadata)
- {
- // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
- // with a quoted value equal to the value of the soapAction attribute of
- // soapbind:operation, if present in the corresponding WSDL description.
-
- // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
- // with a quoted empty string value, if in the corresponding WSDL description,
- // the soapAction attribute of soapbind:operation is either not present, or
- // present with an empty string as its value.
-
- MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
- String[] action = mimeHeaders.getHeader("SOAPAction");
- if (action != null && action.length > 0)
- {
- String soapAction = action[0];
-
- // R1109 The value of the SOAPAction HTTP header field in a HTTP request MESSAGE MUST be a quoted string.
- if (soapAction.startsWith("\"") == false || soapAction.endsWith("\"") == false)
- soapAction = "\"" + soapAction + "\"";
-
- mimeHeaders.setHeader("SOAPAction", soapAction);
- }
- else
- {
- mimeHeaders.setHeader("SOAPAction", "\"\"");
- }
-
- Properties props = new Properties();
- metadata.put("HEADER", props);
-
- Iterator i = mimeHeaders.getAllHeaders();
- while (i.hasNext())
- {
- MimeHeader header = (MimeHeader)i.next();
- String currentValue = props.getProperty(header.getName());
-
- /*
- * Coalesce multiple headers into one
- *
- * From HTTP/1.1 RFC 2616:
- *
- * Multiple message-header fields with the same field-name MAY be
- * present in a message if and only if the entire field-value for that
- * header field is defined as a comma-separated list [i.e., #(values)].
- * It MUST be possible to combine the multiple header fields into one
- * "field-name: field-value" pair, without changing the semantics of
- * the message, by appending each subsequent field-value to the first,
- * each separated by a comma.
- */
- if (currentValue != null)
- {
- props.put(header.getName(), currentValue + "," + header.getValue());
- }
- else
- {
- props.put(header.getName(), header.getValue());
- }
- }
- }
-}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2007-04-02 12:29:48 UTC (rev 2747)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -42,6 +42,7 @@
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;
@@ -59,7 +60,7 @@
* @author Thomas.Diesler(a)jboss.org
* @author <a href="mailto:jason@stacksmash.com">Jason T. Greene</a>
*/
-public class SOAPMessageImpl extends SOAPMessage
+public class SOAPMessageImpl extends SOAPMessage implements SOAPMessageAbstraction
{
private boolean saveRequired = true;
private MimeHeaders mimeHeaders = new MimeHeaders();
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/eventing/mgmt/Subscription.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/eventing/mgmt/Subscription.java 2007-04-02 12:29:48 UTC (rev 2747)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/eventing/mgmt/Subscription.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -37,7 +37,7 @@
import org.apache.xpath.XPathAPI;
import org.apache.xpath.objects.XObject;
import org.jboss.logging.Logger;
-import org.jboss.ws.core.soap.SOAPConnectionImpl;
+import org.jboss.ws.core.client.SOAPConnectionImpl;
import org.jboss.ws.core.utils.DOMWriter;
import org.jboss.ws.extensions.eventing.EventingConstants;
import org.jboss.ws.extensions.eventing.jaxws.AttributedURIType;
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/xop/XOPContext.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/xop/XOPContext.java 2007-04-02 12:29:48 UTC (rev 2747)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/xop/XOPContext.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -202,7 +202,7 @@
* If we would do this lazily (i.e. upon remoting callback) the previous content-type
* would already have been written.
*
- * @see org.jboss.ws.core.soap.SOAPConnectionImpl#callInternal(javax.xml.soap.SOAPMessage, Object, boolean)
+ * @see org.jboss.ws.core.client.SOAPConnectionImpl#callInternal(javax.xml.soap.SOAPMessage, Object, boolean)
* @see org.jboss.ws.core.soap.SOAPMessageMarshaller#write(Object, java.io.OutputStream)
*/
public static void eagerlyCreateAttachments()
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-04-02 12:29:48 UTC (rev 2747)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-04-02 15:41:10 UTC (rev 2748)
@@ -28,10 +28,12 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Observable;
import java.util.Properties;
+import java.util.Set;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import javax.xml.namespace.QName;
@@ -60,8 +62,8 @@
import org.jboss.ws.metadata.config.ConfigurationProvider;
import org.jboss.ws.metadata.config.EndpointFeature;
import org.jboss.ws.metadata.config.JBossWSConfigFactory;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
/**
* A Service component describes a set of endpoints.
@@ -79,6 +81,16 @@
JAXRPC, JAXWS
}
+ public static final Set<String> SUPPORTED_BINDINGS = new HashSet<String>();
+ static
+ {
+ SUPPORTED_BINDINGS.add(Constants.SOAP11HTTP_BINDING);
+ SUPPORTED_BINDINGS.add(Constants.SOAP12HTTP_BINDING);
+ SUPPORTED_BINDINGS.add(Constants.SOAP11HTTP_MTOM_BINDING);
+ SUPPORTED_BINDINGS.add(Constants.SOAP12HTTP_MTOM_BINDING);
+ SUPPORTED_BINDINGS.add(Constants.HTTP_BINDING);
+ }
+
// The parent meta data.
private ServiceMetaData serviceMetaData;
@@ -154,7 +166,7 @@
}
public void setPortName(QName portName)
- {
+ {
this.portName = portName;
}
@@ -180,11 +192,8 @@
public void setBindingId(String bindingId)
{
- if (!Constants.SOAP11HTTP_BINDING.equals(bindingId) && !Constants.SOAP12HTTP_BINDING.equals(bindingId) && !Constants.SOAP11HTTP_MTOM_BINDING.equals(bindingId)
- && !Constants.SOAP12HTTP_MTOM_BINDING.equals(bindingId))
- {
+ if (SUPPORTED_BINDINGS.contains(bindingId) == false)
throw new WSException("Unsupported binding: " + bindingId);
- }
this.bindingId = bindingId;
}
@@ -327,7 +336,7 @@
public Properties getProperties()
{
- if(null == this.properties)
+ if (null == this.properties)
this.properties = new Properties();
return this.properties;
}
@@ -734,8 +743,7 @@
boolean match;
if (seiName != null && portName != null)
match = getServiceEndpointInterfaceName().equals(seiName) && portName.equals(portName);
- else
- match = getServiceEndpointInterfaceName().equals(seiName) || getPortName().equals(portName);
+ else match = getServiceEndpointInterfaceName().equals(seiName) || getPortName().equals(portName);
return match;
}
17 years
JBossWS SVN: r2747 - branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-04-02 08:29:48 -0400 (Mon, 02 Apr 2007)
New Revision: 2747
Modified:
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java
Log:
Add httpbinding testcase
Modified: branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java
===================================================================
--- branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java 2007-04-02 12:13:46 UTC (rev 2746)
+++ branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpPayloadTestCase.java 2007-04-02 12:29:48 UTC (rev 2747)
@@ -23,23 +23,17 @@
// $Id$
-import java.io.ByteArrayInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPConnection;
-import javax.xml.soap.SOAPConnectionFactory;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.Service.Mode;
-import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.http.HTTPBinding;
import junit.framework.Test;
@@ -58,11 +52,9 @@
*/
public class HttpPayloadTestCase extends JBossWSTest
{
- private String reqString =
- "<ns1:somePayload xmlns:ns1='http://org.jboss.ws/httpbinding'>Hello</ns1:somePayload>";
+ private String reqString = "<ns1:somePayload xmlns:ns1='http://org.jboss.ws/httpbinding'>Hello</ns1:somePayload>";
- private String resString =
- "<ns1:somePayload xmlns:ns1='http://org.jboss.ws/httpbinding'>Hello:InboundLogicalHandler:OutboundLogicalHandler</ns1:somePayload>";
+ private String resString = "<ns1:somePayload xmlns:ns1='http://org.jboss.ws/httpbinding'>Hello:InboundLogicalHandler:OutboundLogicalHandler</ns1:somePayload>";
public static Test suite()
{
@@ -81,35 +73,11 @@
{
Dispatch<Source> dispatch = createDispatch("ProviderEndpoint");
Source resPayload = dispatch.invoke(new DOMSource(DOMUtils.parse(reqString)));
-
+
Element docElement = getElementFromSource(resPayload);
assertEquals(DOMUtils.parse(resString), docElement);
}
- public void testProviderMessage() throws Exception
- {
- String reqEnvStr =
- "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
- " <env:Body>" + reqString + "</env:Body>" +
- "</env:Envelope>";
-
- String resEnvString =
- "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
- " <env:Header/>" +
- " <env:Body>" + resString + "</env:Body>" +
- "</env:Envelope>";
-
- MessageFactory msgFactory = MessageFactory.newInstance();
- SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
- SOAPMessage reqMsg = msgFactory.createMessage(null, new ByteArrayInputStream(reqEnvStr.getBytes()));
-
- URL epURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-httpbinding-payload");
- SOAPMessage resMsg = con.call(reqMsg, epURL);
- SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
-
- assertEquals(DOMUtils.parse(resEnvString), resEnv);
- }
-
private Dispatch<Source> createDispatch(String target) throws MalformedURLException, JAXBException
{
String targetNS = "http://org.jboss.ws/httpbinding";
@@ -118,8 +86,8 @@
URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-httpbinding-payload/" + target + "?wsdl");
Service service = Service.create(serviceName);
- service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, wsdlURL.toExternalForm());
-
+ service.addPort(portName, HTTPBinding.HTTP_BINDING, wsdlURL.toExternalForm());
+
Dispatch<Source> dispatch = service.createDispatch(portName, Source.class, Mode.PAYLOAD);
return dispatch;
}
17 years