can someone tell me what are the various ways to access webservice
There are mainly three ways to call a web service.
1. Generated Stubs:
This is the most commonly used method You generate stubs of your web service by using WSDL2Java tool and make calls on client side stub classes. The stub classes abstract underlying web service invocation mechanism like Marshalling, Serializing and Endpoint Invocation.
2. Dynamic Proxies:
These are created dynamically at runtime rather than generated statically at deployment time. These are not used much unless I think if WSDL is very dynamic!
3. DII (Dynamic Invocation Interface):
It provides an API to invoke web service calls dynamically like above but without using any proxies.
Can you please let me know when should we go for JNDI and when should we go for invocation thro' stub?
When you say JNDI, I presume it's for looking up for javax.xml.rpc.Service (if Generated Stubs, implementing class). Irrespective of which way you use call web service, JNDI is used to look-up the Service object except if using in non-J2EE environments (like standalone clients).
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)