Re: dynamic web service invocations

From: Steve W. Jackson <>
Date: Mon, 14 Feb 2005 09:21:59 -0600

On Feb 13, 2005, at 8:34 AM, Guadalupe Ortiz wrote:

> I am interested on creating a client for invoking a web service which
> is not
> known until runtime. I have checked the dii advanced example in JAXRPC
> but
> it still use the remote service WSDL file at compilation time. Is it
> possible to compile a client who does not know the service which is
> going to
> invoke until runtime? (I could pass the service location when invoking
> the
> client) Where could I find information about this?,
> Thanks in adavance.
> Guadalupe

You should check the DII examples again. DII does not use the WSDL at
compile time. It refers to it at runtime.

When using the DII method, the service must be RPC/encoded (I think
I've seen this confirmed here on this list, but I've yet to find a way
to use anything else). You can use DII in more than one way. Check
the J2EE API docs for the javax.xml.rpc.ServiceFactory class. The three
calls you'll care about are the static newInstance() method to create a
new javax.xml.rpc.ServiceFactory instance, and the createService(QName
serviceName) and createService(URL wsdlDocumentLocation, QName
serviceName) methods. Which of those you elect to use governs which
methods of the javax.xml.rpc.Call interface are appropriate for your
use. As you'll see, it's entirely possible to call a Web service with
absolutely no compile time knowledge of it at all.

= Steve =
Steve W. Jackson
Montgomery, Alabama