jlbadano / ksoap2-android

Automatically exported from code.google.com/p/ksoap2-android
0 stars 0 forks source link

Ksoap2 - android not able to parse large response data #166

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.I am getting a 15mb file in response from soap web service as a Vector<Byte>.
2.but i am getting the out of memory error from Ksoap library when it is trying 
to parse the response.

What is the expected output? What do you see instead?
I am expecting that Ksoap library will return me a Vector<Byte> after response 
parse.
While I am getting this exception

06-14 05:48:54.136: E/AndroidRuntime(1781): Caused by: 
java.lang.OutOfMemoryError
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:94)
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:124)
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
java.lang.StringBuilder.append(StringBuilder.java:271)
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
org.kxml2.io.KXmlParser.readValue(KXmlParser.java:1338)
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
org.kxml2.io.KXmlParser.next(KXmlParser.java:390)
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
org.kxml2.io.KXmlParser.next(KXmlParser.java:310)
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
org.ksoap2.serialization.SoapSerializationEnvelope.readUnknown(SoapSerialization
Envelope.java:251)
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
org.ksoap2.serialization.SoapSerializationEnvelope.read(SoapSerializationEnvelop
e.java:422)
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
org.ksoap2.serialization.SoapSerializationEnvelope.readUnknown(SoapSerialization
Envelope.java:289)
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
org.ksoap2.serialization.SoapSerializationEnvelope.read(SoapSerializationEnvelop
e.java:422)
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
org.ksoap2.serialization.SoapSerializationEnvelope.readUnknown(SoapSerialization
Envelope.java:289)
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
org.ksoap2.serialization.SoapSerializationEnvelope.read(SoapSerializationEnvelop
e.java:422)
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEn
velope.java:149)
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:137)
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
org.ksoap2.transport.Transport.parseResponse(Transport.java:96)
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:189)
06-14 05:48:54.136: E/AndroidRuntime(1781):     at 
org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95)

What version of the product are you using? On what operating system?
I am using ksoap2-android-assembly-2.5.8-jar-with-dependencies.jar

Please provide any additional information below.
Is there any way to send a huge file in KSoap2 as attachment .or any other way 
to deal with large size data.

Original issue reported on code.google.com by pawan.sh...@innovationm.com on 18 Jun 2013 at 10:32

GoogleCodeExporter commented 9 years ago
Try with the latest 3.0.0 version .. there were some enhancements regarding 
large response bodies including saving to a file since 2.5.8

Original comment by mosa...@gmail.com on 18 Jun 2013 at 3:09

GoogleCodeExporter commented 9 years ago
Hi

Can you please tell me , from where i can download version 3.0.0 jar.

Thanks in advance.

*Regards*
*
*
*Pawan Shukla*
*InnovationM Mobile Technologies*

Original comment by pawan.sh...@innovationm.com on 18 Jun 2013 at 3:30

GoogleCodeExporter commented 9 years ago
https://code.google.com/p/ksoap2-android/wiki/HowToUse?tm=2

Original comment by mosa...@gmail.com on 19 Jun 2013 at 10:18

GoogleCodeExporter commented 9 years ago
Hi as u suggest and provide me the link i also tried with the latest version
ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar

but still getting the same error 

I used this link to get the raw jar file

https://code.google.com/p/ksoap2-android/source/browse/m2-repo/com/google/code/k
soap2-android/ksoap2-android-assembly/3.0.0/ksoap2-android-assembly-3.0.0-jar-wi
th-dependencies.jar

any other advice. I am stuck how to get the 15Mb in SOAP response by KSoap 
library

Thanks in Advance

Original comment by pawan.sh...@innovationm.com on 20 Jun 2013 at 9:16

GoogleCodeExporter commented 9 years ago
Adding my two cents here. File content can be embedded in Soap response (XML) 
in Soap Envelope (in content area of HTTP Response) but that might cause 
problem of OOM as XML is first taken into memory and then parsed. 

We need to have file sent as attachment (Content-Type: Multipart/Related) 
separate from the Soap Envelope. See this link:
http://www.w3.org/TR/SOAP-attachments

We need to explore ksoap2 library if they are able to handle such a response 
where attachment can be read as it is streamed.

Original comment by man...@innovationm.com on 22 Jun 2013 at 8:06