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

  • Home
  • SEARCH
  • 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 8181165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:25:42+00:00 2026-06-07T00:25:42+00:00

I am trying to get an Audio file through http get from a secure

  • 0

I am trying to get an Audio file through http get from a secure restful service, I have successfully receive and parse text XML service but a bit confused that how to do with Audio file.

code to call the secure restful service with XML response

String callWebService(String serviceURL) {
        // http get client
        HttpClient client = getClient();
        HttpGet getRequest = new HttpGet();

        try {
            // construct a URI object
            getRequest.setURI(new URI(serviceURL));
        } catch (URISyntaxException e) {
            Log.e("URISyntaxException", e.toString());
        }

        // buffer reader to read the response
        BufferedReader in = null;
        // the service response
        HttpResponse response = null;
        try {
            // execute the request
            response = client.execute(getRequest);
        } catch (ClientProtocolException e) {
            Log.e("ClientProtocolException", e.toString());
        } catch (IOException e) {
            Log.e("IO exception", e.toString());
        }
        try {
            in = new BufferedReader(new InputStreamReader(response.getEntity()
                    .getContent()));
        } catch (IllegalStateException e) {
            Log.e("IllegalStateException", e.toString());
        } catch (IOException e) {
            Log.e("IO exception", e.toString());
        }
        StringBuffer buff = new StringBuffer("");
        String line = "";
        try {
            while ((line = in.readLine()) != null) {
                buff.append(line);
            }
        } catch (IOException e) {
            Log.e("IO exception", e.toString());
            return e.getMessage();
        }

        try {
            in.close();
        } catch (IOException e) {
            Log.e("IO exception", e.toString());
        }
        // response, need to be parsed
        return buff.toString();
    }
  • 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-07T00:25:44+00:00Added an answer on June 7, 2026 at 12:25 am

    may this one help you..

    public static void downloadFile(String fileURL, String fileName) {
        try {
            // fileURL=fileURL.replaceAll("amp;", "");
            Log.e(fileURL, fileName);
            String RootDir = Environment.getExternalStorageDirectory()
                    .toString();
    
            File RootFile = new File(RootDir);
            new File(RootDir + Commons.dataPath).mkdirs();
            File file = new File(RootFile + Commons.dataPath + fileName);
            if (file.exists()) {
    
                file.delete();
            }
            file.createNewFile();
    
            URL u = new URL(fileURL);
            HttpURLConnection c = (HttpURLConnection) u.openConnection();
            c.setRequestMethod("GET");
            c.setDoOutput(true);
            c.connect();
            FileOutputStream f = new FileOutputStream(new File(
                    "mnt/sdcard"+Commons.dataPath + fileName));
            InputStream in = c.getInputStream();
            byte[] buffer = new byte[1024];
            int len1 = 0;
    
            while ((len1 = in.read(buffer)) > 0) {
                f.write(buffer, 0, len1);
            }
            f.close();
    
        } catch (Exception e) {
    
            e.printStackTrace();
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get all the audio from my phone to go through my
So, I'm trying to use the Python Wave module to get an audio file
I'm trying to get an audio file to autoplay in Safari on an iPad.
I'm trying to write an .m file to extract energy features from an audio
I'm trying to stream an audio file from a server protected by session-based authentication,
I am trying to output audio samples, and do so with cswavplay from http://www.codeproject.com/KB/audio-video/cswavplay.aspx
I am trying to send audio file from one computer to other using socket
I'm trying to get the duration for an audio file in c#. I got
I'm trying to save some audio data to a WAV file -- I have
I'm trying to get an audio file playing in my iOS app. This is

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.