First, look at the source of my TempGetter command line interface.
Notice how simple (and RMI-like) the class is.
/*
* TempGetter.java
*
* Created on May 21, 2003, 11:57 PM
*/
import electric.registry.Registry;
/**
*
* @author unknown
* @version
*/
public class TempGetter {
/** Creates new TempGetter */
public TempGetter() {
}
/*
* Prompt the user for zip code, get the
temp, display.
*
*/
public void run() {
try {
System.out.println("In run");
ITemperaturePortType temps = TemperatureServiceHelper.bind();
System.out.println("Got temps, prompting user.");
String zip = javax.swing.JOptionPane.showInputDialog("Enter the ZIP.");
float selectedTemp = temps.getTemp("45202");
System.out.println("Temperature: " + selectedTemp);
javax.swing.JOptionPane.showMessageDialog(null, "Temperature: " + selectedTemp);
} catch (Exception e)
{
System.out.println("Exception caught in run(). Message: " +e.getMessage());
e.printStackTrace();
}
}
public static void main(String args[]) {
TempGetter tg = new
TempGetter();
tg.run();
}
}
-
Now, the two files that GLUE generated. Again, note the simplicity.
// generated by GLUE/wsdl2java on Wed May 21 23:26:56 EDT 2003
public interface ITemperaturePortType
{
float getTemp( String zipcode );
}
// generated by GLUE/wsdl2java on Wed May 21 23:26:56 EDT 2003
import electric.registry.Registry;
import electric.registry.RegistryException;
public class TemperatureServiceHelper
{
public static ITemperaturePortType bind() throws RegistryException
{
return bind( "file://Projects/30IT398/chatService/genserver/TemperatureService.wsdl"
);
}
public static ITemperaturePortType bind( String url ) throws
RegistryException
{
return (ITemperaturePortType) Registry.bind(
url, ITemperaturePortType.class );
}
}
-
Screen capture of the running program, using 45202 at 12:45 AM on 5/22/2003:
Open Lab
Your choice:
-
Write a quick interface. Generate the classes for a Web Service.
Use either GLUE or jwsdp
-
Make a sexier UI for the TempGetter.
-
Make a client for another Web Service on www.xmethods.net.
|