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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:19:49+00:00 2026-06-12T05:19:49+00:00

I have scenario where i need to transfer one or more file depending on

  • 0

I have scenario where i need to transfer one or more file depending on situation over the network. The size of the files will be between 700KB and 900KB. After upload completes the server will respond with one number, irrespective of the number of files uploaded.
I have been trying to upload it with ksoap2 library after converting it to Base64, but it failed. It would fail when size of my soap header xml size goes around some where 1048000 or so chars.

Then i decided to change my way of upload and am looking to use either HttpURLConnection or http client.
I cannot decide on which one will be efficient for my scenario.

Thanks

Here is the code

code:

            InputStream is = getResources()
                    .openRawResource(R.raw.file_name);

            int size = 0;
            // Read the entire resource into a local byte buffer.
            byte[] buffer = new byte[1024];
            try {

                while ((size = is.read(buffer, 0, 1024)) >= 0) {
                    baos.write(buffer, 0, size);
                }

                is.close();
                buffer = baos.toByteArray();
            } catch (Exception e) {
                // TODO: handle exception
                e.printStackTrace();
            }


            base64string = new String(Base64.encode(buffer, Base64.DEFAULT));

error

org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:1 in java.io.InputStreamReader@4101ce48)  
at org.kxml2.io.KXmlParser.nextTag(KXmlParser.java:2035)
at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:126)
at org.ksoap2.transport.Transport.parseResponse(Transport.java:63)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:100)
  • 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-12T05:19:50+00:00Added an answer on June 12, 2026 at 5:19 am

    I dont know what kind of server you would like to use.
    Your issue of that the files stops while upload might be in your server settings. in your php config for example you can define maximum uploaded file sizes etc.
    here a php example:

    public void uploadFile(){
    
    
    try {
    FileInputStream fis =this.openFileInput(NAME_OF_FILE);
    HttpFileUploader htfu = new HttpFileUploader("http://11.0.6.23/test2.php","noparamshere", NAME_OF_FILE);
    htfu.doStart(fis);
    } catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }
    

    Read more: http://getablogger.blogspot.com/2008/01/android-how-to-post-file-to-php-server.html#ixzz27YPjwX8B

    EDIT: You could also try to make your soap transfer more efficient by implementing MTOM:

    Check out MTOM, a W3C standard designed to transfer binary files through SOAP.

    From Wikipedia:

        MTOM provides a way to send the binary data in its original binary form, 
        avoiding any increase in size due to encoding it in text.
    

    Related resources:

    SOAP Message Transmission Optimization Mechanism http://www.w3.org/TR/soap12-mtom/

    Message Transmission Optimization Mechanism (Wikipedia) http://en.wikipedia.org/wiki/MTOM

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

Sidebar

Related Questions

I have one scenario where I need to select all files having aliencoders.numeric-digits like
I have a scenario where I need to upload a file from one web
I have a scenario where I need to search from many binary files (using
I have a scenario where I need to bind two properties from one class
I have scenario where I need to host a web service (WCF) on Azure
I have a scenario where I need to load properties from database or java
I have a scenario where I need to do the following in a transaction:
I have a scenario where I need a desktop console app to communicate with
I have a scenario where i need to copy the array of Objects(Main array)
In my app, I have this scenario where I need to post an object

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.