posted 10 years ago
Hi,
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" />
</wsp:Policy>
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.
Thanks,
Sindhu