Additional Code zip file - 6.1 MB

Listing 1 Creating a simple Java client to invoke a Web Service through the generated
 service locator and service endpoint interface.

package services;
/**
 * To invoke stock service
 */
public class StockServiceClient {
/**
 * To invoke stock service
 */
     public static void main(String[] args) {
	try{
		StockServiceServiceLocator wsl = new StockServiceServiceLocator();
		StockService ws = (StockService) wsl.getStockService();
		String name = ws.getStockName();
		System.out.println("Stock name: " + name);
		double price = ws.getLatestPrice();
		System.out.println("Stock price: " + price);
		long volume = ws.getLatestVolume();
		System.out.println("Stock volume: " + volume);
	} catch (Exception e) {
		e.printStackTrace();
	}
      }
}

Listing 2 The StockServiceSoapBindingImpl-generated Web Service implementation class

package services;

public class StockServiceSoapBindingImpl implements services.StockService{
    public double getLatestPrice() throws java.rmi.RemoteException {
        return -3;  // put some more meaningful code here
    }
    public long getLatestVolume() throws java.rmi.RemoteException {
        return -3;  // put some more meaningful code here
    }
    public java.util.Calendar getLatestDateTime() throws java.rmi.RemoteException {
        return null;  // put some more meaningful code here
    }
    public java.lang.String getStockName() throws java.rmi.RemoteException {
        return null; // put some more meaningful code here
    }
    public void setStockName(java.lang.String nm) throws java.rmi.RemoteException {
	// put some more meaningful code here
    }
    public java.lang.String getStockSymbol() throws java.rmi.RemoteException {
        return null; // put some more meaningful code here
    }
    public void setStockSymbol(java.lang.String sb) throws java.rmi.RemoteException {
	// put some more meaningful code here
    }
    public void setLatestStockData(double price, long volume) throws java.rmi.RemoteException {
	// put some more meaningful code here
    }
    public java.lang.String getStockHistory() throws java.rmi.RemoteException {
return null; // put some more meaningful code here
    }
}

Additional Code zip file - 6.1 MB