Nel codice originale ho sostituito:
codice:
SoapObject response = (SoapObject) envelope.getResponse();
con:
codice:
SoapObject response = (SoapObject)envelope.bodyIn;
Nuovo codice:
codice:
try {
httptransport.call(SOAP_ACTION, envelope);
SoapObject response = (SoapObject)envelope.bodyIn;
String val = response.getProperty(0).toString();
Log.d("CallWs.class", "Valore restituito: " + val);
int result = Integer.parseInt(val);
Log.d("CallWs.class", "Valore parsato: " + result);
} catch (SocketException ex) {
ex.printStackTrace();
Log.e("CallWs.class", "Errore nel metodo...", ex);
} catch (Exception e) {
e.printStackTrace();
Log.e("CallWs.class", "Errore nel metodo...", e);
}
Nuovo LogCat:
codice:
03-03 19:37:10.727: E/SpannableStringBuilder(19050): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length03-03 19:37:10.727: E/SpannableStringBuilder(19050): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-03 19:37:17.053: E/CallWs.class(19050): Errore nel metodo...
03-03 19:37:17.053: E/CallWs.class(19050): java.lang.ClassCastException: org.ksoap2.SoapFault cannot be cast to org.ksoap2.serialization.SoapObject
03-03 19:37:17.053: E/CallWs.class(19050): at com.xxxxx.xxxxx.CallWs.onCreate(CallWs.java:58)
03-03 19:37:17.053: E/CallWs.class(19050): at android.app.Activity.performCreate(Activity.java:5206)
03-03 19:37:17.053: E/CallWs.class(19050): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
03-03 19:37:17.053: E/CallWs.class(19050): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
03-03 19:37:17.053: E/CallWs.class(19050): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
03-03 19:37:17.053: E/CallWs.class(19050): at android.app.ActivityThread.access$700(ActivityThread.java:140)
03-03 19:37:17.053: E/CallWs.class(19050): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
03-03 19:37:17.053: E/CallWs.class(19050): at android.os.Handler.dispatchMessage(Handler.java:99)
03-03 19:37:17.053: E/CallWs.class(19050): at android.os.Looper.loop(Looper.java:137)
03-03 19:37:17.053: E/CallWs.class(19050): at android.app.ActivityThread.main(ActivityThread.java:4935)
03-03 19:37:17.053: E/CallWs.class(19050): at java.lang.reflect.Method.invokeNative(Native Method)
03-03 19:37:17.053: E/CallWs.class(19050): at java.lang.reflect.Method.invoke(Method.java:511)
03-03 19:37:17.053: E/CallWs.class(19050): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
03-03 19:37:17.053: E/CallWs.class(19050): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
03-03 19:37:17.053: E/CallWs.class(19050): at dalvik.system.NativeStart.main(Native Method)
03-03 19:37:17.143: E/SpannableStringBuilder(19050): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-03 19:37:17.143: E/SpannableStringBuilder(19050): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length