there is small problem , you need to modify your code in the invoke method ; try { FileWriter fw = new FileWriter("toto.txt"); fw.write("Test"); fw.flush(); fw.close(); } catch (IOException e) { System.out.println(e.getStackTrace()); }
Fabien Couble wrote: > > I tried to create the file in the invoke method. But no result... > Actually, a file should have been created in the module directory of > Axis2 but nothing appeared! That is mean your handler is get called , dont worry it is working !! > This is the code of my handler!! > > package userguide.loggingmodule; > > import org.apache.axis2.AxisFault; > import org.apache.axis2.context.MessageContext; > import org.apache.axis2.engine.Handler; > import org.apache.axis2.handlers.AbstractHandler; > import org.apache.commons.logging.Log; > import org.apache.commons.logging.LogFactory; > import java.io.*; > > import javax.xml.namespace.QName; > > public class LogHandler extends AbstractHandler implements Handler { > private static final Log log = LogFactory.getLog(LogHandler.class); > private QName name; > > public QName getName() { > return name; > } > > public void invoke(MessageContext msgContext) throws AxisFault { > System.out.println("Invoke Method!"); > > try{ > FileWriter fw = new FileWriter("toto.txt"); > fw.write("Test"); > }catch(IOException e){ > System.out.println(e.getStackTrace()); > } > > > log.info(msgContext.getEnvelope().toString()); > } > > public void revoke(MessageContext msgContext) { > log.info(msgContext.getEnvelope().toString()); > } > > public void setName(QName name) { > this.name = name; > } > > } > > I don't know what to do!! > What do you think about this? > > Fabien > > > > > > ----- Original Message ----- From: "Deepal Jayasinghe" > <[EMAIL PROTECTED]> > To: <axis-user@ws.apache.org> > Sent: Thursday, June 29, 2006 10:53 AM > Subject: Re: [Axis 2]How can I check that a handler is executed? > > >> hmm , as I can see everything is OK . >> I think this is smt to do with logging properties, can you please try >> the following >> - juts try to create a file inside invoke method of the handler and see >> its working :) >> . >> >> >> Fabien Couble wrote: >> >>> >>> Hi Deepal, >>> As you said, I can see my module via the web admin console. The >>> phaseName I have added is loggingPhase. >>> This is what the web console return me: >>> View Operation Specific Chains >>> Operation Name : echo >>> In Flow >>> a.. Phase Name : loggingPhase >>> a.. Handler Name : InFlowLogHandler >>> b.. Phase Name : OperationInPhase >>> In Fault Flow >>> a.. Phase Name : loggingPhase >>> a.. Handler Name : FaultInFlowLogHandler >>> b.. Phase Name : OperationInFaultPhase >>> Out Flow >>> a.. Phase Name : loggingPhase >>> a.. Handler Name : OutFlowLogHandler >>> b.. Phase Name : OperationOutPhase >>> Out Fault Flow >>> a.. Phase Name : loggingPhase >>> a.. Handler Name : FaultOutFlowLogHandler >>> b.. Phase Name : OperationOutFaultPhase >>> Operation Name : ping >>> In Flow >>> a.. Phase Name : loggingPhase >>> a.. Handler Name : InFlowLogHandler >>> b.. Phase Name : OperationInPhase >>> In Fault Flow >>> a.. Phase Name : loggingPhase >>> a.. Handler Name : FaultInFlowLogHandler >>> b.. Phase Name : OperationInFaultPhase >>> Out Flow >>> a.. Phase Name : loggingPhase >>> a.. Handler Name : OutFlowLogHandler >>> b.. Phase Name : OperationOutPhase >>> Out Fault Flow >>> a.. Phase Name : loggingPhase >>> a.. Handler Name : FaultOutFlowLogHandler >>> b.. Phase Name : OperationOutFaultPhase >>> So I think, everything is allright. >>> I engaged this module by adding a module ref to the service.xml file >>> of my service. >>> However, when I want to test that my module is executed, I can't see >>> anything!! >>> An idea...?? >>> >>> Cheers >>> Fabien >>> >>> >>> >>> ----- Original Message ----- From: "Deepal Jayasinghe" >>> <[EMAIL PROTECTED]> >>> To: <axis-user@ws.apache.org> >>> Sent: Thursday, June 29, 2006 9:53 AM >>> Subject: Re: [Axis 2]How can I check that a handler is executed? >>> >>> >>>> Hi Fabien; >>>> >>>> Fabien Couble wrote: >>>> >>>>> Hello, >>>>> >>>>> I'm trying to engage a module in the Axis2 chain. >>>>> Apparently, the module is well engaged in a service (I checked the >>>>> Administration console) but I'd like to be sure that the handler of >>>>> the module is executed!! >>>> >>>> >>>> >>>> If you engage the module correctly , using web admin console you >>>> should >>>> be able to see your handler in the handler chain. >>>> >>>>> To do that, I put a "System.out.println" command in the method invoke >>>>> of the handler but nothing... (in the log of the Tomcat server) >>>>> That is why, I'd like to know if it is a good method to check that >>>>> or not! >>>> >>>> >>>> >>>> How do you engage a module , using web admin console or adding module >>>> ref to services.xml ? >>>> >>>>> If not, how can I do? >>>>> >>>> >>>> >>>> -- >>>> Thanks, >>>> Deepal >>>> ................................................................ >>>> ~Future is Open~ >>>> >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >>> >>> This message contains information that may be privileged or >>> confidential and is the property of the Capgemini Group. It is >>> intended only for the person to whom it is addressed. If you are not >>> the intended recipient, you are not authorized to read, print, >>> retain, copy, disseminate, distribute, or use this message or any >>> part thereof. If you receive this message in error, please notify the >>> sender immediately and delete all copies of this message. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >> >> -- >> Thanks, >> Deepal >> ................................................................ >> ~Future is Open~ >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] > > > > This message contains information that may be privileged or > confidential and is the property of the Capgemini Group. It is > intended only for the person to whom it is addressed. If you are not > the intended recipient, you are not authorized to read, print, > retain, copy, disseminate, distribute, or use this message or any > part thereof. If you receive this message in error, please notify the > sender immediately and delete all copies of this message. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- Thanks, Deepal ................................................................ ~Future is Open~ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]