在肥皂Webservice的调用由对等异常重置连接 [英] Connection reset by peer Exception in Soap Webservice calling
问题描述
我打电话SOAP网络服务。它的工作原理正确,但有些时候我被同行例外获得连接复位。
这是Web服务的我的code调用
新主题(新的Runnable(){
公共无效的run(){
尺蠖prepare()。
串响应=;
SoapSerializationEnvelope信封=新SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = TRUE;
envelope.setOutputSoapObject(serverRequestParams.getSoapObject()); HttpTransportSE httpTransport =新HttpTransportSE(serverRequestParams.getUrl(),90000);
httpTransport.debug = TRUE;
尝试{ 的HttpParams my_httpParams =新BasicHttpParams();
最后弦乐的ProxyHost = android.net.Proxy.getDefaultHost();
最终诠释proxyPort = android.net.Proxy.getDefaultPort();
如果(proxyPort!= -1)
{
my_httpParams.setParameter(ConnRoutePNames.DEFAULT_PROXY,新HttpHost(ProxyHost的,proxyPort));
} httpTransport.call(serverRequestParams.getSoapAction(),信封);
对象数据= envelope.getResponse();
如果(数据的instanceof SoapObject){
SoapObject数据2 =(SoapObject)的数据;
响应= data2.toString();
}否则如果(数据的instanceof SoapPrimitive){
SoapPrimitive DATA3 =(SoapPrimitive)的数据;
响应= data3.toString();
}否则如果(数据!= NULL){
响应= data.toString();
}否则如果(数据== NULL){
响应=无数据;
}
}
赶上(例外五){
System.out.print(异常:+ E);
}
查看以下链接可能是其中的一个解决您的问题。
<一个href=\"http://stackoverflow.com/questions/11207394/getting-socketexception-connection-reset-by-peer-in-android\">link1
<一个href=\"http://stackoverflow.com/questions/11021551/intermittent-connection-reset-by-peer-errors-in-android-connecting-to-net-rest\">link2
这些链接包括在客户端解决方案的一些和一些服务器端,并提供他们的信息为什么它的发生。
让我知道如果这可以帮助你。
I am calling Soap web service. It works proper but some times I am getting connection reset by peer exception.
This is my code of web service calling
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);
}
Check out following links may be one of them solves your problem
These links consist of some solution at client side and some on server side and also they provide information why its happening.
Let me know if this helps you.
这篇关于在肥皂Webservice的调用由对等异常重置连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!