在这个示例代码中,我引用了ksoap2-android-assembly-2.6.3-jar-with-dependencies
,当我hts.call(SOAP_ACTION, envelope);
在调试模式下到达线路时,这令人难以置信;应用程序代码以错误消息结尾,进入 Log Cat 消息错误是:
-- 04-28 23:24:03.454: W/ActivityManager(80): Launch timeout has expired, giving up wake lock!
-- 04-28 23:23:38.667: W/ActivityManager(80): Activity idle timeout for ActivityRecord{407c0c10 yservices.screens/.MyservicesActivity}
我在创建事件中的源代码:
TextView tv = new TextView(this);
setContentView(tv);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.dotNet = true;
AndroidHttpTransport hts = new AndroidHttpTransport(URL);
try {
hts.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
// Log.i("myApp", response.toString());
//tv.setText(weight+" "+fromUnit+" equal "+response.toString()+ " "+toUnit);
tv.setText("Ok");
} catch(Exception e) {
//e.getLocalizedMessage();
tv.setText(e.getMessage());
}
我希望你能帮助我。我的操作系统版本是 Windows 7 64 位、Eclipse Indigo 和 JDK 1.6,如果您需要其他信息,请写信给我。
谢谢