import java.util.ArrayList;
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 com.sun.mail.iap.Response;
import javax.xml.rpc.ParameterMode;
public class SelectClient {
public static void main(String [] args) throws Exception {
Options options = new Options(args);
String endpoint = "http://localhost:8080/axis/ConnexionMySQL.jws";
// Do argument checking
args = options.getRemainingArgs();
if (args == null || args.length != 2) {
return;
}
String method = args[0];
if (!(method.equals("selectStatement") )) {
return;
}
// Make the call
String requete = 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("op1", XMLType.XSD_STRING, ParameterMode.IN);
//call.addParameter("op2", XMLType.XSD_INT, ParameterMode.IN);
call.setReturnType(XMLType.SOAP_ARRAY);
System.out.println("client:requete = " + requete);
ArrayList retour = new ArrayList<String>();
retour = (ArrayList<String>) call.invoke( new Object [] { requete });
System.out.println("Got result : " + retour.size());
}
}
Partager