I am using jax-ws cxf to load documents from a SOAP interface. I can get the correct document via SoapUI (xop/multipart). Unfortunately, when I try to load the attachment via code, the CachedOutputStream is empty for files greater than ~210kb.
What I tried:
- Activate MTOMFeature for my WebServiceClient
- Play with JVM arguments
CachedOutputStream.ThresholdandCachedOutputStream.MaxSize - Use different versions of apache-cxf (
3.2.1or3.1.14)
When debugging:
PhaseInterceptorChain#doIntercept uses the AttachmentInInterceptor (at currentInterceptor.handleMessage(message);) which loads the attachments with LazyAttachmentCollection and adds it to the message.
happy case: document is loaded into CachedOutputStream and available after the for-loop.
error case (file too big?): document is available directly after currentInterceptor.handleMessage is called, but disappears when the loop has finished
In both of the above cases however, a correct tmp file is saved to my disk (with exactly my document's content). Furthermore, I can load that file in both cases even when the loop has finished with:
((org.apache.cxf.attachment.LazyAttachmentCollection)(message.getAttachments())).loadAll();
I had similar problem with apache-cxf 3.1.6. The issue was that files above 102kB were empty. After some digging it turned turned out to be "attachment-memory-threshold" which u can set in requestContext, for some reason file cache doesnt seem to work.