Author: heiko.braun(a)jboss.com
Date: 2006-12-08 10:00:40 -0500 (Fri, 08 Dec 2006)
New Revision: 1615
Added:
trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/ImageRequest.java
trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/ImageResponse.java
trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/SourceRequest.java
trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/SourceResponse.java
Modified:
trunk/build.xml
trunk/src/main/java/javax/xml/ws/soap/SOAPBinding.java
trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java
trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java
trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java
trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java
trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
trunk/src/main/java/org/jboss/ws/core/jaxws/spi/EndpointImpl.java
trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
trunk/src/main/java/org/jboss/ws/extensions/xop/XOPContext.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/DHRequest.java
trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/DHResponse.java
trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/MTOMEndpoint.java
trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/MTOMEndpointBean.java
trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/XOPTestCase.java
Log:
Handling of SOAPBinding.setMTOMEnabled()
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2006-12-08 08:43:18 UTC (rev 1614)
+++ trunk/build.xml 2006-12-08 15:00:40 UTC (rev 1615)
@@ -34,6 +34,7 @@
<property name="build.samples.dir"
value="${build.dir}/samples"/>
<property name="build.bin.dist"
value="${build.dir}/bin-dist"/>
<property name="build.src.dist"
value="${build.dir}/src-dist"/>
+ <property name="build.api" value="${build.dir}/api"/>
<property name="docs.userguide.dir"
value="${basedir}/docs/user-guide/project"/>
<property name="src.dir" value="${basedir}/src/main"/>
<property name="src.etc.dir" value="${src.dir}/etc"/>
@@ -358,19 +359,29 @@
<!-- ================================================================== -->
<!-- Documentation -->
<!-- ================================================================== -->
+
+ <!-- Generate the JavaDoc -->
+ <target name="javadoc" depends="init"
description="Generate the Javadoc">
+
+ <mkdir dir="${build.api}"/>
+ <javadoc destdir="${build.api}" author="true"
version="true" use="true" windowtitle="JBossWS API">
+ <packageset dir="${src.java.dir}"
defaultexcludes="yes">
+ <include name="org/jboss/ws/**"/>
+ </packageset>
+ <packageset dir="${jboss.server.root}/../src/main"
defaultexcludes="yes">
+ <include name="org/jboss/webservice/metadata/**"/>
+ </packageset>
+
+ <doctitle><![CDATA[<h1>JBossWS</h1>]]></doctitle>
+ <tag name="todo" scope="all" description="To
do:"/>
+ <group title="Core" packages="org.jboss.ws.core*"/>
+ <group title="Metadata"
packages="org.jboss.ws.metadata*"/>
+ <group title="Integration"
packages="org.jboss.ws.integration*"/>
+ <group title="Extensions"
packages="org.jboss.ws.extensions*"/>
+ <group title="Tools" packages="org.jboss.ws.tools*"/>
+ </javadoc>
+ </target>
- <!-- Generate the JavaDoc -->
- <target name="javadoc" depends="init" description="Generate
the Javadoc">
- <javadoc destdir="${build.api}" author="true"
version="true" use="true" windowtitle="JBossWS API">
- <packageset dir="${src.java.dir}" defaultexcludes="yes">
- <include name="org/jboss/ws/**"/>
- </packageset>
- <packageset dir="${jboss.server.root}/../src/main"
defaultexcludes="yes">
- <include name="org/jboss/webservice/metadata/**"/>
- </packageset>
- </javadoc>
- </target>
-
<!-- ================================================================== -->
<!-- Deployment -->
<!-- ================================================================== -->
Modified: trunk/src/main/java/javax/xml/ws/soap/SOAPBinding.java
===================================================================
--- trunk/src/main/java/javax/xml/ws/soap/SOAPBinding.java 2006-12-08 08:43:18 UTC (rev
1614)
+++ trunk/src/main/java/javax/xml/ws/soap/SOAPBinding.java 2006-12-08 15:00:40 UTC (rev
1615)
@@ -36,12 +36,29 @@
*/
public interface SOAPBinding extends Binding
{
- /** A constant representing the identity of the SOAP 1.1 over HTTP binding. */
- public static 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 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.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";
+
+
public abstract Set<URI> getRoles();
public abstract void setRoles(Set<URI> set);
Modified: trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2006-12-08 08:43:18 UTC
(rev 1614)
+++ trunk/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2006-12-08 15:00:40 UTC
(rev 1615)
@@ -89,11 +89,28 @@
private boolean mtomEnabled;
- /** A constant representing the identity of the SOAP 1.2 over HTTP 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.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. */
- 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
+ * 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";
+
private static final Name SOAP_ARRAY_NAME = new NameImpl("Array",
Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
public CommonSOAPBinding()
@@ -136,8 +153,10 @@
// Disable MTOM for rpc/encoded
if (opMetaData.isRPCEncoded())
- msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
-
+ XOPContext.setMTOMEnabled(false);
+ else
+ XOPContext.setMTOMEnabled( isMTOMEnabled() );
+
// Associate current message with message context
SOAPMessageImpl reqMessage = (SOAPMessageImpl)createMessage(opMetaData);
msgContext.setSOAPMessage(reqMessage);
@@ -269,7 +288,7 @@
// Disable MTOM for rpc/encoded
if (opMetaData.isRPCEncoded())
msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
-
+
// Get the namespace registry
NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
@@ -384,8 +403,10 @@
// Disable MTOM for rpc/encoded
if (opMetaData.isRPCEncoded())
- msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
-
+ XOPContext.setMTOMEnabled(false);
+ else
+ XOPContext.setMTOMEnabled( isMTOMEnabled() );
+
// Associate current message with message context
SOAPMessageImpl resMessage = (SOAPMessageImpl)createMessage(opMetaData);
msgContext.setSOAPMessage(resMessage);
@@ -509,7 +530,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)
- throws BindingException
+ throws BindingException
{
log.debug("unbindResponseMessage: " + opMetaData.getQName());
@@ -541,7 +562,7 @@
// Disable MTOM for rpc/encoded
if (opMetaData.isRPCEncoded())
msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
-
+
SOAPHeader soapHeader = soapEnvelope.getHeader();
SOAPBody soapBody = soapEnvelope.getBody();
Iterator bodyChildren = soapBody.getChildElements();
@@ -656,7 +677,7 @@
handleException(e);
}
}
-
+
public abstract SOAPMessage exceptionToFaultMessage(Exception ex);
private void verifySOAPVersion(OperationMetaData opMetaData, SOAPEnvelope
soapEnvelope)
@@ -785,7 +806,7 @@
// When a potential xop parameter is detected and MTOM is enabled
// we flag the SOAP message as a XOP package
- if (paramMetaData.isXOP() && XOPContext.isMTOMEnabled())
+ if (paramMetaData.isXOP() && XOPContext.isMTOMEnabled())
{
log.trace("Add parameter as XOP");
CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
Modified: trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java 2006-12-08
08:43:18 UTC (rev 1614)
+++ trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -40,6 +40,11 @@
// Delegate to JAXWS SOAP binding
private SOAPBindingJAXRPC delegate = new SOAPBindingJAXRPC();
+ public SOAP11BindingJAXRPC() {
+ super();
+ setMTOMEnabled(true);
+ }
+
public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage)
{
delegate.setSOAPActionHeader(opMetaData, reqMessage);
Modified: trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java 2006-12-08
08:43:18 UTC (rev 1614)
+++ trunk/src/main/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -40,6 +40,11 @@
// Delegate to JAXWS SOAP binding
private SOAPBindingJAXRPC delegate = new SOAPBindingJAXRPC();
+ public SOAP12BindingJAXRPC() {
+ super();
+ setMTOMEnabled(true);
+ }
+
public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage)
{
delegate.setSOAPActionHeader(opMetaData, reqMessage);
Modified: trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java 2006-12-08
08:43:18 UTC (rev 1614)
+++
trunk/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -74,10 +74,18 @@
{
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();
Modified: trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java 2006-12-08
08:43:18 UTC (rev 1614)
+++ trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -52,8 +52,15 @@
public SOAP11BindingJAXWS()
{
+ super();
+ setMTOMEnabled(false);
}
+ public SOAP11BindingJAXWS(boolean mtomEnabled) {
+ super();
+ setMTOMEnabled(mtomEnabled);
+ }
+
public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage)
{
delegate.setSOAPActionHeader(opMetaData, reqMessage);
Modified: trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2006-12-08
08:43:18 UTC (rev 1614)
+++ trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -53,8 +53,14 @@
public SOAP12BindingJAXWS()
{
+ super();
+ setMTOMEnabled(false);
}
+ public SOAP12BindingJAXWS(boolean mtomEnabled) {
+ setMTOMEnabled(mtomEnabled);
+ }
+
public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage)
{
delegate.setSOAPActionHeader(opMetaData, reqMessage);
Modified: trunk/src/main/java/org/jboss/ws/core/jaxws/spi/EndpointImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxws/spi/EndpointImpl.java 2006-12-08 08:43:18
UTC (rev 1614)
+++ trunk/src/main/java/org/jboss/ws/core/jaxws/spi/EndpointImpl.java 2006-12-08 15:00:40
UTC (rev 1615)
@@ -91,7 +91,7 @@
* implementation using some default configuration. In order to get more control over
the server configuration,
* please use the javax.xml.ws.Endpoint#publish(Object) method instead.
*
- * @param A URI specifying the address to use. The address must be compatible with the
binding specified at the time the endpoint was created.
+ * @param URI specifying the address to use. The address must be compatible with the
binding specified at the time the endpoint was created.
*/
@Override
public void publish(String address)
Modified:
trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2006-12-08
08:43:18 UTC (rev 1614)
+++
trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -23,30 +23,10 @@
// $Id$
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.UndeclaredThrowableException;
-
-import javax.management.MBeanException;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPBodyElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.Binding;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.handler.MessageContext;
-
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
-import org.jboss.ws.core.CommonBinding;
-import org.jboss.ws.core.CommonBindingProvider;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.CommonSOAPBinding;
-import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.extensions.xop.XOPContext;
+import org.jboss.ws.core.*;
import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
import org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS;
@@ -55,10 +35,21 @@
import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+import javax.management.MBeanException;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.*;
+import javax.xml.ws.Binding;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.MessageContext;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+
/** An implementation handles invocations on the endpoint
*
* @author Thomas.Diesler(a)jboss.org
@@ -183,6 +174,9 @@
if (epMetaData.getType() == EndpointMetaData.Type.JAXWS)
msgContext.setProperty(MessageContext.MESSAGE_OUTBOUND_PROPERTY, new
Boolean(true));
+ if(binding instanceof CommonSOAPBinding)
+ XOPContext.setMTOMEnabled( ((CommonSOAPBinding)binding).isMTOMEnabled());
+
// Bind the response message
SOAPMessage resMessage = (SOAPMessage)binding.bindResponseMessage(opMetaData,
epInv);
msgContext.setSOAPMessage(resMessage);
Modified: trunk/src/main/java/org/jboss/ws/extensions/xop/XOPContext.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/extensions/xop/XOPContext.java 2006-12-08 08:43:18
UTC (rev 1614)
+++ trunk/src/main/java/org/jboss/ws/extensions/xop/XOPContext.java 2006-12-08 15:00:40
UTC (rev 1615)
@@ -21,18 +21,6 @@
*/
package org.jboss.ws.extensions.xop;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.Iterator;
-
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
@@ -47,11 +35,17 @@
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.core.utils.MimeUtils;
import org.jboss.ws.extensions.xop.jaxrpc.XOPMarshallerImpl;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.jboss.xb.binding.sunday.xop.XOPMarshaller;
import org.jboss.xb.binding.sunday.xop.XOPObject;
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.soap.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.Iterator;
+
/**
* XOP context associated with a message context.
* Acts as a facade to the current soap message and supports the various XOP
transitions.<p>
@@ -125,18 +119,9 @@
*/
public static boolean isMTOMEnabled()
{
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- boolean isJAXWS = msgContext.getEndpointMetaData().getType() ==
EndpointMetaData.Type.JAXWS;
-
- if (isJAXWS)
- {
- return msgContext.getEndpointMetaData().isMtomEnabled();
- }
- else
- {
- Boolean mtomEnabled =
(Boolean)msgContext.getProperty(StubExt.PROPERTY_MTOM_ENABLED);
- return Boolean.TRUE.equals(mtomEnabled) || mtomEnabled == null;
- }
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ Boolean mtomEnabled =
(Boolean)msgContext.getProperty(StubExt.PROPERTY_MTOM_ENABLED);
+ return Boolean.TRUE.equals(mtomEnabled) || mtomEnabled == null;
}
public static void setMTOMEnabled(boolean b)
Modified:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java 2006-12-08
08:43:18 UTC (rev 1614)
+++
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -50,18 +50,7 @@
String uri = anBindingType.value();
if (uri.length() > 0)
{
- // TODO: switch to JAX-WS 2.1
- // This allows us to use constants here and reuse the orig. URI straigt away
-
if(uri.equals("http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true&q...
- {
- log.debug("MTOM enabled endpoint found");
- epMetaData.setMtomEnabled(true);
- epMetaData.setBindingId(uri.substring(0, uri.indexOf("?")));
- }
- else
- {
- epMetaData.setBindingId(uri);
- }
+ epMetaData.setBindingId(uri);
}
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2006-12-08
08:43:18 UTC (rev 1614)
+++ trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -23,19 +23,6 @@
// $Id$
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.jws.soap.SOAPBinding.ParameterStyle;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.ws.Service.Mode;
-
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
@@ -49,9 +36,17 @@
import org.jboss.ws.core.jaxws.JAXBDeserializerFactory;
import org.jboss.ws.core.jaxws.JAXBSerializerFactory;
import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.core.CommonSOAPBinding;
import org.jboss.ws.metadata.config.WSCommonConfig;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+import javax.jws.soap.SOAPBinding.ParameterStyle;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.ws.Service.Mode;
+import java.lang.reflect.Method;
+import java.util.*;
+
/**
* A Service component describes a set of endpoints.
*
@@ -113,9 +108,6 @@
// Maps the java method to the operation meta data
private Map<Method, OperationMetaData> opMetaDataCache = new HashMap<Method,
OperationMetaData>();
- // JAX-WS default is false
- private boolean mtomEnabled = false;
-
public EndpointMetaData(ServiceMetaData service, QName qname, QName interfaceQName,
Type type)
{
this.serviceMetaData = service;
@@ -183,8 +175,14 @@
public void setBindingId(String bindingId)
{
- if (!Constants.SOAP11HTTP_BINDING.equals(bindingId) &&
!Constants.SOAP12HTTP_BINDING.equals(bindingId))
+ if (!CommonSOAPBinding.SOAP11HTTP_BINDING.equals(bindingId)
+ && !CommonSOAPBinding.SOAP12HTTP_BINDING.equals(bindingId)
+ && !CommonSOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bindingId)
+ && !CommonSOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bindingId))
+ {
throw new WSException("Unsupported binding: " + bindingId);
+ }
+
this.bindingId = bindingId;
}
@@ -315,14 +313,6 @@
return type;
}
- public boolean isMtomEnabled() {
- return mtomEnabled;
- }
-
- public void setMtomEnabled(boolean mtomEnabled) {
- this.mtomEnabled = mtomEnabled;
- }
-
public String getAuthMethod()
{
return authMethod;
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/DHRequest.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/DHRequest.java 2006-12-08
08:43:18 UTC (rev 1614)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/DHRequest.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -25,7 +25,7 @@
import javax.xml.bind.annotation.XmlMimeType;
import javax.xml.bind.annotation.XmlType;
-@XmlType(name="request", namespace =
"http://org.jboss.ws/xop/doclit")
+@XmlType(name="dataRequest", namespace =
"http://org.jboss.ws/xop/doclit")
public class DHRequest {
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/DHResponse.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/DHResponse.java 2006-12-08
08:43:18 UTC (rev 1614)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/DHResponse.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -25,7 +25,7 @@
import javax.xml.bind.annotation.XmlMimeType;
import javax.xml.bind.annotation.XmlType;
-@XmlType(name="response", namespace =
"http://org.jboss.ws/xop/doclit")
+@XmlType(name="dataResponse", namespace =
"http://org.jboss.ws/xop/doclit")
public class DHResponse {
Added: trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/ImageRequest.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/ImageRequest.java 2006-12-08
08:43:18 UTC (rev 1614)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/ImageRequest.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -0,0 +1,42 @@
+/*
+* 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.xop.doclit;
+
+import javax.xml.bind.annotation.XmlType;
+import java.awt.*;
+
+@XmlType(name="imageRequest", namespace =
"http://org.jboss.ws/xop/doclit")
+public class ImageRequest {
+
+ private Image data;
+
+
+ public Image getData()
+ {
+ return data;
+ }
+
+ public void setData(Image data)
+ {
+ this.data = data;
+ }
+}
Added: trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/ImageResponse.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/ImageResponse.java 2006-12-08
08:43:18 UTC (rev 1614)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/ImageResponse.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -0,0 +1,51 @@
+/*
+* 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.xop.doclit;
+
+import javax.xml.bind.annotation.XmlType;
+import java.awt.*;
+
+@XmlType(name="imageResponse", namespace =
"http://org.jboss.ws/xop/doclit")
+public class ImageResponse {
+
+ private Image data;
+
+
+ public ImageResponse()
+ {
+ }
+
+ public ImageResponse(Image data)
+ {
+ this.data = data;
+ }
+
+ public Image getData()
+ {
+ return data;
+ }
+
+ public void setData(Image data)
+ {
+ this.data = data;
+ }
+}
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/MTOMEndpoint.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/MTOMEndpoint.java 2006-12-08
08:43:18 UTC (rev 1614)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/MTOMEndpoint.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -13,4 +13,6 @@
public interface MTOMEndpoint {
public DHResponse echoDataHandler(DHRequest request);
+ public ImageResponse echoImage(ImageRequest request);
+ public SourceResponse echoSource(SourceRequest request);
}
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/MTOMEndpointBean.java
===================================================================
---
trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/MTOMEndpointBean.java 2006-12-08
08:43:18 UTC (rev 1614)
+++
trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/MTOMEndpointBean.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -47,8 +47,17 @@
throw new WSException(e);
}
- return new DHResponse(
- request.getDataHandler()
- );
+ return new DHResponse( request.getDataHandler() );
}
+
+
+ public ImageResponse echoImage(ImageRequest request)
+ {
+ return new ImageResponse(request.getData());
+ }
+
+ public SourceResponse echoSource(SourceRequest request)
+ {
+ return new SourceResponse(request.getData());
+ }
}
Added: trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/SourceRequest.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/SourceRequest.java 2006-12-08
08:43:18 UTC (rev 1614)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/SourceRequest.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -0,0 +1,41 @@
+/*
+* 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.xop.doclit;
+
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.transform.Source;
+
+@XmlType(name="sourceRequest", namespace =
"http://org.jboss.ws/xop/doclit")
+public class SourceRequest {
+
+ Source data;
+
+ public Source getData()
+ {
+ return data;
+ }
+
+ public void setData(Source data)
+ {
+ this.data = data;
+ }
+}
Added: trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/SourceResponse.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/SourceResponse.java 2006-12-08
08:43:18 UTC (rev 1614)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/SourceResponse.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -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.test.ws.jaxws.xop.doclit;
+
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.transform.Source;
+
+@XmlType(name="sourceResponse", namespace =
"http://org.jboss.ws/xop/doclit")
+public class SourceResponse {
+
+ private Source data;
+
+ public SourceResponse()
+ {
+ }
+
+ public SourceResponse(Source data)
+ {
+ this.data = data;
+ }
+
+ public Source getData()
+ {
+ return data;
+ }
+
+ public void setData(Source data)
+ {
+ this.data = data;
+ }
+}
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/XOPTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/XOPTestCase.java 2006-12-08
08:43:18 UTC (rev 1614)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/xop/doclit/XOPTestCase.java 2006-12-08
15:00:40 UTC (rev 1615)
@@ -23,16 +23,19 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.test.ws.jaxrpc.xop.XOPTestSupport;
import junit.framework.Test;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Binding;
import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.transform.Source;
import javax.activation.DataHandler;
import java.net.URL;
+import java.awt.image.BufferedImage;
+import java.awt.*;
import java.util.Map;
-import java.awt.image.BufferedImage;
+import java.io.InputStream;
/**
* @author Heiko Braun <heiko.braun(a)jboss.com>
@@ -40,10 +43,11 @@
* @since 05.12.2006
*/
public class XOPTestCase extends JBossWSTest {
-
+
public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() +
":8080/jaxws-xop-doclit/MTOMEndpointBean";
- private MTOMEndpoint mtomWS;
+ private MTOMEndpoint port;
+ private SOAPBinding binding;
public static Test suite()
{
@@ -57,27 +61,96 @@
URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS+"?wsdl");
javax.xml.ws.Service service = javax.xml.ws.Service.create(wsdlURL, serviceName);
- mtomWS = service.getPort(MTOMEndpoint.class);
+ port = service.getPort(MTOMEndpoint.class);
// enable MTOM
- SOAPBinding binding = (SOAPBinding)((BindingProvider)mtomWS).getBinding();
- binding.setMTOMEnabled(true);
+ binding = (SOAPBinding)((BindingProvider) port).getBinding();
// debug request/reponse
- /*
- BindingProvider bp = (BindingProvider)mtomWS;
- Map<String,Object> context = bp.getRequestContext();
+
+ BindingProvider bp = (BindingProvider)port;
+ Map<String,Object> context = bp.getRequestContext();
context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://" +
getServerHost() + ":8081/jaxws-xop-doclit/MTOMEndpointBean");
- */
+
}
- public void testRequestResponseOptimized() throws Exception
+ public void testDHRoundtrip() throws Exception
{
+ binding.setMTOMEnabled(true);
+
URL url = new URL("file:resources/jaxws/xop/shared/attach.jpeg");
- DataHandler dh = new DataHandler(url);
- DHResponse response = mtomWS.echoDataHandler(new DHRequest(dh));
+ DataHandler dh = new DataHandler(url);
+ DHResponse response = port.echoDataHandler(new DHRequest(dh));
assertNotNull(response);
assertEquals(response.getDataHandler().getContentType(), "image/jpeg");
assertTrue(response.getDataHandler().getContent() instanceof BufferedImage);
}
+
+ public void testDHResponseOptimzed() throws Exception
+ {
+ binding.setMTOMEnabled(false);
+
+ URL url = new URL("file:resources/jaxws/xop/shared/attach.jpeg");
+ DataHandler dh = new DataHandler(url);
+ DHResponse response = port.echoDataHandler(new DHRequest(dh));
+ assertNotNull(response);
+ assertEquals(response.getDataHandler().getContentType(),
"application/octet-stream");
+ assertTrue("Wrong java type returned",
response.getDataHandler().getContent() instanceof InputStream);
+ }
+
+ public void testImgRoundtrip() throws Exception
+ {
+ binding.setMTOMEnabled(true);
+
+ Image img = XOPTestSupport.createTestImage();
+ ImageRequest request = new ImageRequest();
+ request.setData(img);
+
+ ImageResponse response = port.echoImage(request);
+
+ assertNotNull(response);
+ assertTrue(response.getData() instanceof Image);
+ }
+
+ public void testImgResponseOptimized() throws Exception
+ {
+ binding.setMTOMEnabled(false);
+
+ Image img = XOPTestSupport.createTestImage();
+ ImageRequest request = new ImageRequest();
+ request.setData(img);
+
+ ImageResponse response = port.echoImage(request);
+
+ assertNotNull(response);
+ assertTrue(response.getData() instanceof Image);
+ }
+
+ public void testSrcRoundtrip() throws Exception
+ {
+ binding.setMTOMEnabled(true);
+
+ Source src = XOPTestSupport.createTestSource();
+ SourceRequest request = new SourceRequest();
+ request.setData(src);
+
+ SourceResponse response = port.echoSource(request);
+
+ assertNotNull(response);
+ assertTrue(response.getData() instanceof Source);
+ }
+
+ public void testSrcResponseOptimized() throws Exception
+ {
+ binding.setMTOMEnabled(false);
+
+ Source src = XOPTestSupport.createTestSource();
+ SourceRequest request = new SourceRequest();
+ request.setData(src);
+
+ SourceResponse response = port.echoSource(request);
+
+ assertNotNull(response);
+ assertTrue(response.getData() instanceof Source);
+ }
}
\ No newline at end of file