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 Patrick McNally <rp...@gmail.com> on 2006/02/09 17:59:46 UTC

Redirecting calls with a handler

Hi everybody,

I'm new to Axis and I need help getting functions redirected.  Here is
the scenario:

We have a webservice with a defined interface that we must maintain. 
It has functions like getX() and getY().  We want to change our code
so we only have one get() function that is used when any get_()
request is recieved.  I have a handler to do this but I don't
understand why it functions like it does and it leads me to believe
that I'm messing it up.

If our service class has getX() and getY() methods defined then I can
use the messageContext to get the OperationDesc and us its setMethod()
call to redirect it to our get() method.

However, we don't want to have empty getX() and getY() methods and if
I remove them it throws an exception when I call
messageContext.getOperation() (I'm assuming because the method getY()
does not exist).  I fixed this by doing the following:

    messageContext.setOperation(null);
    OperationDesc opDesc = messageContext.getOperationByQName(new QName("get"));
    messageContext.setOperation(opDesc);

This works if the original Operation they requested does not exist. 
However, if it does, it won't set it to the get() method and still
calls the old getY() method.

In essence, I want to have a class with only a get() method.  However,
I want people to be able to send requests for a getY() method and have
my handler redirect it to the get() method.  What is the proper way to
accomplish this?

Thanks,
Patrick