import java.rmi.RemoteException;
import javax.xml.rpc.ParameterMode;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
public class CallAdd {
public static void main(String[] args) {
Call call = new Call(new Service());
call.setTargetEndpointAddress("http://localhost/axis/Calc.jws");
call.setOperationName("add");
call.addParameter("a", XMLType.XSD_INT, ParameterMode.IN);
call.addParameter("b", XMLType.XSD_INT, ParameterMode.IN);
call.setReturnType(XMLType.XSD_INT);
Object[] param = new Object[2];
param[0] = new Integer(args[0]);
param[1] = new Integer(args[1]);
try {
Object result = call.invoke(param);
System.out.println("result="+result);
} catch (RemoteException re) {
re.printStackTrace();
}
}
}
|