How to make a JAX-WS service method return a file attachment

Hi,

I would like to have a web service method that takes an id parameter, finds the single result from a DB and loads blob data into a SAAJ attachment before the method exits. If there are no results or multiple results, I will throw an exception. The return type of the method will be an object that contains other useful information loaded from the db record about the attached file.

I've done some reading about using SAAJ to add an attachment provided you have access to the SOAPMessage object. It seems that I must create a SOAPHandler to get access to the SOAPMessage. The problem with that is the SOAPHandler doesn't know which blob to load from the database into an attachment. The search method has already executed, and returned an object containing useful information about the file. Is the handler supposed to read the raw XML from the SOAPMessage's body to find the data it needs to query the database a second time?

If anyone has a better approach to this problem, I'm open to suggestions.

Thanks,

Ryan

[1060 byte] By [rdelaplantea] at [2007-11-26 20:58:18]
# 1
This may be helpful to some people: http://blogs.sun.com/milan/entry/using_web_service_to_send
rdelaplantea at 2007-7-10 2:27:43 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...