Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8050205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:00:22+00:00 2026-06-05T07:00:22+00:00

I am using ksoap2 to communicate to a .net webservice. However, when I submit

  • 0

I am using ksoap2 to communicate to a .net webservice. However, when I submit a byte array from an image, I get an OutOfMemoryError.

I am using the following code:

            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            new MarshalBase64().register(envelope); // serialization
            envelope.dotNet = true;
            envelope.setOutputSoapObject(request);
            HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
            httpTransport.call(ADD_CLIENT_SOAP_ACTION, envelope);               
            Object response = null;
            response = envelope.getResponse();

StackTrace:

06-04 12:46:41.605: E/AndroidRuntime(9661): FATAL EXCEPTION: IntentService[SyncService]
06-04 12:46:41.605: E/AndroidRuntime(9661): java.lang.OutOfMemoryError
06-04 12:46:41.605: E/AndroidRuntime(9661):     at java.io.ByteArrayOutputStream.expand(ByteArrayOutputStream.java:91)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:216)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:164)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at java.io.OutputStreamWriter.convert(OutputStreamWriter.java:236)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at java.io.OutputStreamWriter.write(OutputStreamWriter.java:225)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at java.io.BufferedWriter.write(BufferedWriter.java:249)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at org.kxml2.io.KXmlSerializer.writeEscaped(KXmlSerializer.java:137)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at org.kxml2.io.KXmlSerializer.text(KXmlSerializer.java:544)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at org.ksoap2.serialization.MarshalBase64.writeInstance(MarshalBase64.java:40)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at org.ksoap2.serialization.SoapSerializationEnvelope.writeElement(SoapSerializationEnvelope.java:656)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at org.ksoap2.serialization.SoapSerializationEnvelope.writeProperty(SoapSerializationEnvelope.java:649)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:604)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:582)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at org.ksoap2.serialization.SoapSerializationEnvelope.writeElement(SoapSerializationEnvelope.java:658)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at org.ksoap2.serialization.SoapSerializationEnvelope.writeBody(SoapSerializationEnvelope.java:564)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at org.ksoap2.SoapEnvelope.write(SoapEnvelope.java:205)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at org.ksoap2.transport.Transport.createRequestData(Transport.java:111)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:120)
06-04 12:46:41.605: E/AndroidRuntime(9661):     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:00:24+00:00Added an answer on June 5, 2026 at 7:00 am

    The combination of a “big” image and no optimization in kSOAP2 is probably too much for the limited memory of your smart phone.

    I estimate that kSOAP2 temporarily uses at least 5 times as much memory as the size of the byte array you want to send. This is in addition to the byte array itself and in addition to other copies of the image you might keep around.

    So to get it working you either need to find other areas in your app where you can reduce the memory consumption. Or you need to find a different SOAP library that doesn’t keep the complete XML message as well as a Base 64 encoded string of the byte array in memory but uses a streaming approach that encodes small chunks of the array and sends them directly over the network connection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am using following webservices for retrieving data from server server side:.net client side:ksoap2
I am using KSOAP2 to call a .NET webservice from android application,and the response
I am using ksoap2 API to call .net webservices from Android. I am getting
Calling a .net SOAP1.1 web service from android using ksoap2 lib I met a
I am consuming a dotnet webservice on android code using ksoap2.I can successfully call
i tried the example from http://www.helloandroid.com/tutorials/using-ksoap2-android-and-parsing-output-data to get request and response from a wsdl
Using DMD 2.057, I cannot get the following code to compile: import std.stdio; import
I'm trying to consume a .net webservice using ksoap2. this is the envelope of
I'm using the code snippet below to get user details from a wsdl url
I'm sending this request to my WCF webservice with a Android client using ksoap2:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.