For the purposes of logging, I need to get the content of SOAP request and SOAP response. In general I have 2 alternatives:
to extend part of Axis API (BasicHandler) and to create an interceptor, which will log everything for me.
or I could to the logging "manually" i.e. using the utility of Axis only as a client - no extending.
For reasons the approach of the projects points me to implementing the logging manually. So far I managed to get the SOAP response like this:
private void getSOAPasString(Call call) {
try {
MessageContext context = call.getMessageContext();
SOAPMessage message = context.getMessage();
// Create transformer
TransformerFactory tff = TransformerFactory.newInstance();
Transformer tf;
tf = tff.newTransformer();
// Get reply content
Source sc = message.getSOAPPart().getContent();
// Set output transformation
StreamResult result = new StreamResult(System.out);
tf.transform(sc, result);
System.out.println(result);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println();
}
But I haven't managed to get the request message - can you help me with that? Is it possible to get the Request SOAP message? How?