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