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/16 16:34:01 UTC

Redirecting message calls with a handler

Hey guys,

Sent this out before but I didn't get any response.  Can anyone tell
me what the correct way is to redirect an operation through a handler?
 For example, a user has always called a function called monkey() on
my webservice.  But now monkey() is outdated so I want any incoming
messages for monkey() to be redirected to donkey().  What is the
correct way to do this?

My original message is below (if you want more details) and I will
post (attach) code if that would help.  Any suggestions on other
sites/lists that might have an answer would be appreciated too.

Thanks,
Patrick


Original Message:
--------------------------
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