Bonjour,
je développe une application sous android qui doit se connecter à un web service WCF.
Dans le WCF, j'ai une fonction qui se nomme :
et qui retourn un ArrayList.
Code : Sélectionner tout - Visualiser dans une fenêtre à part GetTranslation(int fLang, int tLang, string word)
alors je veux me connecter au WCF en utilisant la fonction suivante :
Tout le reste du code marche mais mon probléme est que quand je cherche à afficher la valeur de l'ArrayList a, il m'affiche [].
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 private void Translate() { String wordToTranslate = origText.getText().toString().trim(); int fLang = fromSpinner.getSelectedItemPosition(); int tLang = toSpinner.getSelectedItemPosition(); SoapObject Request = new SoapObject(NAMESPACE,METHOD_TRANSLATE); PropertyInfo param1 =new PropertyInfo(); param1.setName("fLang"); param1.setValue(fLang); Request.addProperty(param1); PropertyInfo param2 =new PropertyInfo(); param2.setName("tLang"); param2.setValue(tLang); Request.addProperty(param2); PropertyInfo param3 =new PropertyInfo(); param3.setName("word"); param3.setValue(wordToTranslate); Request.addProperty(param3); SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER12); soapEnvelope.dotNet=true; soapEnvelope.setOutputSoapObject(Request); HttpTransportSE androidHttpTransport= new HttpTransportSE(URL); ArrayList <String> a= new ArrayList<String>(); try{ androidHttpTransport.call(SOAP_ACTION_Translate, soapEnvelope); java.util.Vector<Object> receiveString=(java.util.Vector<Object>)soapEnvelope.getResponse(); if(receiveString!=null) { for(Object curStrings : receiveString) { a.add(curStrings.toString()); for(int i=0; i< a.size();i++) translatedText.setText(curStrings); } } else translatedText.setText("Sorry.... Nothing to display !"); } catch(Exception e){ e.printStackTrace(); }
Donc c'est vide. Ce qui signifie que je n'ai rien récupéré, ce qui signifie encore que ma connection SOAP n'a pas réussi car j'ai entré un mot qui devait me retourner une signification.(c'est dans le cadre d'un dictionnaire).
Moi je ne connais vraiment rien en SOAP et il me faut franchir cette étape pour pouvoir continuer le reste de mon projet.
Help S'il vous plaît.
Merci
Partager