Hi,

I have a use case where I have to extract the SoapBody without invoking
interceptors.


I am trying following code to extract the body.  I am able to retrieve
headers and other information , But the SoapBody is  returning null.

Please suggest the way I can do  extract full soap envelop  without writing
soap inceptors.


public static void marshal() {
Message message = PhaseInterceptorChain.getCurrentMessage();
LOGGER.debug("MANOj Invoking handleMessage on interceptor Chain END " );
//FIRST method - Failed no SoapBody
InputStream is =
message.getExchange().getBinding().createMessage().getContent(InputStream.class);
try{
Message msg = message.getExchange().getInMessage().
InputStream is = msg.getContent(InputStream.class);
String soapBody = IOUtils.toString(is);
LOGGER.debug("SOAPBody body ="+soapBody);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}


//Second method - Failed no SoapBody
        SoapMessage soapMessage = (SoapMessage) message;

        SOAPMessage doc = message.getContent(SOAPMessage.class);

        SOAPBody body;
try {
body = doc.getSOAPBody();
System.out.println("MANOj SOAPBody body ="+body.toString());
} catch (SOAPException e) {
e.printStackTrace()
System.out.println("MANOj SOAPBody body = FAILED");
}
 }




}

Reply via email to