0

So i'm trying to collect some data from webservice using ksoap. It works fine on older phones, and on newer when i have wifi connection. When i change to broadband from mobile provider it returns error:

 java.net.SocketException: Socket is closed

Anybody got any ideas why that happens? It's realy weird i have two phones both connecting to the same webservice both using identicly application and the older one works and new doesn't.

Btw my code:

String METHOD_NAME = "MPList";
String SOAP_ACTION = "https://server.location:443/MobileWS/#MPList";
String NAMESPACE = "https://server.location:443/MobileWS/";
String URL = "https://server.location:443/MobileWS/";

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("user", user);
request.addProperty("pass", pass);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12); 
List<HeaderProperty> headerList = new ArrayList<HeaderProperty>();

headerList.add(new HeaderProperty("Content-Type", "text/xml; charset=utf-8"));
headerList.add(new HeaderProperty("SoapAction", "https://server.location/#MPList"));
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(URL);  
httpTransport.debug = true;
try{
    httpTransport.call(SOAP_ACTION, envelope, headerList);
    SoapObject response = (SoapObject)envelope.bodyIn;
    String a=httpTransport.responseDump;
} catch (IOException e2) {
    e2.printStackTrace();
} catch (XmlPullParserException e2) {
    e2.printStackTrace();
}
simonc
  • 41,632
  • 12
  • 85
  • 103
gabrjan
  • 3,080
  • 9
  • 40
  • 69

1 Answers1

0

Well it looks like there is a problem in Android 4.0.3 and 4.0.4, so it doesn't work with https well. Link: http://code.google.com/p/android/issues/detail?id=29509&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

If somebody ever meet that problem again, here is the solution:

U have to add http "Connection" property with "keep-alive" value.

 headerList.add(new HeaderProperty("Connection", "keep-alive"));

That solved my problems!!!

gabrjan
  • 3,080
  • 9
  • 40
  • 69