Bonjour à tous,
j'essaye d'écrire un web service.

Ok pour un WS qui me renvoie une String par la méthode call.invoke(....).
Par contre je teste maintenant pour que le WS renvoie un ArrayList<String> et la
j'ai l'erreur suivante

Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object;
at SelectClient.main(SelectClient.java:46)
à priori on ne peut pas caster :

ArrayList retour = new ArrayList<String>();
retour = (ArrayList<String>) call.invoke( new Object [] { requete });

voici le code qui appelle le WS.
Merci pour votre aide.


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());
}
}