package com.wrox.webservices; 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 HelloWorldClient { public static void main(String [] args) throws Exception { Options options = new Options(args); String endpoint = "http://localhost:" + options.getPort() + "/axis/HelloWorld.jws"; args = options.getRemainingArgs(); if (args == null || args.length != 2) { System.err.println("Usage: HelloWorldClient arg1 "); return; } String method = args[0]; if (!(method.equals("HelloWorld"))){ System.err.println("Usage: HelloWorld arg1 "); return; } String name = new String(args[1]); Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress( new java.net.URL(endpoint) ); call.setOperationName( method ); call.addParameter( "name", XMLType.XSD_STRING, ParameterMode.IN ); call.setReturnType( XMLType.XSD_STRING ); String result = (String)call.invoke(new Object[] { name }); System.out.println(result); } }