How do we consume a web service in Java?A client can consume web services in Java in 3 ways:
Stub 1. This method uses a platform-specific stub which is created before the runtime during the WSDL to Java mapping stage. 2. It is sometimes called a static stub as it is created before runtime.
Dynamic Invocation Interface (DII) 1. The dynamic invocation of a web services' operations is supported by the JAX-RPC Call interface. 2. By using this method, you do not need to know the WSDL URL at development-time. 3. The JAX-RPC Service acts as a factory for instantiating JAX-RPC Calls Instead of obtaining a proxy from the JAX-RPC Service.
Dynamic proxies 1. A proxy can be used to invoke the web service's operations from a JAX-RPC Service. 2. The proxy is a Java class implementing the SEI. 3. It is obtained with the JAX-RPC Service's getPort() method, which will take the name of the port for the web service that is to be invoked (found in the WSDL document), as well as the SEI implemented by the proxy. 4. As the proxy is created at runtime it is called dynamic.
|