Is there a clean way to pass parameters to a JAX-RPC message handler? For example, I have a JAX-RPC client that uses stubs generated by WSDL2Java to create a message. However, the service WSDL doesn't describe the message format completely (e.g., an element in the schema has a <xsd:any> child), so I need to tweak the message using SAAJ in a message handler. How do I pass data (e.g., values for a SQL query) from the JAX-RPC code to the message handler code? The only thing I found in the JAX-RPC API that allows us to configure a handler is the HandlerInfo class, so something like the following may work:

  MyServiceLocator stubFactory = ...;
Iterator it = stubFactory.getHandlerChain().iterator(); // List of HandlerInfo
  boolean found = false;
  while (it.hasNext() && !found) {
    HandlerInfo hf = (HandlerInfo) it.next();
if (hf.getHandlerClass().equals(client.msghndl.ClientMessageHandler.class)) {
      found = true;
      Map handlerConfig = hf.getHandlerConfig();
      if (handlerConfig == null) {
        handlerConfig = new HashMap();
        hf.setHandlerConfig(handlerConfig);
      }
    handlerConfig.put("status", "overdue");
  }
}

But this seems like an awful lot of work to do something very simple. Is there an easier way?

Thanks,
Mike




Reply via email to