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 Valerio Synclab <v....@synclab.it> on 2009/11/19 11:40:04 UTC

client side handler

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("../axi
s2.xml");

                               } catch (AxisFault e1) {

                                               // TODO Auto-generated catch
block

                                               e1.printStackTrace();

                               }

                               // TODO Auto-generated method stub

                               try{

                               SMSServiceStub stub = new SMSServiceStub(ctx,
"..?wsdl");

 

 

What else Do I have to do?

 

Any suggestions?

Best regards

 

Valerio