The moose likes Web Services and the fly likes Axis2: Enforce incoming messages must be MTOMised Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Axis2: Enforce incoming messages must be MTOMised" Watch "Axis2: Enforce incoming messages must be MTOMised" New topic

Axis2: Enforce incoming messages must be MTOMised

sin pillai

Joined: Mar 30, 2010
Posts: 5

I am exploring MTOM to send binary attachment to service using Axis2 (1.6.2). I was able to get my sample example working.
However, the problem i am facing is how to enforce that incoming messages must be MTOMised (prevent client from sending binary data embedded in message)

I tried using WS-MTOMPolicy assertion in the WSDL

Below is snippet:

<wsp:Policy wsu:Id="wsmtom_policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
<wsoma:OptimizedMimeSerialization xmlns:wsoma="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" />

and attached it to binding

<wsp:PolicyReference URI="#wsmtom_policy" wsdl:required="true"></wsp:PolicyReference>

I assumed that client will receive an exception when it tries to send the binary data as base64 encoded in request.. But found that
it didnt happen. The server accepted both base64 and MTOM message.

I then tried setting the attribute optional=false,
<wsoma:optimizedmimeserialization optional="false">
That didnt work.

Next, i tried to add WS-MTOMPolicy to service.xml. That didnt work either.

I am not sure if my understanding is incorrect or if there is any actually a way do such an enforcement on incoming message.

Appreciate any pointer or help.


It is sorta covered in the JavaRanch Style Guide.
subject: Axis2: Enforce incoming messages must be MTOMised
Similar Threads
SSL in standalone axis2 1.4.1
MTOM example
Rampart/Axis2 not generating Security Header.
Need Java Client stubs for given WSDL
SOAP with Attachment. and WSDL