Skip to main content

How to log JAX-WS SOAP Messages in java

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2011-11-24

Hi ,

In JAX-WS, You can monitor the request and response messages using System property "", it prints out the request and response message on System.out.

but I want to log it onto logger.

I am looking for logging soap request and response xml.

How to do it please guide me

for that I created soaphandler class for it.

and override the method handleMessage.

public boolean handleMessage( SOAPMessageContext context){


I tried different methods in handleMessage but not able to get xml.

even I tried this method.

SOAPMessage msg = context.getMessage();

ByteArrayOutputStream baos = new ByteArrayOutputStream();


it prints blank but webservice works fine and gives me result

anyone have any solution or api to convert soapmessage to XML using java

Please help.