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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:28:17+00:00 2026-05-26T15:28:17+00:00

How can I upload an image file to a webservice using SOAP? I need

  • 0

How can I upload an image file to a webservice using SOAP?

I need it to be used with SoapObejct so the webservice can handle the input file in its context and give it a new filename.

How?
Any code examples?

Yoav

  • 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-26T15:28:18+00:00Added an answer on May 26, 2026 at 3:28 pm

    Convert your image file to a Base64 string and send your string with its name to web-service easily.
    Do you still need code sample?

    Edit

    public static String fileToBase64(String path) throws IOException {
        byte[] bytes = Utilities.fileToByteArray(path);
        return Base64.encodeBytes(bytes);
    }
    
    public static byte[] fileToByteArray(String path) throws IOException {
        File imagefile = new File(path);
        byte[] data = new byte[(int) imagefile.length()];
        FileInputStream fis = new FileInputStream(imagefile);
        fis.read(data);
        fis.close();
        return data;
    }
    
    public class MyImage  {
    public String name;
    public String content;
    }
    

    send your object to the webservice as a JSON string:

    in your activity:

    MyClass myClass = new MyClass();
    myClass.name = "a.jpg";
    myClass.content = fileToBase64("../../image.jpg");
    sendMyObject(myClass);
    
    private void sendMyObject(
            MyImage myImage ) throws Exception {
        // create json string from your object
        Gson gson = new Gson();
        String strJson = gson.toJson(myImage);
        //send your json string here
        //...
    
    }
    

    In your webservice convert your json string to a real object which is a replica of MyClass.

    edit:

    Also you can ignore Json and have a webserivce method with 2 parameters: MyWebserviceMethod(string filename, string content);
    pass Base64 string as second parameter.

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

Sidebar

Related Questions

I have used a input file code to upload image to my wallpaper site..
I need to upload only image file through <input type="file"> tag. Right now, it
We have a webapp where people can upload various image file types and on
I can't seem to upload an image using Zend_Service_Nirvanix. Is it even possible? I
I am using following tutorial to upload image file to webserver. and getting file
I need a method which will take an *.jpg image file and upload it
well I can upload image, mp3, mp4, .doc file etc with the following form.
I use this code for upload image: http://vikaskanani.wordpress.com/2011/01/11/android-upload-image-or-file-using-http-post-multi-part/ I replaced bm = BitmapFactory.decodeFile(/data/data/fshizzle.com/files/image.jpg); and
I have a site where I can upload an image, and i am using
i'm creating an activity which needs to upload an image to a webservice using

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.