How to send large files using web service

hello everyone,
I am new to this forum, so please pardon me if I post some silly problem...
I have created one service which sends file when client (jsp) request it. I am using JBOSS as my server. purpose of this application is when client request some fle then service will send this file... and most of the time we need to send only pdfs and ppts...
Problem is, this service sends txt, java files easily of any size but when i tried sending PDF, PPT then i got xml.SAXParseException.......
I thought this error is because of some characters, but how to fix it....
I am working on Linux.
code snippet is:
import java.io.*;
public class MyHelloService
public String file_size (String name)
     String s = new String("");
byte[] sendata1=new byte[100];
     try
          System.out.println("name recived is :::::::::::"+name);
          FileInputStream in=new FileInputStream(name);
          int size=0;
          size=in.available();
          System.out.println("FILE SIZE IS:::::"+size);
          byte[] sendata11=new byte[size];
          i=in.read(sendata11);
          System.out.println(new String(sendata11));
          s=new String(sendata11);
     catch(Exception e)
               System.out.println("EXCEPTION IN JWS:::"+e);
               s=new String("nofilefounderror");
     return s;
pls tell me what am i doing wrong ad how to fix this?
and one more thing can i send byte array from a web service as i tried but couldnt do that... so i am reading everything in a single byte array and then converted to string.....
is it possibel to send file in a chunk?if yes, how to do that?
waiting for the reply..... pls reply as soon as possible....
Rashi

hi,
I am sending file from server to client i.e client will request for a file and service will send it back....... no socket connection is there...I am using JBOSS and apache axis.
pls help me out.....
Rashi

Similar Messages

  • Out of memory when coverting large files using Web service call

    I'm running into an out of memory error on the LiveCycle server when converting a 50 meg Word document with a Web service call.  I've already tried increasing the heap size, but I'm at the limit for the 32 bit JVM on windows.  I could upgrade to a 64 bit JVM, but it would be a pain and I'm trying to avoid it.  I've tried converted the 50 meg document using the LiveCycle admin and it works fine, the issue only occurs when using a web service call.  I have a test client and the memory spikes when it's generating the web service call taking over a gig of memory.  I assume it takes a similar amount of memory on the receiving end which is why LiveCycle is running out of memory.  Does any one have any insight on why passing over a 50 meg file requires so much memory?   Is there anyway around this?
    -Kelly

    Hi,
    You are correct that a complete 64bit environment would solve this. The problem is that you will get the out of memory error when the file is written to memory on the server. You can solve this by creating an interface which stores large files on the server harddisk instead, which allows you to convert as large files as LC can handle without any memory issue.

  • How to browse local file using web dynpro

    hi everyone
    How can I browse local file using Web Dynpro?And read file names into Context or array. I have tried the following code but its not working
    String resourcePath = WDURLGenerator.getResourcePath();
    String depObjResourcePath = WDURLGenerator.getResourcePath(“Test”);
    WDDeployableObjectPart appPart = WDDeployableObject.getPart(“Test”, “TestApp”, WDDeployableObjectPart.APPLICATION);
    help required urgently
    Thanks & Regards
    Jaspreet Kaur

    Reply in
    how to browse local file using web dynpro
    Regards,
    Ashwani Kr Sharma

  • Sending audio files through web service

    Hi,
    How can we send audio (mp3,wmv) files through web services ? i have tried making a byte array of the file and then sending the byte array through the web service, but it give OutOfMemory error. so is there any better and practical way of doing it ?

    Just read catalina.bat and find where $JAVA command is called, for NT it should be "%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% "
    "%_EXECJAVA% is java
    %JAVA_OPTS% and %CATALINA_OPTS% are enviroment parameter for java command. Just added one of them in your case.
    By the way, " i am using a HP PDA on the client side, so i cannot increase the JVM heap size there", you should info. the client, otherwise the client may be get "out of memory".

  • How to download a file via web service in Windows Phone 8.1?

    My project just got 2 part.
    1.Pivot app
    2.Webclient server (provide data for pivot app the view the data)
    My concert that how do i do a download button to download a file via web services in to isolated storage.
    urgent!

    something like this:
    public async System.Threading.Tasks.Task DownloadFile()
    using (var client = new Windows.Web.Http.HttpClient())
    var stream = await client.GetInputStreamAsync(new System.Uri("http://urltomyfile"));
    var file = await ApplicationData.Current.LocalFolder.CreateFileAsync("myfile.txt", CreationCollisionOption.GenerateUniqueName);
    using (var fileStream = await file.OpenAsync(FileAccessMode.ReadWrite))
    IBuffer buffer = new Windows.Storage.Streams.Buffer(1024);
    while ((buffer = await stream.ReadAsync(buffer, buffer.Capacity, InputStreamOptions.None)).Length > 0)
    await fileStream.WriteAsync(buffer);
    await fileStream.FlushAsync();
    how is your webservices offering the file?
    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

  • Urgent! How to create a ebook using web services?

    Hi I would need some help on how to creating a e-book using web services. Sample code would be good for me.
    I had been finding sources for quite sometime but i doesn't seems to be easy to find as compare to andriod.
    Description:
    Windows 8.1 SDK Sliverlight.
    The e-book will on PDF format.
    Once user click e-book icon, i would link to my database to retrieve all the ebook available via web services.
    Then user select the e-book, the content will be again retreive from my database to the users.
    Is there any solution? I need it quite urgent.

    Hi Ding Zheng,
    >>Once user click e-book icon, i would link to my database to retrieve all the ebook available via web services. Then user select the e-book, the content will be again retreive from my database to the users.
    According this approach, I would suggest you make good use of build-in API to render PDF in store app. see more classes in the following namespace.
     http://msdn.microsoft.com/en-us/library/windows/apps/windows.data.pdf.aspx. Using this APIs need PDF file in local storage, so I list the following steps
    for you to try.
    Step 1, Store PDF file in web site folder and save the PDF URL in database.
    Step 2, Use Web service/WCF/REST service to public the PDF to store app.
    Step 3, Store app uses service to get PDF list and then display them.
    Step 4, User choose one PDF, get the PDF download URL from service and then download it on local storage. Store app support download file form server, you can use BackgroundDownloader. See from
    http://msdn.microsoft.com/en-us/library/windows/apps/windows.networking.backgroundtransfer.backgrounddownloader.aspx.
    Step 5, Use PDF APIs to render it in store app. See code sample
    https://code.msdn.microsoft.com/windowsapps/PDF-viewer-sample-85a4bb30#content.
    Please feel free to let me know if you have any concerns.
    Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate
    the survey.

  • How to call DOC file using web.show_documents

    Hi friends ,
    If I use the built-ins web.show_documents for open the *.doc file
    I am getting the following error
    ORA-06550: line 5, column 2:
    PLS-00201: identifier 'README.DOC' must be declared
    ORA-06550: line 5, column 2:
    PL/SQL: Statement ignored
    DAD name: WebDB
    PROCEDURE : readme.doc
    URL : http://132.148.160.3:80/WebDB/readme.doc?
    PARAMETERS :
    ===========
    ENVIRONMENT:
    ============
    SERVER_PORT=80
    SERVER_SOFTWARE=Oracle WebDb Listener 2.1
    SERVER_NAME=132.148.160.3
    GATEWAY_INTERFACE=CGI/1.1
    SERVER_PROTOCOL=HTTP/1.0
    REMOTE_HOST=132.148.160.251
    REMOTE_ADDR=132.148.160.251
    REQUEST_METHOD=GET
    QUERY_STRING=
    SCRIPT_NAME=
    PATH_INFO=/WebDB/readme.doc
    HTTP_ACCEPT=*/*
    HTTP_ACCEPT_LANGUAGE=en-us
    HTTP_ACCEPT_ENCODING=gzip, deflate
    HTTP_USER_AGENT=Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)
    HTTP_HOST=132.148.160.3
    HTTP_CONNECTION=Keep-Alive
    Please advice How to call Doc file in web.
    Thanx
    null

    The syntax to execute web.show_document:
    web.show_document('http://server_ip_or_server_name/virtual_path/filename.doc')
    The virtual path has been defined in Apache (if you run on web with Apache) or has been defined in Internet Inoformation Server (if you are runing with Internet Information Server.)
    null

  • How to send a file using IOCP?

    When using blocking sockets, all I had to do to send a file was to open the file and loop through it and send it in chunks.
    But I find sending a file using overlapped sockets to be more challenging. I can think of the following approach to do it:
    I open the file and send the first chunk, and I keep track of the file handle and file position.
    Now when I get a completion packet indicating that some data has been sent, I check to see if the socket is currently in the process of sending a file, and if it is, I retrieve the file handle and file position and send the next chunk.
    I repeat step 2 until I reach the last chunk in the file, and then I close the file.
    Is this approach correct?
    Note: I don't want to use TransmitFile().

    This approach is more or less correct, but maybe you'd have to know some more things.
    If send "returns" it means, that you buffer has been copied into the internal buffer of system or the network interface card or whatever... in general it means, that you can free/reuse the buffer you have used, but it doesn't mean, that the data
    has been delivered (it does not even mean it has been sent already).
    That's why I'm normally using some flow-control (messages from the receiver) to verify the real data flow.
    The next point is, that you shouldn't read from the file only after you got the ok that the first chunk has been sent. You should read the data as soon as possible so that you can respond much quicker to a send-complete-message. I'd recommend to send using
    multiple buffers.
    Rudolf

  • How to send Excel File using file adapter

    Hello,
    Please could you tell how i can send an excel file using the file adpater?
    thank you.

    Hi hassiba ,
    If u want to doc on creating modules just check the wonderful document.
    How To Create Modules for the J2EE Adapter Engine at service.sap.com. It will clear all the basics of creating Adapter module.
    https://websmp102.sap-ag.de/~form/sapnet?_SHORTKEY=01100035870000582377&
    Thanks ,
    sekhar.

  • How to send A file using Webservice?

    I heard about webservice when I read through XML...
    It a bit like XML cannot show off it strength without webservice...lol
    What is webservice? What library should I use to send a file from server to client using webservice?
    Webservice is Quite new for me. Any expert here can direct me to the tutorial link that can teach me how to use webservice?
    I go through some code :
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://namespaces.cafeconleche.org/xmljava/ch2/"
    xmlns="http://namespaces.cafeconleche.org/xmljava/ch2/"
    elementFormDefault="qualified">What is xmlns? Is webservice can run it at localhost? My house don't have internet. :(
    Thank....

    to learn webservice..you can try these samples...
    http://www.csd.abdn.ac.uk/~bscharla/teaching/CS5302/practicals/practical8.shtml

  • How to Expire Large Files using File Server Resource Manager

    Is there a way to expire Large Files over 2GB that have not been accessed in 2 years.
    I see under the File expiration options that I can expire files that have not been Created, Modified, or Accessed for a certain amount of time.
    Thanks,
    Eddie

    Hi Eddie,
    FSRM can help report large files and also can help move old files to a folder, but I did not found a way to combine them in a single process.
    Instead how about using Robocopy?
    You can run robocopy /min:xxx /minlad:xxx <source> <target>.
    /MIN:n :: MINimum file size - exclude files smaller than n bytes.
    /MINLAD:n :: MINimum Last Access Date - exclude files used since n.
    (If n < 1900 then n = n days, else n = YYYYMMDD date).
    Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • How to send a file using RMI

    hello,,
    I do one program using RMI that shoud transfer a file.. I compiles and no errors .while i am trying to execute this program i found some exception .
    rmiUnmarshalling exception and writeAborted Exception.
    ////Server.java
    import java.rmi.*;
    import java.rmi.server.*;
    import java.io.*;
    public class Server extends UnicastRemoteObject implements serverInterface
         private InputStream in;
         String filename;     
         public Server(String filename) throws RemoteException
              this.filename = filename;          
         public InputStream send() throws RemoteException
              try
                   in = new FileInputStream(filename);
                   int c;
                   while((c = in.read()) != -1)
                        System.out.println((char)c);
              catch(Exception ex)
                   System.out.println("Exception in impl : "+ex);
              return in;
         public static void main(String arg[])
              try
                   Naming.rebind("Server" , new Server("E:\\muthukumar\\RMI\\files\\interinter.java"));
                   System.out.println("Server is ready");
              catch(Exception e)
                   System.out.println("Exception in server : "+e);
    /// serverInterface.java
    import java.rmi.*;
    import java.io.*;
    public interface serverInterface extends Remote
         public InputStream send() throws RemoteException;
    ///Client.java
    import java.rmi.*;
    import java.rmi.server.*;
    import java.io.*;
    class Client
         public static void main(String arg[])
              try
                   serverInterface inter= (serverInterface)Naming.lookup("//localhost/Server");
                   InputStream in = inter.send();
                   int c;     
                   while((c = in.read()) != -1)
                        System.out.println((char)c);
              catch(Exception e)
                   System.out.println("Exception in client : "+e);
    please help me...
    thanks in advance..
    regards,
    Muthukumar

    If you know the file is too large to send as one chunk, then call different methods where you have a method to start saving the file then a method that saves chunks at a time and then a close when you're done. Otherwise, you could probably open a socket stream and have a reader on the client side and a writer on the server side.
    There are probably better ways to transfer files for sure. RMI is Remote Method Invocation similar to a Windows RPC (Remote Procedure Call) so that you can run some code on one machine from another. Streams and sockets are probably better for transfer. Another way you could do it is to use RMI to start up a socket listener like, but not limited to, FTP and then send the file through that API and then you could use RMI to stop the listener when you're done so it is only available when you need it. Even easier is to just have an FTP server running and transfer the file with the API. You can even use FTPS and you don't have to bother with the encryption to protect the data over the net.

  • How to send (larger files) for 'Shared Review'?

    We are unable to get PDF files above 5.5MB to successfully 'Send for Shared Review' to a WebDav server (using Acrobat Pro 9.3.0 on OSX 10.5.8).
    The 'save' process fails at the final stage & the PDF is not uploaded to the server.  Files below that size can be sent for Shared Review without any problems.  Have tested this on different WebDav servers & domains - and with various PDF files.
    Has anyone been able to get PDF files above 5/6MB to successfully 'Send for Shared Review' to a WebDave server???
    Is there a file size limit for individual PDF files for 'Shared Review' using a WebDav server???
    Thanks for your help!!!

    Try creating a review without sending the file and then send the link in a seperate email.
    I used the "Do not send email invitation, just save localy" option and didn't add any reviewers in the wizard. Afterwards I sent a email with a link to the file to all reviewers and it worked.

  • How to send TDMS file using TCP/IP

    Hi,
    I'm working with a cRIO-9025, chassis cRIO-9118 and NI 9239 module.
    I've done an acquisition (voltage) where data is in 1D Wfm SGL. I've saved this data using a TDMS file, but now I want to send this file to an other computer (in this case mine) because the file is stored in the target. To do that I've implemented this example:
    http://zone.ni.com/devzone/cda/epd/p/id/2842#0requirements
    The problem is that the tdms file is created but it hasn't any data. I attach the image of the program. The program is done in other project (not which I use to make acq) to make it easy and then implement it when it works.
    *The name file in the client is not used because I had a conflict with path.
    What I'm looking for is make an acquisition of 10 minutes every 30 minutes and then send this data to an other computer (or others). I'm not sure if it's the best way, maybe is better to send data at the same time as the acquisition is being done, but my theacher told me that is easier if I send the file when acquisition has finished. To make acq I use FPGA and RT.
    I would appreciate your help. Thanks!!
    Solved!
    Go to Solution.

    I believe the FTP VIs are built into LabVIEW 2011SP1 - I have the VI present, but I could have installed the internet toolkit (don't know).
    Look in the following location:   Function Palette -> Connectivity -> Internet -> FTP
    You're really looking for the VI named, "FTP Get File.vi".  What this VI does is contacts an FTP server and requests a file from it.  If your files are on the target, and you know the filename that will be created (such as files created in a sequence) you can request the file from the target and have them copied to the local machine (Windows).  RT cannot "push" files to the Windows side unless you have an FTP server (like FileZilla Server) running on the Windows host.
    It's a very simple one-VI solution.  You specify host (the IP Address of the target you're pulling files from), the remote path for the file (for instance if the file is located in c:\ni-rt\data\myfile.zip then that's what you put as the remote path of the file), the local path for the file (where you want the file copied to, along with the name of the file, such as c:\mydir\myfile.zip), the username to log into the FTP server with (default is 'anonymous') and the password to use (default is an empty string).  The importan thing to note is whether to use a binary transfer or not - if the file is a text file, no binary transfer needed; if the file is a binary file then you get better results using a binary transfer - I prefer to always use binary transfers, as non-binary transfers actually "interpret" and "convert" text information in the files.
    -Danny

  • How to deploy flex2 application using web service to server

    Hi all.
    I have created flex2 application in that i am calling
    webservice, when i deployed this application to server the buttons
    which calls webservice is not working it is showing error, i even
    uploaded crossdomain.xml to server,
    please tell me how to deploy to server.
    thanks in advance
    regards
    Avanthika

    I have had the same or similar problem, in my case with
    ColdFusion projects. I have uploaded several sample projects to my
    shared hosting web server; all the projects that do not use a
    server run fine, buit I have never been able to make the CF
    projects run. I have posted about this two or three times, but
    nobody ever answered.
    Maybe our question was too stupid to deserve an answer from
    busy people. I never thought of this, but today I got an email from
    my Hosting provider. Quoting part of that message:
    “We will be performing a ColdFusion upgrade to CFMX
    7.02 on the
    server where your account(s), timo, mochica, is/are hosted.
    We have
    scheduled the upgrade to take place between 3:00 AM EDT and
    6:00 AM
    EDT on Saturday, August 5th, 2006.
    We do not anticipate more than 15 minutes of downtime once
    the
    maintenance begins .....”
    Also, I found that the projects that do run require all those
    files that are generated when FB builds the project, so I have been
    uploading the entire output folder (usually, but not always,
    ‘bin’).
    I’m hoping I won’t have any more problems after
    Saturday.
    Peace,
    Carlos

Maybe you are looking for