title: How to see XML output of SOAP request in Spring?
body: <p>I am new to Spring SOAP requests. I want to see the final XML output of the SOAP request which includes SOAP header and SOAP envelop.</p>
  
  <p>While debugging I reached up to this piece of code</p>
  
  <pre><code>sendSourceAndReceiveToResult(partnerURI, source,
      new WebServiceMessageCallback() {
  
          public void doWithMessage(WebServiceMessage message)
          throws IOException, TransformerException {
  
              StringSource mefHeaderSource = new StringSource(
                  header);
  
              SoapHeader soapHeader = ((SoapMessage) message)
                  .getSoapHeader();
  
              Transformer transformer = TransformerFactory
                  .newInstance().newTransformer();
  
              transformer.transform(mefHeaderSource,
                  soapHeader.getResult());
  
          }
      }, result);
  </code></pre>
  
  <p>I suspect here I can see somewhere the output XML SOAP request by putting some logger but I am not sure I am correct. I tried searching for it but in all the posts available on google nothing is clear.</p>
  
  <p>The issue which we are debugging is client is not able to see SOAP header in the SOAP request.</p>