[jboss-user] [JBossWS] - How to add handler chain to dynamic web service proxy client
rk_jboss
do-not-reply at jboss.com
Tue Jul 28 18:27:04 EDT 2009
Hi,
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();
| bindingProvider.setHandlerChain(handlerChain);
|
| //2) did not work
| SOAP11BindingJAXWS bindingProvider = (SOAP11BindingJAXWS) dispatch.getBinding();
| bindingProvider.setHandlerChain(handlerChain);
|
|
| //creating soap message goes and invoking the service here
|
| } catch(WebServiceException webServiceException) {
| sop("WebServiceException is::"+webServiceException.getMessage());
| webServiceException.printStackTrace();
| } catch (SOAPException soapEx) {
| sop("SOAPException is::"+soapEx.getMessage());
| soapEx.printStackTrace();
| }
|
| }
| }
Thanks in advance.
Thanks,
Ram
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4246562#4246562
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4246562
More information about the jboss-user
mailing list