Hi all,
I want to use a JAX-RPC handler with an AXIS *client* but I can't put it to work. Since I am pretty new to the webservices stuff I have no idea where to dig to find the solution...
So far now the only task of my handler is to report its lifecyle events. So I subclassed javax.xml.rpc.handler.GenericHandler for my implementation as follows:
public class MyJaxRpcHandler extends GenericHandler { static { System.out.println("MyJaxRpcHandler static initialization"); } public MyJaxRpcHandler() { super(); System.out.println("MyJaxRpcHandler()"); } public void init(HandlerInfo handlerInfo) { System.out.println("MyJaxRpcHandler.init()"); } public void destroy() { System.out.println("MyJaxRpcHandler.destroy()"); } }
To add the handler to the request / response chain of my Axis client I do this to execute my remote method invokation:
public class MyServiceClient implements mycompany.axis.services.MyService { private final String ENDPOINT = "http://mycompany/axis/services/MyService" public void doSomething() { try { Service service = new Service();
QName qnMyService = new QName(ENDPOINT, "MyService");
List chain = service.getHandlerRegistry().getHandlerChain(
qnMyService);
HandlerInfo hi = new HandlerInfo(MyJaxRpcHandler.class,
Collections.EMPTY_MAP, new QName[0]);
chain.add(hi); Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new URL(ENDPOINT));
call.setOperationName("doSomething");
Object[] parameters = new Object[];
call.invoke(parameters);
} catch (Exception e)
e.printStackTrace();
}
}Here comes what happens when running MyServiceClient.doSomething(): the only livecycle event printed is "MyJaxRpcHandler static initialization" which probably comes from the line where the new HandlerInfo() is created. None of the others is fired (neiter the constructor nor init()/destroy()). However, the remote service's method doSomething() is invoked properly.
Every hint is welcome! Thanks a lot! Willy
