1 16 17 18 import org.apache.axis.client.Call; 19 import org.apache.axis.client.Service; 20 import org.apache.axis.encoding.XMLType; 21 import org.apache.axis.utils.Options; 22 23 import javax.xml.namespace.QName ; 24 import javax.xml.rpc.ParameterMode ; 25 26 34 public class NewClient 35 { 36 public static void main(String [] args) 37 { 38 try { 39 Options options = new Options(args); 40 41 String endpointURL = options.getURL(); 42 String textToSend; 43 44 args = options.getRemainingArgs(); 45 if ((args == null) || (args.length < 1)) { 46 textToSend = "<nothing>"; 47 } else { 48 textToSend = args[0]; 49 } 50 51 Service service = new Service(); 52 Call call = (Call) service.createCall(); 53 54 call.setTargetEndpointAddress( new java.net.URL (endpointURL) ); 55 call.setOperationName( new QName ("http://example3.userguide.samples", "findReportUnits") ); 56 call.addParameter( "arg1", XMLType.XSD_STRING, ParameterMode.IN); 57 call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING ); 58 59 String ret = (String ) call.invoke( new Object [] { textToSend } ); 60 61 System.out.println("You typed : " + ret); 62 } catch (Exception e) { 63 System.err.println(e.toString()); 64 } 65 } 66 } 67 | Popular Tags |