This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes SCDJWS Beta : Some findings/points Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "SCDJWS Beta : Some findings/points" Watch "SCDJWS Beta : Some findings/points" New topic

SCDJWS Beta : Some findings/points

Sim Kim
Ranch Hand

Joined: Aug 06, 2004
Posts: 268
1. Handler Framework : Handlers work in the order in which they are declared in the xml file or in the order in which they are added in the HandlerResolver. But the order is for Outgoing messages and for Incoming the order is reversed .

2.On the Client side Handlers can be added using the HandlerReolver also.This cannot be done on the server side.

There is one more way to add Handlers on the Client side , by setting a chain directly on a BindingProvider

3. LogicalHandlers are called first.
Faraz Ali
Ranch Hand

Joined: May 15, 2008
Posts: 108
The @javax.jws.WebMethod(exclude=true) cannot be used on a service endpoint interface.
Chintan Rajyaguru
Ranch Hand

Joined: Aug 19, 2001
Posts: 341
Sim Kim,
Are you trying to ask a question or just listing some findings about the handlers? If you were just noting handler creation strategies, there are more ways than you listed:

1. You can create handler chain using wsdl customizations. Put the customizations in a separate customization file or insert customizations directly into the wsdl (I don't recommend messing with wsdl this way). Choose this option to configure handler chain in a top down service design.

2. You can also create a handler chain by specifying @HandlerChain (file="handler_filename.xml) annotation on web service implementation or on SEI. The file should specify the chain using the same syntax as that used in the wsdl customization. Choose this option to configure handler chain in a bottom up service design.

3. You can define a handler chain in sun-jaxws.xml deployment descriptor. Again, the syntax to specify the chain is same as the two options above. This choice is implementation specific and will have to be reconfigured when migrating to a different implementation (e.g. from Glassfish to WebSphere or vice versa). Choose this option to configure handler chain at the deployment time.

4. You can define a handler chain by adding it directly in the binding provider (the option you covered). This option can be used to add handler chain on the client side. This is a great way to set the chain dynamically. For example, on the client side, you can first determine which service to invoke and then set the chain for that service.

5. You can use HandlerResolver to set handler chain (another option you cover). This option automatically adds the handler chain on ALL newly created binding objects. From design perspective, choose this option when the chain for a given service is predetermined and you don't want every piece of client code to have the code for adding handler chains (just like you don't want to create Connection in every DAO). Also, if your team consists of junior developers and you don't want them to temper with handler configuration etc., you can provide some kind of factory which returns the service object with the chain preset on it using this method.

An interesting food for thought is to ask: What happens if the chain is being executed and a handler returns false or throws an exception? What will happen to the chain execution? Will the message become response if it was request? What if the message was already response? Section 9.3.2 of jax-ws specification has the answers. - Coming soon!
Sim Kim
Ranch Hand

Joined: Aug 06, 2004
Posts: 268
Thanks Chintan !

I was mentioning what all I knew about handlers.But you have given some wonderful tips.

I think the HandlerResolver can be used at the client side only . Please correct me if I am wrong .

I read the JAX-WS Specs but could not understand some concepts regarding mapping of Exception to Fault . Will read it again and see how do I do it.
It is sorta covered in the JavaRanch Style Guide.
subject: SCDJWS Beta : Some findings/points