Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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 The Software Craftsman this week in the Agile 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: 12913
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.

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 ]

I agree. Here's the link:
subject: How to post file by webservice