[jboss-user] [Beginners Corner] - Using handlers in JBoss

Redhopter do-not-reply at jboss.com
Mon Dec 18 05:36:18 EST 2006


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?

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

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



More information about the jboss-user mailing list