Hi Aditi.
Considering you will be using JAX-RPC (or the new JAX-WS) or even Apache Axis, one way of logging your requests and responses is by implementing a Message Handler for that purpose. A Message Handler acts like a
Servlet Filter, i.e., it intercepts your request before it reaches its destination (the endpoint) and intercepts the response before it is returned to the caller (the WS client). Both are very good times to log what is going back and forth.
You can write your Message Handler to use your favorite logging API, get the XML contents and post them to a log file.
I personally would recommend you to create a JAX-RPC (or JAX-WS) compliant Message Handler because that would make it reusable to any JAX-RPC compliant
SOAP engine. And that means you could potentially use the same logging Message Handler on the client, on the server and on other applications. All you have to do is deploy it to the desired Web Service once it's complete.
Regards.