Dowload a file using HTTPS

I am trying to write some code that'll connect with an external server (via the proxy) and ownload a file using the HTTPS protocol.
All I can find is how to get a stream to such file and read it line for line.
Many thanks.

Forget the lines. Just read and write bytes.
int count;
byte[] buffer = new byte[8192]; // or more
while ((count = in.read(buffer)) > -1)
  out.write(buffer, 0, count);
out.close();
in.close();

Similar Messages

  • Webservice to grab the files using HTTP

    Hi,
    Can any one guide me how to create a webservice to grab a file using HTTP? The scenario is that a webservice call should contact a system through HTTP to grab the file.
    Please help.
    Thanks,
    Sunny
    Edited by: Sunny1890 on Apr 2, 2009 7:00 PM

    Use classes available in java.net package.

  • How to download video files using http urls through OSB

    Hi all,
    I am working on a requirement where I need to download the video using http url of that video through OSB. Is it possible to convert the video files hosted in a server into base64 code using OSB ? Kindly help me on this.
    Thanks
    Edited by: 887737 on Jul 25, 2012 3:26 AM

    Hi,
    I believe you can get the video file using file transport and then convert it into base64 using a java call out...
    This may help...
    https://blogs.oracle.com/ateamsoab2b/entry/an_example_of_how_to
    Cheers,
    Vlad

  • Flat file using http

    Hi guys,
    I work on pi 7.1.
    A flat file is sent to me using http request. I want to read the file, remove the heading and then convert it to xml and pass it into R3 through an idoc.
    Do anybody have any suggestions.
    Thanks
    Ugur

    Thank you for the link. I have been working using that document. But the problem is that i  can not trigger a break point in that code, so i can not manipulate with that data coming in.
    Have you any input to how to invoke the debugger.
    Regards

  • Download a file using http proxy - java

    Hi,
    I'm trying to download a pic using http proxy.
    Means - I have the url to the pic, I want to get it by my proxy
    Can anyone help me with that? any link, example etc...?
    Thanks

    This works:String server="hostname";
    String user="user ID";
    String passwd="password";
    try {
         sun.net.ftp.FtpClient client = new sun.net.ftp.FtpClient();
         client.openServer(server);
         client.login(user, passwd);
         client.cd("..");
         sun.net.TelnetInputStream in = client.get("File to be downloaded");
         BufferedReader br = new BufferedReader(new InputStreamReader(in));
         String s;
         while((s=br.readLine()) != null) {
              System.out.println(s);
         in.close();
             br.close();
    catch (IOException ioe) {
         ioe.printStackTrace();
    }Mark

  • File upload using http-post in OSB

    Hi All,
    I am trying to upload a file using http-post method in OSB.
    I have created a business service pointing to the service url, with http method post.
    and calling this business service from a proxy service.
    I am unable to send the form data to the business service.
    Please let me know how to send trhe form data and the file information.
    The error given by Business Service is-
    the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is text/plain
    Thanks in advance.
    Seemant
    Edited by: Seemant Srivastava on Oct 12, 2010 12:28 PM

    Hi Anuj,
    A sample HTML form code for. Post HTTP service-
    <html>
    <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>CSV File</title>
    </head>
    <body>
    <form method="post" enctype="multipart/form-data" action="http://xyz/UploadFile">
    <table>
    <tr>
    <td> Feed id </td>
    <td><input type="text" name="refid" value="" size="20"></td>
    </tr>
    <tr>
    <td> Username (optional)</td>
    <td><input type="text" name="username" value="" size="20"></td>
    </tr>
    <tr>
    <td> Password (optional)</td>
    <td><input type="password" name="password" value="" size="20"></td>
    </tr>
    <tr><td> Select CSV File </td>
    <td> <input type="file" name="upload" value="" width="30"/></td>
    </tr>
    <tr>
    <td><input type="submit" name="Ok" value="Go"> <input type="reset" name="reset" value="Reset"> </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    I need to pass all these information to OSB business service.

  • Recording video/audio files using Flash Meida Server through rmtp, and allow users to access the recorded files through http.

    As titled, what is the way to record video/audio files using Flash Meida Server through rmtp, and allow users to access the recorded files through http?
    What I am trying to do, is to record a user's microphone's input and save it to the server. Afterwards, I would like other users to be able to access the recorded files and mainuplating the audio data, by computeSpectrum(), to do some visualization of the audio. As I know computeSpectrum() cannot work on streaming files, so I think I need to access the recorded files using http instead of rmtp. Is that true?
    How can I redirect the http request to the files I was recorded into my applications/appName folder? Or I need to somehow moved the recorded files to the /webroot folder?
    Thanks!

    I probably have asked a stupid question.
    My recorded streams are still saved in the applications/appName/streams folder.
    And I redirect the www.mydomain.com/streams to point to the applications/appName/streams folder.
    And the rmtp recorded streams are abled to connect through http now.

  • Post file over Http

    Hi All,
    I am working on EDI scenario in which EDI partner has given one HTTP site address with user name and password.  I will have to put EDI file at that site using http/soap adaptors at receiver end.
    One thing I know for sure that I can not use File channel at reveiver side as there is no FTP available. Now Can anybody please let me know how to generate file using http connection?
    I have absolutely no idea how to use http and soap adaptors so if any links to the blogs will also be helpful.
    Thanks in advance,
    Atul

    Hi Aamir,
    Thanks for your reply.
    I just want to generate a file at given location. I am confused what is the difference in data sent as a payload or as attachment?
    As you said in case of attachement we need to use some modules(Looks bit difficult ) I would perhaps like to generate file by using Payload .
    Can you suggest some blog for the same?
    Thanks and Regards,
    Atul

  • INDD files on Http or FTP

    We have a NAS storage device that hosts files using http protocol.
    When we upload .indd files to the server, and try to download them using http or ftp protocols, the browser freaks out and doesnt know what to do with them.
    Is this a known issue?  Should we be zipping them up and uploading them?
    Any help is appreciated.

    Nevermind, Http is the problem, not FTP.

  • Dowload file using ftp in bash script

    Hi! I'm runnig a bash script in solaris i want within the script to dowload file using ftp
    How can i do it?
    Tanks a lot

    hello,evgchech
    please try this way:
    1. In the bash script, try following command:
    ftp -n < ftpcmdfile2 in the ftpcmdfile (which is a file),coding the interactive commands of FTP such as:
    user anonymous  [email protected]
              cd /var/sun/download
              bi
              mget *.*
              bye
         try it and good luck!
    Wang Yu
    Developer Technical Support
    Sun Microsystems
    http://sun.com/developers/support

  • Hi, I am using HP11 and iPlanet web server. When trying to upload files over HTTP using FORM ENCTYPE="multipart/form-data" that are bigger than a few Kilobytes i get a 408 error. (client timeout).

    Hi, I am using HP11 and iPlanet web server. When trying to upload files over HTTP using FORM ENCTYPE="multipart/form-data" that are bigger than a few Kilobytes i get a 408 error. (client timeout). It is as if the server has decided that the client has timed out during the file upload. The default setting is 30 seconds for AcceptTimeout in the magnus.conf file. This should be ample to get the file across, even increasing this to 2 minutes just produces the same error after 2 minutes. Any help appreciated. Apologies if this is not the correct forum for this, I couldn't see one for iPlanet and Web, many thanks, Kieran.

    Hi,
    You didnt mention which version of IWS. follow these steps.
    (1)Goto Web Server Administration Server, select the server you want to manage.
    (2)Select Preference >> Perfomance Tuning.
    (3)set HTTP Persistent Connection Timeout to your choice (eg 180 sec for three minutes)
    (4) Apply changes and restart the server.
    *Setting the timeout to a lower value, however, may    prevent the transfer of large files as timeout does not refer to the time that the connection has been idle. For example, if you are using a 2400 baud modem, and the request timeout is set to 180 seconds, then the maximum file size that can be transferred before   the connection is closed is 432000 bits (2400 multiplied by 180)
    Regards
    T.Raghulan
    [email protected]

  • Accessing BSP File Download using HTTPS URL

    Hi,
    I'm struggling with a problem of downloading a file from a https url. I wrote a BSP App for downloading a file from a unix server.. It works fine when I use a http URL with port 8080 and does not work when I use https.!!
    Example:
    https://comms.gmsanet.co.za/supplier [ download does not work ]
    http://comms.gmsanet.co.za:8080/supplier [ download works ]
    When I try to download using https.. it does not pull the file name and path
    see code  below and suggest me if anything to be chnaged.
    In the Form Initialization method:
    event handler fr data retrieval
    DATA: i_file        type string,
          s_fields      TYPE tihttpnvp,
          s_fields_line TYPE ihttpnvp,
          multipart_form type ref to if_http_entity,
          file_upload    type xstring,
          lv_backend     type string,
          success        type string,
          entity         type ref to if_http_entity,
          file           type xstring,
          content_type   type string,
          content_filename type string,
          content_length type string,
          content_disposition type string,
          num_multiparts type i,
          i              type i value 1,
          doEcho         type string value 'X',
          value          type string,
          filename       type ZFILETAB-fileinfo,
          ext1           type string,
          ext2           type string,
          dsn            type string,
          bptype         like sy-uname,
          itab           TYPE ZFILETAB,
          itab_line      TYPE ZFILETABLINE,
          file_ext       type ZFILETABLINE,
          fileinfo       type c,
          zcount         type i.
        filename = '/NewMessge.doc'.
        content_filename = filename.
    Check the extension and assign the content type
        split filename at '.' into ext1 ext2.
        case ext2.
          when 'zip'.
            content_type = 'application/x-zip-compressed'.
          when 'doc'.
            content_type = 'application/msword'.
          when 'txt'.
            content_type = 'text/plain'.
          when 'ppt' or 'pps'.
            content_type = 'application/vnd.ms-powerpoint'.
          when 'xls' or 'exe'.
            content_type = 'application/octet-stream'.
          when 'gif'.
            content_type = 'image/gif'.
          when 'jpg' or 'jpeg'.
            content_type = 'image/pjpeg'.
          when 'htm' or 'html'.
            content_type = 'text/html'.
        endcase.
        dsn = filename.
        OPEN DATASET dsn FOR INPUT IN BINARY MODE.
        IF sy-subrc NE 0.
          zmessage = 'Error opening file'.
          navigation->set_parameter( name = 'zmessage' value = zmessage ).
          navigation->goto_page( 'downloaderror.htm' ).
          exit.
        ENDIF.
        DO.
          READ DATASET dsn INTO <b>file</b>.
          EXIT.
        ENDDO.
        CLOSE DATASET dsn.
    set response data to be the file content
      runtime->server->response->set_data( <b>file</b> ).
      runtime->server->response->set_header_field(
                                    name  = 'Content-Type'
                                    value = content_type ).
      concatenate 'attachment; filename=' filename into content_disposition.
      runtime->server->response->set_header_field(
                                    name = 'Content-Disposition'
                                    value = content_disposition ).
    set the file size in the response
      content_length = xstrlen( file ).
      runtime->server->response->set_header_field(
                                name  = 'Content-Length'
                                value = content_length ).
      runtime->server->response->delete_header_field(
                                name = 'Cache-Control' ).
      runtime->server->response->delete_header_field(
                                name = 'Expires' ).
      navigation->response_complete( ).
    Thanks
    Ajay

    Hi Brian,
    I have the same problem as Ajay Yeluguri. In http mode I can generate a download of an Excel document but when we use the portal in https it doesn't work.
    When I try to download using https it does not pull the file name and path and when I choose download I have a error message : "Internet Explorer cannot download from ..."
    I've test the point 3.2 "... including file up/download" of the BSP application IT00 and it works fine in http and https mode. My problem is not the upload but the download. And in this application the uploaded document is opened in the Internet Explorer window but I want to generate a Save as... window to download the file.
    Have you an idea what i can do to solve my problem.
    Thanks
    Yann

  • How to use HTTPS to retrieve a set of files from a distant server?

    Hi !
    i am interested in some samples or links showing how is it possible to use HTTPS in a java code in a standalone application ( could be swing based or whatever) that allows an HTTPS connection to a distant server ( specefic file repository) so that downloading some data files could be possible.i am also interested to know what conditions should be available to make such connection possible ( specefic port number? specefic authentication? login? password? and does the Operating system on the distant server interfere with that ? etc...)
    thanks!

    in fact i tried to test a sample code by i got this exception :
    Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
         at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1591)
         at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:187)
         at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:181)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:975)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:123)
         at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
         at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1123)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1107)
         at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:405)
         at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:977)
         at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
         at HTTPSConnector.main(HTTPSConnector.java:30)
    Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
         at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:285)
         at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:191)
         at sun.security.validator.Validator.validate(Validator.java:218)
         at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:126)
         at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:209)
         at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:249)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:954)
         ... 12 more
    Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
         at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:174)
         at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238)
         at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:280)
         ... 18 moreand here si the sample code:
    package foo;
    import java.net.URL;
    import java.io.*;
    import javax.net.ssl.HttpsURLConnection;
    public class Test
    public static void main(String[] args)
    throws Exception
    String httpsURL = "https://your.https.url.here/";
    URL myurl = new URL(httpsURL);
    HttpsURLConnection con = (HttpsURLConnection)myurl.openConnection();
    InputStream ins = con.getInputStream();
    InputStreamReader isr=new InputStreamReader(ins);
    BufferedReader in =new BufferedReader(isr);
    String inputLine;
    while ((inputLine = in.readLine()) != null)
    System.out.println(inputLine);
    in.close();
    }so what this error is due to? and how to fix it ?.
    thanks!

  • Upload http file using applet

    Hello every body,
    I am trying to upload the http file using applet. Can any body give me the hint or example.
    Thanks in advance
    best regards

    any of several libraries are out there that would let you to HTTP File Upload to a web server, assuming the web server has a servlet or other thing to accept the file.
    Of course, where you get the file might be a problem without a signed applet.

  • Pulling files from a webserver using https

    Hi Experts,
    I have a scenario where i have to pull files from an webserver using https protocol to XI and pass it to a folder(no transformation required in the data).
    Also please let me know in detail ,about the parameters of XI and the source webserver i need to have before starting the scenario.
    Can this be acheived without soap?If Soap is the only solution please let me know how to proceed with it.
    Thanks,
    Sudhansu

    its more on the SOAP implementation. SOAP supports attachments and hence they can send the file as part of the attachment
    More - http://www.theserverside.com/tt/articles/article.tss?l=SendingAttachmentsWithSOAP
    Once that is implemented, you can use the option keep attachments in the soap adapter to receive the attachment.

Maybe you are looking for

  • Losing my filters in CS5

    Very strange. Out of nowhere I go to use a filter and they are all gone. Zip, nada, gone. I close photoshop and when I open it they are there again. This has happened 3 or 4 times now. The strangest thing. Has anyone else encountered this or is just

  • Loss of sound and picture sticking

     i have been having a problem with the sound on my samsung tv for the past three months. customer ser vice is of no help...when i can get somebody that actually speaks and understands english, they just tell me to unplug things....wait ten seconds...

  • Swatch scrolling bug?

    Hello there, I've attempted to search the forums but haven't found an answer to this.. Not sure if this issue is a bug (if it's a feature I'd honestly like to disable it but have not found a way to do so), but every time I pick a colour out of a swat

  • BW to BPC Infoprovider load

    While loading the data thru Infoprovider package there is no selection criteria available for loading. I have created package as per BPC document using the process chain../CPMB/LOAD_INFOPROVIDER Has some one seen this...how the selection criteria is

  • Functioning Frontpanel connector on X-Fi Titanium PC

    Hi there! I'm thinking about buying an X-Fi Titanium PCIe. That would be this model http://de.europe.creative.com/products/product.asp?category=&subcategory=208&product=7927 On the picture seems to be a frontpanel connector but there's nothing in the