Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. package jboss.ws.handler;
  2.  
  3. import static java.lang.System.out;
  4. import java.util.Set;
  5.  
  6. import javax.xml.namespace.QName;
  7. import javax.xml.soap.SOAPException;
  8. import javax.xml.ws.handler.MessageContext;
  9. import javax.xml.ws.handler.soap.SOAPHandler;
  10. import javax.xml.ws.handler.soap.SOAPMessageContext;
  11.  
  12. import org.w3c.dom.DOMException;
  13.  
  14. public class HelloWSSoapHandler implements SOAPHandler<SOAPMessageContext> {
  15.  
  16.     public void close(MessageContext messagecontext) {
  17.         // TODO Auto-generated method stub
  18.  
  19.     }
  20.  
  21.     public boolean handleFault(SOAPMessageContext arg0) {
  22.         // TODO Auto-generated method stub
  23.         return true;
  24.     }
  25.  
  26.     public boolean handleMessage(SOAPMessageContext context) {
  27.         Boolean outboundProperty = (Boolean) context
  28.                 .get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
  29.         if (outboundProperty) {
  30.             out.println("\nOutbound message : HelloWSSoapHandler");
  31.         } else {
  32.             out.println("\nInbound message : HelloWSSoapHandler");
  33.         }
  34.         try {
  35.  
  36.             out.println(context.getMessage().getSOAPHeader().getTextContent());
  37.  
  38.         } catch (DOMException e) {
  39.         } catch (SOAPException e) {
  40.         }
  41.         return true;
  42.     }
  43.  
  44.     public Set<QName> getHeaders() {
  45.         // TODO Auto-generated method stub
  46.         return null;
  47.     }
  48.  
  49. }