You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by jaybytez <ja...@yahoo.com> on 2012/04/20 20:12:45 UTC

Disable mtom from sending uuid when DataHandler is null

We are using mtom via CXF/JAXB with DataHandler.

In some scenarios our service is supposed to respond with a null
DataHandler.

The interesting thing is that when DataHandler is null, there is no
referencing element in the soap response, just the uuid that follows
normally as the header for the attachment.

For instance:

HTTP/1.1 200 OK
Date: Mon, 16 Apr 2012 21:36:27 GMT
Server: Apache/2.0.63 (Unix) DAV/2
X-Powered-By: Servlet/2.5 JSP/2.1
Transfer-Encoding: chunked
Content-Type: multipart/related; type="application/xop+xml";
boundary="*uuid:0b4207bc-f374-4c94-a6c7-c6762711b57b*";
start="<ro...@cxf.apache.org>"; start-info="text/xml"


--uuid:0b4207bc-f374-4c94-a6c7-c6762711b57b
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml";
Content-Transfer-Encoding: binary
Content-ID: <ro...@cxf.apache.org>

<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:processActionResponse
xmlns:ns2="http://foo.com/comm"><ns2:CommActionResponse><ns2:CommId>999</ns2:CommId><ns2:CommTaskId>999</ns2:CommTaskId><ns2:CommStatus></ns2:CommStatus></ns2:CommActionResponse></ns2:processActionResponse></soap:Body></soap:Envelope>
*--uuid:0b4207bc-f374-4c94-a6c7-c6762711b57b--*

Is there a way to keep the uuid from going in the response when it's null? 
Could we use mtom-threshold of like 1 to force smaller docs or nulls (if
thats what it does) to be inline?

Thanks....

--
View this message in context: http://cxf.547215.n5.nabble.com/Disable-mtom-from-sending-uuid-when-DataHandler-is-null-tp5654978p5654978.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Disable mtom from sending uuid when DataHandler is null

Posted by Daniel Kulp <dk...@apache.org>.
If you look at that last uuid, you see:

--uuid:0b4207bc-f374-4c94-a6c7-c6762711b57b--

Note the last two "--" on the end.   That's marking the end of the message, 
not the header for the next part.   With mime, you need both open and 
closing boundaries.

To do what you want, you could add an interceptor VERY VERY early in the out 
chain that can detect if somehow if mime will be used or not and call 
messge.setProperty("mtom-enabled", "false") 

which would then disable all the mtom processing for that message.

Dan



On Friday, April 20, 2012 11:12:45 AM jaybytez wrote:
> We are using mtom via CXF/JAXB with DataHandler.
> 
> In some scenarios our service is supposed to respond with a null
> DataHandler.
> 
> The interesting thing is that when DataHandler is null, there is no
> referencing element in the soap response, just the uuid that follows
> normally as the header for the attachment.
> 
> For instance:
> 
> HTTP/1.1 200 OK
> Date: Mon, 16 Apr 2012 21:36:27 GMT
> Server: Apache/2.0.63 (Unix) DAV/2
> X-Powered-By: Servlet/2.5 JSP/2.1
> Transfer-Encoding: chunked
> Content-Type: multipart/related; type="application/xop+xml";
> boundary="*uuid:0b4207bc-f374-4c94-a6c7-c6762711b57b*";
> start="<ro...@cxf.apache.org>"; start-info="text/xml"
> 
> 
> --uuid:0b4207bc-f374-4c94-a6c7-c6762711b57b
> Content-Type: application/xop+xml; charset=UTF-8; type="text/xml";
> Content-Transfer-Encoding: binary
> Content-ID: <ro...@cxf.apache.org>
> 
> <soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:pro
> cessActionResponse
> xmlns:ns2="http://foo.com/comm"><ns2:CommActionResponse><ns2:CommId>999</
> ns2:CommId><ns2:CommTaskId>999</ns2:CommTaskId><ns2:CommStatus></ns2:CommS
> tatus></ns2:CommActionResponse></ns2:processActionResponse></soap:Body></s
> oap:Envelope> *--uuid:0b4207bc-f374-4c94-a6c7-c6762711b57b--*
> 
> Is there a way to keep the uuid from going in the response when it's null?
> Could we use mtom-threshold of like 1 to force smaller docs or nulls (if
> thats what it does) to be inline?
> 
> Thanks....
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Disable-mtom-from-sending-uuid-when-DataH
> andler-is-null-tp5654978p5654978.html Sent from the cxf-user mailing list
> archive at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com