当我尝试运行我的androidHttpTransport.call(SOAP_ACTION, envelope);
我的程序错误时,然后在逐步执行它时,我可以看到connection=null
它应该是这样的吗? (我假设不是)如果不是,那么有人可以告诉我是什么原因造成的吗?
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://foo/bar/Service1.asmx";
private static final String METHOD_NAME = "HelloWorld";
private static final String SOAP_ACTION = "http://tempuri.org/HelloWorld";
public void getMessage() {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
Log.i(TAG, "Envelope to String: \n" + String.valueOf(envelope));
Log.i(TAG, "request to String: \n" + String.valueOf(request));
envelope.dotNet = true;
//Set output SOAP object
envelope.setOutputSoapObject(request);
//Create HTTP call object
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
//Invoke web service
androidHttpTransport.debug=true;
androidHttpTransport.setXmlVersionTag("<!--?xml version=\"1.0\" encoding= \"UTF-8\" ?-->");
blah = androidHttpTransport.requestDump;
androidHttpTransport.call(SOAP_ACTION, envelope);
//Get the response
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
//Assign it to fahren static variable
message = response.toString();
} catch (Exception e) {
e.printStackTrace();
/*Log.i("HT", blah);
Log.i("Exception", e.getMessage().toString());*/
}
}
}
这是调用正在进行的调试:
这是错误输出后的视图:
有人知道这可能是什么原因吗?