Hi all , When set the jaxws handler in client side to check if CXF 2.2.5 can get the XOP element(xop:include element) content(encoded message) from the SAAJ model . It looks like the SAAJIn/OutInterceptor does not parse and inline the encoded request message in the "dataHandler" element :
The expected document in SAAJ is: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:echoDataHandler xmlns:ns2="http://org.jboss.ws/xop/doclit"> <dataHandler>Q2xpZW50IGRhdGE=</dataHandler> </ns2:echoDataHandler> </soap:Body> </soap:Envelope> The actual document in the SAAJ : <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body><ns2:echoDataHandlerResponse xmlns:ns2="http://org.jboss.ws/xop/doclit"> <dataHandler><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:ca461d40-25f5-4a67-b3db-6b2b258563ee-4@http%3A%2F%2Fcxf.apache.org%2F"/> </dataHandler> </ns2:echoDataHandlerResponse> </soap:Body></soap:Envelope> This is the handler code to check if the xop:include element has been replaced to actual encoded message : public boolean handleMessage(SOAPMessageContext ctx) { Object b = ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); boolean outbound = (Boolean) b; if (!outbound) { try { SOAPMessage soapMsg = ctx.getMessage(); SOAPEnvelope soapEnv = soapMsg.getSOAPPart().getEnvelope(); SOAPBody body = soapEnv.getBody(); boolean found = scanNodes(body.getChildNodes()); if (found) throw new IllegalStateException("Failed to get the actual encoded message "); } catch (SOAPException ex) { throw new WebServiceException(ex); } return true; } return true; } Below is the soap request message on wire . Metro seems can handle this as I expected. So Is this an issue in CXF ? Or this has been defined in the SAAJ spc ? ---------------------Request message----------------------- POST /jaxws-samples-xop-doclit/bare HTTP/1.1 Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:642da05d-d9b9-417c-a1aa-29a8c01ad9f3"; start="<root.mess...@cxf.apache.org>"; start-info="text/xml" SOAPAction: "" Accept: */* User-Agent: Apache CXF 2.2.5 Cache-Control: no-cache Pragma: no-cache Host: 127.0.0.1:9999 Connection: keep-alive Content-Length: 807 --uuid:642da05d-d9b9-417c-a1aa-29a8c01ad9f3 Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"; Content-Transfer-Encoding: binary Content-ID: <root.mess...@cxf.apache.org> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:echoDataHandler xmlns:ns2="http://org.jboss.ws/xop/doclit"><dataHandler><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:ce273950-41cd-4447-b3b7-296c06672f7a-1@http%3A%2F%2Fcxf.apache.org%2F"/></dataHandler></ns2:echoDataHandler></soap:Body></soap:Envelope> --uuid:642da05d-d9b9-417c-a1aa-29a8c01ad9f3 Content-Type: text/plain Content-Transfer-Encoding: binary Content-ID: <ce273950-41cd-4447-b3b7-296c06672f7...@http://cxf.apache.org/> Client Data Thanks Jim