Hi Christopher, It'd be relatively easy to do. I was thinking about this earlier. The easiest thing to do would be to drop in the MTOM WS-Policy XSD into the ws-policy module inside cxf and have it generate JAXB types. Andrea wrote some docs here:
http://cwiki.apache.org/confluence/display/CXF20DOC/Developing+Assertions The general idea as I undrestand it is that that for the different policy assertions, there is a PolicyAssertionProvider. What a PAP does is provide interceptors which are added to the CXF interceptor chain whenever that policy is activated. So if the MTOM is assertion is enabled you can add an interceptor which turns on MTOM. Such an interceptor might look like: public class MtomPolicyInterceptor extends AbstractPhaseInterceptor<Message> { public MtomPolicyInterceptor() { setPhase(Phase.POST_LOGICAL); } public void handleMessage(Message m) { m.put(Message.MTOM_ENABLED, Boolean.TRUE); } } Although having never written a policy extension before, this could be way off :-) - Dan On 4/18/07, Christopher Moesel <[EMAIL PROTECTED]> wrote:
It looks to me like CXF does not yet support the MTOM assertion spec. =| Could someone who is familiar with CXF's policy implementation and/or MTOM implementation let me know how difficult this might be to implement? If it's not so bad I might be able to find the time... We'll see. -Chris -----Original Message----- From: Sergey Beryozkin [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 18, 2007 11:34 AM To: cxf-user@incubator.apache.org Subject: Re: MTOM "By Request" Hi This is exactly what an MTOM policy assertion is for, please see Optional assertions in the policy primer at http://www.w3.org/TR/2007/WD-ws-policy-primer-20070330/ and the MTOM assertion spec : http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization/ The service which wishes to support both MTOM-aware and MTOM-unaware clients will just do : in <wsdl:service> or wsdl:service/wsdl:port : <Policy> <mtom:optimizedMimeSerialization optional="true"/> </Policy> The server then determines whether to use the MIME processing or not depending on the presence of the a related mime header Cheers, Sergey ----- Original Message ----- From: "Dan Diephouse" <[EMAIL PROTECTED]> To: <cxf-user@incubator.apache.org> Sent: Wednesday, April 18, 2007 4:21 PM Subject: Re: MTOM "By Request" > How would this work from the Client side? Would it just be always or never > then? I don't think there's a way to detect whether or not MTOM should be > used on the client side of things. > > BTW - I fixed your bugs in SVN. We haven't published a new snapshot quite > yet though. That should happen later today I would think. > > - Dan > > On 4/18/07, Christopher Moesel <[EMAIL PROTECTED]> wrote: >> >> According to the link below, the .NET 2.0 w/ WSE 3.0 server supports a >> feature like this: >> >> <quote from link> >> Note: There are three server MTOM modes: "optional", "always", and >> "never". >> >> Always means that the service "always" requires MTOM messages from the >> client and will "always" return response messages using MTOM. >> >> Never means that MTOM will never be used-and the service will reject >> MTOM requests. >> >> Optional (the default) means the service will respond in kind to the >> type of message sent by the client. So if the client sends an MTOM >> request, it will respond with an MTOM response. >> </quote from link> >> >> http://www.agilefactor.com/agiledamon/2006/01/mtom-and-microsoft-web-ser >> vice.html >> >> -Chris >> >> -----Original Message----- >> From: Christopher Moesel [mailto:[EMAIL PROTECTED] >> Sent: Wednesday, April 18, 2007 10:35 AM >> To: cxf-user@incubator.apache.org >> Subject: MTOM "By Request" >> >> I don't know if this goes against any specs or is too difficult to >> implement, but it seems to me that this would be a neat feature: >> >> MTOM By Request: >> - If a request comes in using MTOM, then respond using MTOM. >> - If a request comes in using text/xml, then respond with test/xml. >> >> This way, a single deployed service can support both MTOM-enabled and >> non-MTOM-enabled clients. >> >> Any thoughts? >> >> -Chris >> > > > > -- > Dan Diephouse > Envoi Solutions > http://envoisolutions.com | http://netzooid.com/blog >
-- Dan Diephouse Envoi Solutions http://envoisolutions.com | http://netzooid.com/blog