0 Replies Latest reply on Dec 18, 2006 5:36 AM by Konstantin Boilye

    Using handlers in JBoss

    Konstantin Boilye Newbie

      Hi All!
      I'm using JBoss 4.0.5. I have written Web Service and deployed it on JBoss.
      Also I have written handler 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];
       }
      }


      But I don't know how I must deploy this handler on JBoss WS.
      Where I must put this compilled handler, what I must write in properties files?
      And big second question: how I must put information into SOAP header of message?