stub-based example

This stub-based client example can be found in %JAGUAR%\sample\wst_samples\JavaClassClient\client\AddClient.java.

package client;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
/**
* @author Sybase
*
* A sample client to access the add method in the service.
* The add method returns the addition of two numbers
* which is calculated by the webservice AddNumbers.
*
*/
public class AddClient
{
    public static void main(String[] args)
    {
        AddNumbers_ServiceLocator context;
        AddNumbers_Port client;
        try
        {
            int num1 = 10;
            int num2 = 10;
            context = new AddNumbers_ServiceLocator();
            client = context.getAddNumbers();

            if (args.length > 0)
            {
                num1 = new Integer(args[0]).intValue();
                if (args.length >1)
                {
                    num2 = new Integer(args[1]).intValue();
                }
            }
            int value= client.add(num1, num2);
            System.out.println("Result of adding " + num1 + " and " +  num2  + " is: " + value);
        }
        catch (ServiceException ex1)
        {
            ex1.printStackTrace();
        }
        catch (RemoteException ex2)
        {
            ex2.printStackTrace();
        }
    }
}