Skip to main content

How to log JAX-WS SOAP Messages in java

No replies
viralpatel82
Offline
Joined: 2011-11-24
Points: 0

Hi ,

In JAX-WS, You can monitor the request and response messages using System property "com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true", 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();

msg.writeTo(baos);

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.

-VIRAL