0 Replies Latest reply on Jul 28, 2009 6:27 PM by RamKishore P

    How to add handler chain to dynamic web service proxy client

    RamKishore P Newbie

      I'm trying to add a handler chain (which has couple of handlers) to web service client (written using dynamic proxy) but when I try to run the client handlers are not added. If I use the the static stubs,I'm able to add the handlers.

      I tried with different classes in jboss ws package but did not work.
      Pls can anyone advice me if I miss something.

      my client code is

      import org.jboss.ws.core.jaxws.binding.BindingImpl;
      import org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS;
      some other imports
      class client
       public static void main(String[] args) {
       try {
       String namespace = "some namespace";
       String serviceName = "some serviceName";
       String portName = "some portName";
       String endpointAddress = "some endpointAddress";
       QName serviceQName = new QName(namespace, serviceName);
       Service service = Service.create(serviceQName);
       QName portQName = new QName(namespace, portName);
       service.addPort(portQName, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
       Dispatch<SOAPMessage> dispatch =
       service.createDispatch(portQName, SOAPMessage.class, Service.Mode.MESSAGE);
       List<Handler> handlerChain = new ArrayList<Handler>();
       handlerChain.add(new ClientWSSecurityHandler());
       handlerChain.add(new LoggingHandler());
       // I tried the following options
       //1) did not work
       BindingImpl bindingProvider = (BindingImpl) dispatch.getBinding();
       //2) did not work
       SOAP11BindingJAXWS bindingProvider = (SOAP11BindingJAXWS) dispatch.getBinding();
       //creating soap message goes and invoking the service here
       } catch(WebServiceException webServiceException) {
       sop("WebServiceException is::"+webServiceException.getMessage());
       } catch (SOAPException soapEx) {
       sop("SOAPException is::"+soapEx.getMessage());

      Thanks in advance.