By the way,I wanted to try your advice in my program. But I don't know how to
config the SAAJOutInterceptor. Do you mean let me to write a customizable
Interceptor after SAAJOutInterceptor?
If it is your mean,I tried it. But the Soap content is always empty.
I modified the code like this:
******************************
public class MySoapInterceptorImpl extends AbstractSoapInterceptor
implements
IMySoapInterceptor {
private SAAJOutInterceptorsaajOut = new SAAJOutInterceptor();
public MySoapInterceptorImpl()
{
super(Phase.WRITE );
addAfter(SAAJOutInterceptor.class.getName());
/*Here I tested all the phase. But the result of
soapMessage.writeTo(System.out); was not I need. */
}
public void handleMessage(SoapMessage msg) throws Fault {
// TODO Auto-generated method stub
String soapContent ;
System.out.println(msg.getInterceptorChain());
SOAPMessage soapMessage = getSOAPMessage(msg);
try {
soapMessage.writeTo(System.out);
} catch (SOAPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private SOAPMessage getSOAPMessage(SoapMessage smsg) {
SOAPMessage soapMessage = smsg.getContent(SOAPMessage.class);
if (soapMessage == null) {
saajOut.handleMessage(smsg);
soapMessage = smsg.getContent(SOAPMessage.class);
}
return soapMessage;
}
}
*******************************************
Hello sdf
Chain org.apache.cxf.phase.PhaseInterceptorChain@71488. Current flow:
pre-logical [HolderOutInterceptor, SwAOutInterceptor,
WrapperClassOutInterceptor, SoapHeaderOutFilterInterceptor]
post-logical [SoapPreProtocolOutInterceptor]
prepare-send [MessageSenderInterceptor]
pre-stream [AttachmentOutInterceptor, StaxOutInterceptor]
write [MySoapInterceptorImpl, SoapOutInterceptor]
marshal [WrappedOutInterceptor, BareOutInterceptor]
pre-stream-ending [StaxOutEndingInterceptor]
prepare-send-ending [MessageSenderEndingInterceptor]
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body/></SOAP-ENV:Envelope>
and some exception.
******************************
--
View this message in context:
http://cxf.547215.n5.nabble.com/CXF-Interceptor-get-Soap-Message-is-null-tp4516145p4516664.html
Sent from the cxf-user mailing list archive at Nabble.com.