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 4100910
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:37:41+00:00 2026-05-20T20:37:41+00:00

I am calling a web service to save an image in db. For that

  • 0

I am calling a web service to save an image in db. For that i picked an image from gallery and pass it to the web service. For me its working fine in Samsung galaxy tab.. But when i run it in HTC ( Android 2.2 Froyo ) an exception is thrown :

My code is :

protected void startGalleryPickActivity() {

    Intent photoPickerIntent = new Intent(Intent.ACTION_PICK,
        android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    photoPickerIntent.setType("image/*");
    photoPickerIntent.putExtra("crop", "true");
    photoPickerIntent.putExtra(MediaStore.EXTRA_OUTPUT, getTempUri());
    photoPickerIntent.putExtra("outputFormat",
        Bitmap.CompressFormat.PNG.toString());
    startActivityForResult(photoPickerIntent, REQ_CODE_PICK_IMAGE);

    }

    private Uri getTempUri() {
    return Uri.fromFile(getTempFile());
    }

    private File getTempFile() {
    if (isSDCARDMounted()) {

        File f = new File(Environment.getExternalStorageDirectory(),
            TEMP_PHOTO_FILE);
        try {
        f.createNewFile();
        } catch (IOException e) {

        }
        return f;
    } else {
        return null;
    }
    }

    private boolean isSDCARDMounted() {
    String status = Environment.getExternalStorageState();
    if (status.equals(Environment.MEDIA_MOUNTED))
        return true;
    return false;
    }


-----------------------------------------------
yourSelectedImage = BitmapFactory.decodeFile(filePath);
uploadImage(yourSelectedImage);

public void uploadImage(final Bitmap yourSelectedImage) {
testWebService(yourSelectedImage);
}

public void testWebService(Bitmap bmp) {

        MarshalBase64 marshal = new MarshalBase64();
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    bmp.compress(CompressFormat.JPEG, 100, out);
    byte[] raw = out.toByteArray();

    SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,
        OPERATION_NAME);

        request.addProperty("image", raw);



    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
        SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);
    marshal.register(envelope);
    HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);

    try

    {

        httpTransport.call(SOAP_ACTION, envelope);
        Object response = envelope.getResponse();
            }

    catch (Exception exception)

    {
        exception.printStackTrace();

    }

    }

Exception is :

03-24 09:52:07.364: ERROR/AndroidRuntime(920): java.lang.OutOfMemoryError
    03-24 09:52:07.364: ERROR/AndroidRuntime(920):     at java.lang.String.<init>(String.java:468)
    03-24 09:52:07.364: ERROR/AndroidRuntime(920):     at java.lang.AbstractStringBuilder.toString(AbstractStringBuilder.java:659)
    03-24 09:52:07.364: ERROR/AndroidRuntime(920):     at java.lang.StringBuffer.toString(StringBuffer.java:720)
    03-24 09:52:07.364: ERROR/AndroidRuntime(920):     at org.kobjects.base64.Base64.encode(Base64.java:33)
    03-24 09:52:07.364: ERROR/AndroidRuntime(920):     at org.ksoap2.serialization.MarshalBase64.writeInstance(MarshalBase64.java:39)
    03-24 09:52:07.364: ERROR/AndroidRuntime(920):     at org.ksoap2.serialization.SoapSerializationEnvelope.writeElement(SoapSerializationEnvelope.java:653)
    03-24 09:52:07.364: ERROR/AndroidRuntime(920):     at org.ksoap2.serialization.SoapSerializationEnvelope.writeProperty(SoapSerializationEnvelope.java:645)
    03-24 09:52:07.364: ERROR/AndroidRuntime(920):     at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:614)
    03-24 09:52:07.364: ERROR/AndroidRuntime(920):     at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:598)
    03-24 09:52:07.364: ERROR/AndroidRuntime(920):     at org.ksoap2.serialization.SoapSerializationEnvelope.writeElement(SoapSerializationEnvelope.java:655)
    03-24 09:52:07.364: ERROR/AndroidRuntime(920):     at org.ksoap2.serialization.SoapSerializationEnvelope.writeBody(SoapSerializationEnvelope.java:579)
    03-24 09:52:07.364: ERROR/AndroidRuntime(920):     at org.ksoap2.SoapEnvelope.write(SoapEnvelope.java:192)
    03-24 09:52:07.364: ERROR/AndroidRuntime(920):     at org.ksoap2.transport.Transport.createRequestData(Transport.java:74)
    03-24 09:52:07.364: ERROR/AndroidRuntime(920):     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:58)
  • 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-05-20T20:37:42+00:00Added an answer on May 20, 2026 at 8:37 pm

    try to compress in PNG format instead of JPEG.

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

Sidebar

Related Questions

I'm calling a web service that returns an array of objects in JSON. I
I am calling a web service from a C# forms based app. ServReturnType obj
I'm calling a web service from a console app - all in C# on
Greetings! I'm calling a Web service from Javascript when a user clicks on a
My superior once told me that a bad way of calling a web service
I’m calling a web service via WCF (w/ .NET 4.0) that requires basic HTTP
I'm having a big problem when calling a web service from my WPF application.
I am calling web service from android but in in response it shows code
Is it possible in .net 2.0 to enable calling web service only from localhost
I am calling a web service from my android client application. After getting response

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.