Friday, April 25, 2008

Log Web Services Incoming Requests in JAX-WS

For any server side Web Services development, logging the incoming requests is crucial. The following code snippet gives an example. Even though this particular example uses SOAPMessageContext from JAX-WS's SOAPHandler, the approach can be easily modified to fit into other Web Services solutions.

ByteArrayOutputStream buffer = new ByteArrayOutputStream();
soapMessageContext.getMessage().writeTo(buffer);
log.info("SOAP Request:\n" + new String(buffer.toByteArray()));


Note that a lot of times logging comes hand in hand with incoming requests validation. Read this blog for more details.

1 comment:

  1. Hi,
    This is the nice post and this post is really appreciable and informatics .I like this post too much.
    Thanks a lot for sharing such a good source with all, i appreciate your efforts taken for the same. I found this worth sharing and must share this with all.
    Authentication Certificate

    ReplyDelete