Java – Upload files to SharePoint from Java/J2EE application

file uploadjakarta-eejavasharepoint

We have a requirement to upload large files (may be up to 200 MB) to SharePoint from a Java/J2EE application.

We know there are out of the box SharePoint web services that allows to upload files to SharePoint. However, our main concern is what happens if concurrent users upload files. For example, we would require to read a 200 MB file for each user on Java server (application server), before invoking SharePoint to send that data. Even if there are 5 concurrent users, the memory consumed would be around 1 GB, and there could be high CPU usage too. Are there any suggestions how to handle the server memory, concurrency of file uploads in this scenario?

I think one option is may be to use technologies like Flash/Flex which does not require another server (Java Application server) in between – however, wondering how this can be achieved in J2EE server?

http://servername/sitename/_vti_bin/copy.asmx

Thanks

Best Answer

ok.. so this is what I understood:

  • You are trying to use Sharepoint Copy Service
  • And this service requires the stream to be base64encoded in the Soap envelope.
  • As the file size is huge your SOAP request size becomes huge and demands more memory

I can think of 2 options:

  1. I dont know much about sharepoint, if it is possible to give location of file to be uploaded than sending bytes, then you can ftp/sftp the file to the sharepoint server and then call a webservice with the location of the file.

  2. In Java instead of using the out of the box api for SOAP messages, write a custom api. When user uploads the file save it as base64 encoded file. And then your custom api will create a soap message and stream it instead of loading everything in memory.

For option 2: try if you can send the file content as a soap attachment. its gets a bit complex if you want to send it as part of the message.

Try it out. I am not sure if works.