• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

sending large files through webservice

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the best way to send a large files of size around 200 mb from client to a webservice. sending files from client through webservice to server.
i had written a webservice for this but it gives out of memory exception for files of size around 15mb.
is soap attachments a good solution for this?
can anyone please provide some sample code for this implementation
 
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Best possible way is to avoid using web service to do this, but in case that you have no other choice you can use SOAP attachment. If you are using GlassFish (METRO stack) or other implementation which support MTOM you may use MTOM optimizations which can be used to transfer big files.

hope it helps.
 
Satish Kumar
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Masoud,
i am weblogic as webservice engine. can you please elaborate on MTOM.
if possible can you provide sample code for implementing with SOAP attachment.
 
Masoud Kalali
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which version of Weblogic server you are using?
I think 10+ support JAX-WS and MTOM, so you can use it to optimize your big file transfer. This blog explain MTOM http://blogs.sun.com/milan/entry/using_web_service_to_send
In case that you need to read more about JAX-WS you can take a look at http://metro.dev.java.net this stack used to create weblogic application server web services stack.

You can find many soap attachment sample in bea dev2dev or in google, just try some search patterns and you will find plenty of samples.
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Satish,

What is your ram size and the JVM s of 2 GB max. Please check the ram sizes. I am able to upload the 1 G.B file using Apache Axis + SOAP Attachment + 3 GB RAM. And possible check the configurations of the web logic attachment size limit.
 
Satish Kumar
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am using weblogic 8.1 and dont know whether it supports JAX-WS and MTOM.

pradeep,
can you please give sample code or link to upload webservice with soap attachments
 
pradeep jaladi
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Please find the example in the following Link.

http://www.ibm.com/developerworks/webservices/library/ws-soapatt/


Use DataHandler as a parameter to pass the file.
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Satish Kumar:
i am using weblogic 8.1 and dont know whether it supports JAX-WS and MTOM.



Weblogic 8.1 is an implementation of J2EE 1.3.

Web services (JAX-RPC) did not enter the J2EE specification until 1.4.

JAX-WS is part of the Java EE 5 specification.

So neither JAX-WS or MTOM are supported by Weblogic 8.1.

Attachment support is limited to SOAP attachments which aren't universally supported by all SOAP clients (though Java SOAP clients can use SAAJ).

In Weblogic 8.1 SOAP attachments have to be handled through SOAP Message Handlers:

eDocs Home> BEA WebLogic Server 8.1 Documentation> Programming WebLogic Web Services> Creating SOAP Message Handlers to Intercept the SOAP Message> Programming WebLogic Web Services: Creating SOAP Message Handlers to Intercept the SOAP Message

Given the vintage of the implementation I have my doubts that a 200 MB attachment would be handled properly (I'd expect to see a 10 MB limit) - but you would have to test that.

Large file transfers should really be handled by protocols more suited to the task - like FTP. The web service provider would then handle the creation of temporary FTP identities/privileges/credentials and return the necessary information to the web service consumer.

Alternately the files could be managed through a REST-style storage service (Amazon S3, Introduction to Amazon S3 with Java and REST, ParkPlace).
 
Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic