Ho appena completato un App Android su WSDL, ho alcuni suggerimenti per aggiungere:
1.la risorsa più importante è www.wsdl2code.com
2. si può prendere username e password con l'intestazione, che codificato con Base64, come ad esempio:
String USERNAME = "yourUsername";
String PASSWORD = "yourPassWord";
StringBuffer auth = new StringBuffer(USERNAME);
auth.append(':').append(PASSWORD);
byte[] raw = auth.toString().getBytes();
auth.setLength(0);
auth.append("Basic ");
org.kobjects.base64.Base64.encode(raw, 0, raw.length, auth);
List<HeaderProperty> headers = new ArrayList<HeaderProperty>();
headers.add(new HeaderProperty("Authorization", auth.toString())); // "Basic V1M6"));
Vectordianzhan response = bydWs.getDianzhans(headers);
3.somethimes, non si è sicuri né del codice Android o web server è sbagliato, quindi eseguire il debug è important.in campione , intercettando "XmlPullParserException", registra "requestDump" e "responseDump" nell'eccezione. Inoltre, dovresti prendere il pacchetto IP con adb.
try {
Logg.i(TAG, "2 ");
Object response = androidHttpTransport.call(SOAP_ACTION, envelope, headers);
Logg.i(TAG, "requestDump: " + androidHttpTransport.requestDump);
Logg.i(TAG, "responseDump: "+ androidHttpTransport.responseDump);
Logg.i(TAG, "3");
} catch (IOException e) {
Logg.i(TAG, "IOException");
}
catch (XmlPullParserException e) {
Logg.i(TAG, "requestDump: " + androidHttpTransport.requestDump);
Logg.i(TAG, "responseDump: "+ androidHttpTransport.responseDump);
Logg.i(TAG, "XmlPullParserException");
e.printStackTrace();
}
bella. Mantenere il buon lavoro! – DeliveryNinja