You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Amila Suriarachchi <am...@gmail.com> on 2009/11/21 05:00:54 UTC

Re: client side handler

On Thu, Nov 19, 2009 at 4:10 PM, Valerio Synclab <v....@synclab.it>wrote:

>  Hi all,
>
>
>
> I am trying to add an handler in my axis2 client and in order to do this I
> followed the “Writing Your Own Axis2 Module” tutorial adapting it for the
> client side.
>
>
>
> The problem is that the handler is not called at all during the web service
> invocation.
>
>
>
> Here is what I have done:
>
>
>
> This is the handler code
>
> **********************
>
> public class Handler extends AbstractHandler implements
> org.apache.axis2.engine.Handler{
>
>                 private String name;
>
>                 public InvocationResponse invoke(MessageContext arg0)
> throws AxisFault {
>
>
> System.out.println(arg0.getEnvelope().toString());
>
>                                return InvocationResponse.CONTINUE;
>
>                 }
>
>                 public void revoke(MessageContext msgContext) {
>
>
> System.out.println(msgContext.getEnvelope().toString());
>
>     }
>
>                 public String getName() {
>
>         return name;
>
>     }
>
>                 public void setName(String name) {
>
>         this.name = name;
>
>     }
>
> }
>
>
>
> This is the module.xml
>
>
>
>
>
> ***********************************************
>
> <module name="test" class="obg.test.client.TestModule ">
>
>    <inflow>
>
>         <handler name="InFlowTestHandler" class="obg.test.client.Handler">
>
>         <order phase="testPhase" />
>
>         </handler>
>
>    </inflow>
>
>
>
>    <outflow>
>
>         <handler name="OutFlowTestHandler" class="obg.test.client.Handler">
>
>         <order phase="testPhase"/>
>
>         </handler>
>
>    </outflow>
>
>
>
>    <Outfaultflow>
>
>         <handler name="FaultOutFlowTestHandler"
> class="obg.test.client.Handler">
>
>         <order phase="testPhase"/>
>
>         </handler>
>
>    </Outfaultflow>
>
>
>
>    <INfaultflow>
>
>         <handler name="FaultInFlowTestHandler"
> class="obg.test.client.Handler">
>
>         <order phase="testPhase"/>
>
>         </handler>
>
>    </INfaultflow>
>
> </module>
>
>
>
>
>
> This is what I added into axis.xml for each phaseOrder
>
>
>
> I tried both
>
>
>
> <phase name="testPhase">
>
>             <handler name="InFlowTestHandler"
> class="obg.test.client.Handler">
>
>                   <order phase="testPhase" />
>
>               </handler>
>
> </phase>
>
>
>
> and
>
>
>
>  <phase name="testPhase"/>
>
>
>
> Finally I create my stub in this way:
>
>
>
> ConfigurationContext ctx = null;
>
>                                try {
>
>                                                ctx =
> ConfigurationContextFactory.createConfigurationContextFromFileSystem("……/axis2.xml");
>
>                                } catch (AxisFault e1) {
>
>                                                // TODO Auto-generated catch
> block
>
>                                                e1.printStackTrace();
>
>                                }
>
>                                // TODO Auto-generated method stub
>
>                                try{
>
>                                SMSServiceStub stub = new
> SMSServiceStub(ctx, "……?wsdl");
>
do
stub._getServiceClient().engangeModule("test");

Amila.

>
>
> * *
>
> What else Do I have to do?
>
>
>
> Any suggestions?
>
> Best regards
>
>
>
> Valerio
>
>
>



-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/