Thanks Naren. After going through many posts under webservices category, i successfully created the webservice using DataHandler object which appears as byte array in client java program [in wsdl the return type is xs:base64Binary]. But there is a new problem now!
I did this implementation using notepad and used wsgen and wsimport tools available with java 6 sdk. After publishing the webservice using java 6 lightweight sever and when i used the wsimport to generate the classes for client program the datahandler object was represented as byte array. I used FileOutputStream to write byte array to a file with pdf extension, it worked fine download pdf operation worked.
Then i tried the same migrating to web application using eclipse ide, this time the following are the new things i did
created sun-jaxws.xml file
declaring WSServletContextListener in web.xml
using jax-ws libraries [copied some 22 jar files to WEB-INF/lib directory]
Service was successfully published. I used wsimport to generate class files for client program, but this time DataHandler object was represented as DataHandler and not byte array.
While writing the data in object output stream i am getting stream corrupt exception.
I have the following questions
1. Why java return type for the operation changes when the service is published in web application? How to solve streamcorrupt exception?
2. sending attachments using datahandler or byte array [return type is xs:base64Binary]! Is this a recommended/effective approach?
3. is there any restrictions in terms of file size, because the file contents are transferred in soap message? if so what is the maximum file size supported?
4. what is advantage of other approach like using SAAJ, MTOM, Attachment with content id and mime type tags?
5. when i tested this in SOAP UI, after getting the response in the response tab/screen i see the binary data, but in the bottom of screen Attachments are not sensed.i.e SOAP UI is not recognizing the binary attachment data as attachment!