I've read in different places that its possible to configure handlers programmatically, but the examples given always seem to be of using a deployment descriptor - has anyone got any examples of doing it programmatically ?
I'm thinking of the case where I want to add a handler to a static stub client.
Just in case anyone is interested I struggled to get this working due to not being sure what QName for the portName to pass to the HandlerRegistry getHandlerChain method.
I decompiled the SwearerIF_Stub class that had been created earlier to find the line
guess I could have worked this out from my mapping file - or from combination of wsdl and the config file used to create client - but without knowing exactly whats required it would have been difficult, seems to be poorly documented to me.
The contents and mapping of what is in the WSDL is something thats on my list of stuff to revise anyway, so perhaps it will make more sense after I've done that.
Originally posted by michael warren: Just in case anyone is interested I struggled to get this working due to not being sure what QName for the portName to pass to the HandlerRegistry getHandlerChain method.
I come to feel you are very confused about Handler. In fact, there are two kinds of handler. Both are needed to declare in the xml configuation files. One is in the client side, this needs to declare in web.xml: <service-ref> <description>WSDL Service AttachmentIBMService</description> <service-ref-name>service/AttachmentIBMService</service-ref-name> <service-interface>ibm.attachment.AttachmentIBMService</service-interface> <wsdl-file>WEB-INF/wsdl/AttachmentIBM.wsdl</wsdl-file> <jaxrpc-mapping-file>WEB-INF/AttachmentIBM_mapping.xml</jaxrpc-mapping-file> <service-qname xmlns fx="urn:attachment.ibm">pfx:AttachmentIBMService</service-qname> <port-component-ref> <service-endpoint-interface>ibm.attachment.AttachmentIBM</service-endpoint-interface> </port-component-ref> <handler> <handler-name>ibm.attachment.handler.AttachmentIBMClientHandler</handler-name> <handler-class>ibm.attachment.handler.AttachmentIBMClientHandler</handler-class> </handler> </service-ref>
Another is in the server side, this need to declare in webservices.xml: <port-component> <port-component-name>AttachmentIBM</port-component-name> <wsdl-port xmlns fx="urn:attachment.ibm"> pfx:AttachmentIBM </wsdl-port> <service-endpoint-interface> ibm.attachment.AttachmentIBM </service-endpoint-interface> <service-impl-bean> <servlet-link> ibm_attachment_AttachmentIBMBindingImpl </servlet-link> </service-impl-bean> <handler> <handler-name>ibm.attachment.handler.AttachmentIBMHandler</handler-name> <handler-class>ibm.attachment.handler.AttachmentIBMHandler</handler-class> </handler> </port-component>
Hope this help. If there is any error, please correct me because I am preparing for this exam too. [ April 29, 2007: Message edited by: ruijin yang ]
SUN Certified Business Component Developer Java EE Platform 5 (2008)<br />SUN Certified Developer for Java Web Services (2007)<br />IBM WebSphere Portal V5.1 Application Development (2006)<br />SUN Certified Web Component Developer (2001)<br />SUN Certified Java 2 Programmer (2001)
Ulf's right - I was trying to get handlers working for standalaone clients that weren't part of a web application - so needed to do it programatically - as configuration in web.xml wasn't relevant.
I got it working as explained in my reply above, although I've seen so little reference to doing it programatically that I think its probably something you don't need to worry too much about for the exam.
Villains always have antidotes. They're funny that way. Here's an antidote disguised as a tiny ad:
a bit of art, as a gift, that will fit in a stocking