lingfeng0510/ksoap2-android

EOF Exception Ksoap2-3.4.0

Opened this issue · 11 comments

What steps will reproduce the problem?
1.Run app
2.
3.

What is the expected output? What do you see instead?
Get the result from web Service

What version of the product are you using? On what operating system?
3.4.0

Please provide any additional information below.
java.io.EOFException
libcore.io.Streams.readAsciiLine(Streams.java:203)
libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:560)
libcore.net.http.HttpEngine.readResponse(HttpEngine.java:813)
libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:27
4)
libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.jav
a:486)
org.ksoap2.transport.ServiceConnectionSE.getResponseCode(ServiceConnectionSE.jav
a:103)

Original issue reported on code.google.com by mihai.re...@3sstudio.com on 4 Feb 2015 at 9:27

Are there any solutions to this error?
Could someone help me out please?

Original comment by mihai.re...@3sstudio.com on 4 Feb 2015 at 9:31

Report the same error! 

Original comment by benoffi7 on 30 Apr 2015 at 7:33

Hi benoffi7,

I solved this problem by adding this line in HttpTransferSE, Line 172:
System.setProperty("http.keepAlive", "false"); //possible eof exception problem
        connection.setRequestProperty("Accept-Encoding", "gzip");

Honestly I don't know which are the drawbacks but for me it works now without 
problem. I read some threads in which it was written that if you don't keep the 
connection alive then it will take longer to make requests. For me the 
connection with the server is acceptable fast so I let it like this.


Original comment by mihai.re...@3sstudio.com on 4 May 2015 at 9:13

Hi! Can you send me a JAR with that line? 

Thanks a lot!!!

Original comment by benoffi7 on 4 May 2015 at 6:56

Hi,

I attached the jar, hope it helps. :)

Good luck!

Original comment by mihai.re...@3sstudio.com on 4 May 2015 at 7:21

Thaaaaaaaanks a lot!!! You save my day!!!

Original comment by benoffi7 on 4 May 2015 at 7:22

don't thank me :) test it first :D. 


Original comment by mihai.re...@3sstudio.com on 4 May 2015 at 7:23

Please do not attach jar files here. They are not offical releases and the 
project has no control over the content. Anything could be in there. If you 
want this in an official release please send a pull request ... 

Also this specific sort of setting can be done via your our code as well. You 
do NOT need to path the actual source code of ksoap2-android.

Original comment by mosa...@gmail.com on 4 May 2015 at 8:09

How we can add 

System.setProperty("http.keepAlive", "false"); //possible eof exception problem
connection.setRequestProperty("Accept-Encoding", "gzip");

in our code?


SoapObject request = new SoapObject(app.NAMESPACE, metodo);

request.addProperty(app.param_sucursal, sucursal);
request.addProperty(app.param_cuenta, cuenta);

SoapSerializationEnvelope envelope = new 
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(app.URL);

androidHttpTransport.debug = true;

List<HeaderProperty> headerList = new ArrayList<HeaderProperty>();
headerList.add(new HeaderProperty("Authorization", "Basic " + 
org.kobjects.base64.Base64.encode(app.user.getBytes())));

androidHttpTransport.call(app.SOAP_ACTION, envelope, headerList);

Original comment by benoffi7 on 4 May 2015 at 8:17

I deleted the attachment, sorry for that, i was online and saw the question, so 
i posted a quick solution.

@benoffi7
I downloaded the ksoap2 sources from git, added them to my project, and changed 
the line that I sent you. This is what I did, maybe there are also other ways, 
but I don't know the library so didn't knew what other settings could be done.

Original comment by mihai.re...@3sstudio.com on 5 May 2015 at 7:39

The project is migrating to github. If you believe this issue is still valid 
and should be tracked please file a new issue at 
https://github.com/simpligility/ksoap2-android/issues



Original comment by mosa...@gmail.com on 7 Aug 2015 at 5:35

  • Changed state: AwaitingContribution