W3C home > Mailing lists > Public > www-ws@w3.org > November 2002

Building a web service client using Dynamic proxy

From: Thomi Pilioura <thomi@di.uoa.gr>
Date: Sat, 2 Nov 2002 22:00:56 +0200
To: <www-ws@w3.org>

Hi everyone!

I'm trying to build a web service client using the notion of the "dynamic
proxy" as described in the JAX-RPC documentation
(http://java.sun.com/webservices/docs/1.0/tutorial/doc/JAXRPC5.html). That
is, trying to use the WSDL decription of a service knowing _nothing_ more
but that. Supposedly, I'm a service requestor and have just discovered a
service (no matter how) and want to bind to it.

The problem is that the sample code given both in the JAX-RPC docs and in
samples\jaxrpc\ or samples\stock in the Axis distribution uses the wsdl
document but also presumes that _somehow_ I know the input/output
parameterers' type, which I shouldn't know if I just discovered the service.
(I attach the code later on)

So my question is: Isn't there a way to extract this kind of info from the
wsdl doc? (I would think of some getter() methods) After all, that's what we
make it for, isn't it? Unless I'm missing something here :-)

Any help will be greatly appreciated.

P.S: I'm using Axis beta2...
Sample Code (samples\stock\GetQuote1.java, comments on the return
public float getQuote1(String args[]) throws Exception {

      /* Define the service QName and port QName */
      QName servQN = new
      QName portQN = new QName("urn:xmltoday-delayed-quotes","GetQuote");

      /* Now use those QNames as pointers into the WSDL doc */
      Service service = new Service( new URL("file:GetQuote.wsdl"),
servQN );
      Call    call    = (Call) service.createCall( portQN, "getQuote" );

      /* Strange - but allows the user to change just certain portions of */
      /* the URL we're gonna use to invoke the service.  Useful when you  */
      /* want to run it thru tcpmon (ie. put  -p81 on the cmd line).      */
      opts.setDefaultURL( call.getTargetEndpointAddress() );
      call.setTargetEndpointAddress( new URL(opts.getURL()) );

      /* Define some service specific properties */
      call.setUsername( opts.getUser() );
      call.setPassword( opts.getPassword() );

      /* Get symbol and invoke the service */
        Object result = call.invoke( new Object[] { symbol = args[0] } );

      return( ((Float) result).floatValue() ); //How do we know it's a

Thomi Pilioura
PhD Student
Department of Informatics & Telecommunications
University of Athens
Received on Saturday, 2 November 2002 15:10:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:05:09 UTC