Bonsoir,
Après plusieurs recherches infructueuses, je me permet de demander de l'aide ici.
Mon application a besoin de récupérer à partir d'un service web (.NET, C#, crée par moi) une valeur (un entier).
J'utilise pour ce faire la libraire KSOAP2 et plus particulièrement son implémentation Android (ksoap2-android-assembly-2.5.4-jar-with-dependencies).
Voici mon code se chargeant de faire l'appel :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
private static final String SOAP_ACTION = "http://mondomaine.fr/maFonction";
private static final String METHOD_NAME = "maFonction";
private static final String NAMESPACE = "http://mondomaine.fr/";
private static final String URL = "http://mondomaine.fr/services/mesServices.asmx";
private int maFonction()
{
int week = 30;
try
{
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
Log.d("Path", "1");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
Log.d("Path", "2");
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
Log.d("Path", "3");
androidHttpTransport.call(SOAP_ACTION, envelope);
Log.d("Path", "4");
SoapObject result = ((SoapObject) envelope.getResponse());
week = Integer.parseInt(result.getProperty(0).toString());
Log.d("Path", "5");
}
catch (Exception e)
{
Log.e("Error", e.toString());
}
return week;
} |
Il se trouve que ce code génère une exception de type
org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <html>@1:6 in java.io.InputStreamReader@405610b8) lors de l'appel à call.
J'ai déjà vérifié maintes fois mes valeurs SOAP_ACTION, ..., j'ai changé la version de l'enveloppe, rien n'y fait, toujours la même erreur au même endroit.
Je remercie d'avance ceux qui prendront le temps de m'aider.
Cordialement.
Partager