0 Replies Latest reply on Dec 18, 2006 10:28 AM by redhopter

    Handlers

    redhopter

      Hi All!
      I have written JBossWS web service and client class for it. Client and service work successfully. Also I have written Handler class such as

      public class MHandler extends GenericHandler{
       public boolean handleRequest(MessageContext context) {
       SOAPMessageContext sctx = (SOAPMessageContext)context;
       SOAPMessage message = sctx.getMessage();
       try {
       SOAPHeader header = message.getSOAPHeader();
       String userName = header.getAttribute("username");
       String password = header.getAttribute("password");
       try {
       FileOutputStream file = new FileOutputStream("C:/Documents and Settings/kbolyand/Desktop/log.txt");
       file.write("Into Handler".getBytes());
       file.write((userName + "=" + password).getBytes());
       file.close();
       }
       catch (FileNotFoundException e) {
       e.printStackTrace();
       }
       catch (IOException e) {
       e.printStackTrace();
       }
      
       }
       catch (SOAPException e) {
       e.printStackTrace();
       }
      
       return true;
       }
       public QName[] getHeaders() {
       return new QName[0];
       }
      }
      


      And now I have question: where I must declere my handler class in order use it and intercept SOAP messages?