[jboss-user] [JBossWS] - How can I see the SoapResponse

Vincent321 do-not-reply at jboss.com
Thu Jan 17 09:15:52 EST 2008


Hello, 

I generated a client with WSConsume and register a handler to log soap messages.

The handler gets called and display the request but I am not able to see either the soapfault nor the soapresponse.

Here is the code of my handler.  Could you pls tell me what did I wrong ?

  |     final String HANDLER_NAME = "LogHandler";
  |     // change this to redirect output if desired
  |     private static PrintStream out = System.out;
  | 
  |  
  | 
  |     public boolean handleMessage(SOAPMessageContext smc) {
  |         System.out.println("Executing " + HANDLER_NAME);
  |         logToSystemOut(smc);
  |         return false;
  |     }
  |  
  |     public boolean handleFault(SOAPMessageContext smc) {
  |     	System.out.println("Une faute");
  |         logToSystemOut(smc);
  |         return false;
  |     }
  | 
  |     // nothing to clean up
  |     public void close(MessageContext messageContext) {
  |     }
  | 
  |     /*
  |     * 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);
  |         
  |         if (outboundProperty) {
  |             out.println("\nOutbound message:");
  |         } else {
  |             out.println("\nInbound message:");
  |         }
  | 
  |         SOAPMessage message = smc.getMessage();
  |         try {
  |             message.writeTo(out);
  |             out.println("");   // just to add a newline
  |         } catch (Exception e) {
  |             out.println("Exception in handler: " + e);
  |         }
  |     }
  | 

Thanks in advance

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4120887#4120887

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4120887



More information about the jboss-user mailing list