As a follow up to the last blog entry, how can we handle a situation where we do not have access to the WSDL at runtime or we need to change the value of the endpoint dynamically at runtime.
Well for JAX-RPC webservices we can use the Dynamic Invocation Interface (DII).....
Using the same concept as the last blog entry, wrapping the DII code inside an EJB, exposed as a doc/literal webservice, is a simple way to create a proxy to these external webservices, this EJB-WS can then be called from BPEL, for example, via the JavaEE SE making the overall process very efficient.
So, how do we do this........
1. Use the same example RPC/encoded webservice - this one
2. Create a EJB project inside NetBeans
3. Create a WSDL to expose your EJB as a webservice
4. Again, Do not create a WebService Client - this is an un-necessary step, we will do this dynamically in the code
5. Start coding, the code below can be used to call the above webservice and respond with the quotation string, pay special note to how the qualified names for the serviceName and portName are constructed and how they relate to the underlying WSDL.....
6. Attached is the EJB project. To test just create a WS client from the EJB-WS.
Enjoy....












