Skip to main content

MTOM in JAXWS 2.0 RI EA3

Posted by vivekp on January 17, 2006 at 5:52 PM PST

MTOM support has been there since JAX-WS 2.0 EA2 release.
There are 2 ways you can try it - join the

jax-ws
 project on
java.net
and get the jaxws

distribution
or you can install

JWSDP 2.0
.



By default MTOM encoding is disabled. To enable MTOM on a service all you need to do is to add enable-mtom attribute on the endpoint descriptor element.



Here is a sample descriptor from the mtom sample:

<endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime'
version='2.0'
>
   
<endpoint
       
name="Mtom"
       
implementation="mtom.server.HelloImpl"
       
wsdl="WEB-INF/wsdl/hello.wsdl"
       
service='{http://example.org/mtom}HelloService'
       
port='{http://example.org/mtom}HelloPort'
       
url-pattern="/hello"
        enable-mtom="true"
       
mtom-threshold-value="0"/>
</endpoints>


On the client side, you can use SOAPBinding.setMTOMEnable(). For example,
Object port = new HelloService().getHelloPort ();



//get the binding and enable mtom

SOAPBinding binding = (SOAPBinding)((BindingProvider)port).getBinding ();

binding.setMTOMEnabled (true);

Thats pretty much what you need to do to enable MTOM.  For details see the


MTOM online documentation
in

jaxws-ws
project on
java.net
. to try the sample,
assuming you have JWSDP 2.0 installed with S1AS 8.2_02, try the mtom samples:
$JWSDP_HOME/jaxws/samples/mtom
and $JWSDP_HOME/jaxws/mtom-soap12.
Here $JWSDP_HOME is where you installed JWSDP 2.0.

You can post your queries to
jax-ws dev
mailing alias.


Related Topics >>