MTOM in JAXWS 2.0 RI EA3
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:
<p><endpoints xmlns='<a href="http://java.sun.com/xml/ns/jax-ws/ri/runtime'%20version='2.0'">http://java.sun.com/xml/ns/jax-ws/ri/runtime'
version='2.0'</a>><br>
<endpoint<br>
name="Mtom"<br>
implementation="mtom.server.HelloImpl"<br>
wsdl="WEB-INF/wsdl/hello.wsdl"<br>
service='{<a href="http://example.org/mtom}HelloService">http://example.org/mtom}HelloService</a>'<br>
port='{<a href="http://example.org/mtom}HelloPort">http://example.org/mtom}HelloPort</a>'<br>
url-pattern="/hello"<br> <b>enable-mtom</b>="true" <br>
<b>mtom-threshold-value</b>="0"/><br></endpoints></p>On the client side, you can use SOAPBinding.setMTOMEnable(). For example,
Object port = new HelloService().getHelloPort ();<br>
<br>
//get the binding and enable mtom<br>
SOAPBinding binding = (SOAPBinding)((BindingProvider)port).getBinding ();<br>
binding.<b>setMTOMEnabled</b> (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.
- Login or register to post comments
- Printer-friendly version
- vivekp's blog
- 1554 reads





