[jboss-user] [JBossWS] - Handlers

Redhopter do-not-reply at jboss.com
Mon Dec 18 10:28:53 EST 2006


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?


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

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



More information about the jboss-user mailing list