aspose file tools*
The moose likes Web Services and the fly likes How to post file by webservice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to post file by webservice" Watch "How to post file by webservice" New topic

How to post file by webservice

swenling wen
Ranch Hand

Joined: Jun 07, 2006
Posts: 32
I will post a file by webservice,my development enviroment uses cxf and tomcat.
I read file into byte stream,and client receive it.
Does that have some exception when post byte stream by webservice?
can you give me code?
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12682
The simplest way to provide a file through a web service is to use the REST style with GET. The CXF toolkit docs say they support REST style but I have not tried it.

Are there particular requirements for using SOAP and WSDL in your application? If not the Jersey open source RESTful implementation will be simpler.


Java Resources at
karthikeyan Chockalingam
Ranch Hand

Joined: Sep 06, 2003
Posts: 259

The above link explains how to upload a file using CXF and Tomcat. If client needs to receive the attachment [download], please follow the reverse logic. In case you need further assistance please let me know.
[ June 09, 2008: Message edited by: karthi keyan ]

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: How to post file by webservice
Similar Threads
CXF Problem
pdf load status
Post to an URL using HttpURLConnection
Axis Base64.encode Out of Memory Error.
is method return type needs to implement the Serializable interface in webservice?