• Post Reply Bookmark Topic Watch Topic
  • New Topic

Return a java file object in a jax-ws built web service response

 
Greg Triant
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

The question is more or less the subject:

Is it possible to Return a java file object in a jax-ws built web service response?
Would "anyType" or "base64Binary" element types work for this?
I am asking because here: http://docs.oracle.com/javaee/6/tutorial/doc/bnazc.html
there is no direct reference to returning file objects in a jax-ws built web service.
If it is relevant in any way, the files in question are pdf files.

Thank you for your time,
Greg
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lets get the terms clear:

When you say Java file object - I think Java java.io.File object - "an abstract representation of file and directory pathnames" - is that what you really want to move around?

-or-

Do you mean the contents of a file - a stream of bytes representing some data type - sounds like SAAJ to me - see wikipedia article on SOAP with attachments

Bill
 
Greg Triant
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer is to use a base64bunary element, and store the file in its binary format in there:



Client side, just get the response in a byte array and use a FileOutputStream to save it.



 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!