title: Is it possible to use jax-ws to generate xml, but NOT send it out
body: <p>So here's the scenario:
  We have PeopleSoft and want to send messages back and forth from salesforce.  Unfortunately PeopleSoft doesn't have a tool like wsimport which consumes a wsdl and generates classes for you.  There is something that consumes wsdl's, but all it does it generate stub message objects.  A developer would still have to write the code to manually generate the xml message string.</p>
  
  <p>I obviously don't want to do all of that.  So I know that java can be called from within PeopleSoft.  I also know I could send messages just using the generated classes, but I would like to use the message monitoring features built in to PeopleSoft.</p>
  
  <p>So a possible solution that I am thinking of will:</p>
  
  <ol>
  <li>call the webservice method in java (without sending out the message)</li>
  <li>Grab the xml</li>
  <li>send the xml via peoplesoft mechanisms</li>
  <li>grab the response xml</li>
  <li>pass the response xml back into the response java class</li>
  <li>Use java classes to grab values within the xml</li>
  </ol>
  
  <p>Am I crazy or is this possible?</p>
  
  <p>p.s. i am a newbie java developer</p>
  
  <p>Here's my handler class to grab the xml, but need some way to preventing message being sent out.</p>
  
  <pre><code>public class LoggingHandler implements SOAPHandler&lt;SOAPMessageContext&gt; {
   // change this to redirect output if desired
  private static PrintStream out = System.out;
  private String xmlOut = null;
  
  public Set&lt;QName&gt; getHeaders() {
      return null;
  }
  
  public boolean handleMessage(SOAPMessageContext smc) {
      logToSystemOut(smc);
      return true;
  }
  
  public boolean handleFault(SOAPMessageContext smc) {
      logToSystemOut(smc);
      return true;
  }
  
  // nothing to clean up
  public void close(MessageContext messageContext) {
  }
  
  public String getXmlOut() {
      return xmlOut;
  }
  
  /*
   * Check the MESSAGE_OUTBOUND_PROPERTY in the context
   * to see if this is an outgoing or incoming message.
   * Write a brief message to the print stream and
   * output the message. The writeTo() method can throw
   * SOAPException or IOException
   */
  private void logToSystemOut(SOAPMessageContext smc) {
      Boolean outboundProperty = (Boolean)
          smc.get (MessageContext.MESSAGE_OUTBOUND_PROPERTY);
  
  
      SOAPMessage message = smc.getMessage();
      try {
          ByteArrayOutputStream baOut = new ByteArrayOutputStream();
          message.writeTo(baOut);
          xmlOut = new String(baOut.toByteArray());
  
  
      } catch (Exception e) {
          out.println("Exception in handler: " + e);
      }
  }
  
  }
  </code></pre>