It's not a secret anymore!
The moose likes Web Services and the fly likes Passing text file in webservice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Passing text file in webservice" Watch "Passing text file in webservice" New topic

Passing text file in webservice

Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
I have to write a webservice which retrieves 20 mb text file from database and send it to client. What is the best way to do it?
Thanks in advance for your repies..

Jake Farley

Joined: Nov 07, 2007
Posts: 2
You can Encode64 the text, is that what you are asking due to the fact that the text file could be XML? Assuming you are using JAX-WS type XML method invocation? There is an encode64(byte[] data) method, check your Java API reference on...

extended by net.landspurg.util.URLFetcher
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
What are your requirements on the client side?

Incorporating bulk text on the order of 20MB in a SOAP response would be incredibly wasteful and slow.

The SOAP with Attachments API for Java (SAAJ) is what you want. A google search for SAAJ will get you started.

I agree. Here's the link:
subject: Passing text file in webservice
It's not a secret anymore!