axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Lear <r...@zopyra.com>
Subject Re: Question about WSDL2Java generated code
Date Wed, 30 Apr 2003 04:43:07 GMT
On Wednesday, April 30, 2003 at 01:44:15 (+0000) dumdum 420 writes:
>I will take a guess at this ... since I also started my webservice 
>experience with the Fibonacci example ... but was not as inovative ...
>
>FibonacciSoapBindingImpl is not a good apporach for you to test your client. 
>Basically go ahead and install your service in the AxisEngine by using the 
>AdminClient class. And then regenerate your client code without the -s 
>option and instead of giving the location of .wsdl now since it is up and 
>running service give the URL ?wsdl and then generate the stubs.
>
>Then basically go ahead and create your client by accessing the server code 
>using the stub and you will be all fine ...
>
>If still I am not clear tell me and I think I can skim you some client code 
>...

I think I've got it:

% cat FibonacciTester.java

    package fibonacci;

    public class FibonacciTester {
        public static void main(String [] args) throws Exception {
            fibonacci.ws.FibonacciService service =
                new fibonacci.ws.FibonacciServiceLocator();

            fibonacci.ws.Fibonacci fib = service.getfibonacci();

            fibonacci.ws.FibonacciRequest request =
                new fibonacci.ws.FibonacciRequest();

            request.setStart(10);
            request.setStop(12);

            try {
                fibonacci.ws.FibonacciReply reply =
                    fib.calculateFibonacci(request);
                int[] a = reply.getResults();
                for (int i = 0; i < a.length; ++i) {
                    System.out.println("fib(" + (i + 10) + ") = " + a[i]);
                }
            } catch (java.rmi.RemoteException e) {
                System.err.println("Error: " + e);
            }
        }
    }


% java fibonacci.FibonacciTester
fib(10) = 55
fib(11) = 89
fib(12) = 144

Very cool.  Thanks.


Bill

Mime
View raw message