title: How can I capture SOAP request and response messages in Java?
body: <pre><code>SimpleCalculatorStub stub = new SimpleCalculatorStub(null, 
  "http://localhost:8080/ControlSOAPMessage/services/SimpleCalculator");
  
  MyAdd reqMyAdd = new MyAdd();
  MySub reqMySub = new MySub();
  reqMyAdd.setA(4);
  reqMyAdd.setB(4);
  reqMySub.setA(9);
  reqMySub.setB(5);
  MyAddResponse resMyAdd = stub.myAdd(reqMyAdd);
  MySubResponse resMySub = stub.mySub(reqMySub);
  // System.out.println(resMyAdd.get_return()+" :: "+resMySub.get_return());
  Integer[] resParams = new Integer[2];
  resParams[0]=resMyAdd.get_return();
  resParams[1]=resMySub.get_return();
  for (int i = 0; i &lt; resParams.length; i++) {
      System.out.println(resParams[i]);
  }
  </code></pre>
  
  <p>I want to capture every request and response of SOAP messages (RAW) coming/going to/from client/server in XML format while interacting with Services.</p>
  
  <p>Please guide me with program coding and where I should place that coding. 
  I have made this service using Eclipse Axis2 plugins. Dynamic Web Project->Web Services (Java, Axis2, Tomcat 6)</p>
  
  <p>I have attached client side program(simple one)</p>
  
  <ul>
  <li><p>Addition and subtraction methods</p></li>
  <li><p>Client accepts two arguments in each method</p></li>
  <li><p>Add or subtract the numbers and provide results</p></li>
  </ul>
  
  <p>Please guide me.</p>
  
  <p>Many thanks.</p>