Soap Web サービスを呼び出しています。正常に動作しますが、ピア例外によって接続がリセットされることがあります。
これは私のWebサービス呼び出しのコードです
new Thread(new Runnable() {
public void run() {
Looper.prepare();
String response = "";
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(serverRequestParams.getSoapObject());
HttpTransportSE httpTransport = new HttpTransportSE(serverRequestParams.getUrl(),90000);
httpTransport.debug = true;
try {
HttpParams my_httpParams = new BasicHttpParams();
final String proxyHost = android.net.Proxy.getDefaultHost();
final int proxyPort = android.net.Proxy.getDefaultPort();
if(proxyPort != -1)
{
my_httpParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, new HttpHost(proxyHost, proxyPort));
}
httpTransport.call(serverRequestParams.getSoapAction(), envelope);
Object data = envelope.getResponse();
if (data instanceof SoapObject) {
SoapObject data2 = (SoapObject) data;
response = data2.toString();
} else if (data instanceof SoapPrimitive) {
SoapPrimitive data3 = (SoapPrimitive) data;
response = data3.toString();
} else if (data != null) {
response = data.toString();
} else if (data == null) {
response = "nodata";
}
}
catch (Exception e) {
System.out.print("Exception:"+e);
}