This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Web Services and the fly likes Return a file (pdf) through a web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Web Services
Bookmark "Return a file (pdf) through a web service" Watch "Return a file (pdf) through a web service" New topic
Author

Return a file (pdf) through a web service

Cory Max
Ranch Hand

Joined: Jul 20, 2005
Posts: 83
Hi Everyone,

I know this may seem like an odd request, but we would like our web service to return a pdf file... Is this possible? Could someone point me in the right direction?

Thanks again gurus.

Cheers,


Cory


There are only 10 types of people in this world... Those who understand binary and those who don't.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42039
    
  64
The more common case is to transfer files from the client to the server, which is described in articles here and here. But the same techniques may be applicable to the reverse case as well.


Ping & DNS - my free Android networking tools app
Ganesh Kolhe
Greenhorn

Joined: Jul 05, 2009
Posts: 2
We have done with passing PDF byte array as String in String[] as return type where in we can pass other parameter from Web service
Please be at the blog
http://google-ecm.blogspot.com/2009/06/how-to-retu...-pdf-file-byte-array-from.html
Lalit Bhatt
Ranch Hand

Joined: Dec 27, 2007
Posts: 69

check MTOM. There is support for same in JAX-WS. If you are in JAX-RPC than use SAAJ api's. It has capability to attach the attachments.


Java-JavaEE Hibernate Spring Software Development Business Process Analysis
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12792
    
    5
We have done with passing PDF byte array as String in String[] as return type


Now THAT is a disaster waiting to happen since byte to String always involves character conversions.

Perhaps you wanted to talk about base64 encoding of a byte[] to a String?

Bill
 
GeeCON Prague 2014
 
subject: Return a file (pdf) through a web service