JAX-WS 2.1.7 with SOAPMessageHandler consumes the attachment
I'm using JAX-WS RI 2.1.7 (server and client side) to implement some fileUpload like web service.
The uploaded file must go straight to a database storage (no temporary file can be created). Together with the attachment, some "parameters" are passed in the SOAP body.
The SOAP message is signed (using WS-Security) but not the attachment (a digest of the attachment is present in the SOAP body to ensure integrity). The content type of the attachment is application/octet-stream. On the WS endpoint I have access to a DataHandler that I use to stream the file content to some DatabaseOutputStream.
The issue is that when I activate the SOAPMessageHandler (using the @HandlerChain annotation on the WebService endpoint) to implement my WS-Security algorithm, the whole attachment get's consumed (fully loaded in memory or written to the disk based on the values of the @StreamingAttachment annotation). As I can't afford having temporary files created (for confidentiality reason) the following values are specified : parseEagerly = false, memoryThreshold = -1L . Even with an empty implementation in the SOAPMessageHandler (not even doing a SOAPMessageContext.getMessage() call) I have the same behavior.
Is there a way to have access to the SOAP message in a handler without consuming the attachment ? My attachment can be up to 250 mb and this cause OutOfMemory errors in the server (increasing the max heap size is not acceptable since there can be multiple transfers in parallel)
Thanks a lot for your answers.