Eric: I think this is an issue of Servlets and JSPs. Once you are a little bit familiar with this, I think you can easily retrieve one parameter (named machine_name or so) out of an HTML form. Then you just call LoadClient.main( machine_name) and get the result.
I am not very familiar with Servlets and JSPs but this is the way I would approach. best regards Matthias Wimmer -----Original Message----- From: Eric Roberts [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 11, 2002 4:43 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; Jeson Martajaya Subject: Accessing Web Services from the web Ok, I have a web service class that i want to use to access loads on certain machines. It takes one parameter, the machine name. The Java source looks like this: (begin source here) package samples.userguide.load; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.apache.axis.encoding.XMLType; import org.apache.axis.utils.Options; import javax.xml.rpc.ParameterMode; public class LoadClient { public static void main(String [] args) throws Exception { Options options = new Options(args); String endpoint = "http://localhost:" + options.getPort() +"/axis/Load.jws"; args = options.getRemainingArgs(); if (args == null || args.length != 1) { System.err.println("Usage: LoadClient arg1"); return; } String s1 = new String(args[0]); Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(new java.net.URL(endpoint) ); call.setOperationName("getBatchQueueLoad"); call.addParameter( "machine", XMLType.XSD_STRING, ParameterMode.IN); call.setReturnType(XMLType.XSD_STRING); String ret = ""; try { ret = (String) call.invoke(new Object[] {s1}); } catch(Exception e) { System.out.println("s1 = "+s1+" ret = '"+ret+"'"); System.out.println("ret BAAAAADDDD!!\n" + e); e.printStackTrace(); } System.out.println(ret); } } The location of this file is /usr/local/apps/xml-axis-beta2/samples/userguide/load The Load.jws file looks like this (begin code here) import java.net.URL; import java.net.MalformedURLException; import java.io.*; public class Load { public static String getBatchQueueLoad (String machine) { String line =""; try { URL u = new URL ("http://www.tacc.utexas.edu/~rich/hipcat_data/" + machine + "_load.txt"); BufferedReader data = new BufferedReader ( new InputStreamReader( u.openStream() )); line = data.readLine(); data.close(); } catch (IOException e) { System.err.println("Error: " + e); } return line; } } The location of the Load.jws file is her /usr/local/apps/jakarta-tomcat-4.0.4-b1/webapps/axis Everything works great when I run the command java samples.userguide.load.LoadClient machine_name I get back the load on the machine. I want to have a web interface with forms fields where I can put in the machine name and click submit and have the load returned and displayed in and HTML page. Does this call for servlets/jsp? I keep reading about WSDL everywhere but noone seems to explain how to utilize it. Every tutorial seems to stop short of telling how to access a web service from the WEB. What am I missing? Am I going in the right direction? Many thanks in advance -- _____________________________________________________________________ Eric Roberts [EMAIL PROTECTED] Grid Computing Group Texas Advanced Computing Center University of Texas at Austin http://www.tacc.utexas.edu/~ericrobe _____________________________________________________________________
