logi.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME_2);
//SoapObject
request.addProperty("email", "xxxx@yahoo.com");
request.addProperty("password", "1234");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(URL);
try
{
httpTransport.call(SOAP_ACTION_2, envelope);
Object response = envelope.getResponse();
Toast.makeText(getBaseContext(),response.toString(),Toast.LENGTH_LONG).show();
}
catch (Exception exception)
{
Toast.makeText(getBaseContext(),exception.toString(),Toast.LENGTH_LONG).show();
}
}
});
答案 0 :(得分:0)
我不相信你有连接问题。我相信这可能是你主线程上的一个问题。无论如何,您需要将您的请求放在AsyncTask中。这允许android在新的后台线程上进行调用,这是Honeycomb之后所有HTTP调用所必需的。我相信这个链接提供了一个很好的实现示例。 How can I make a ksoap2 call in async task?