JAX-WS CXF empty XOP multipart attachments with file size > ~210kb

1k Views Asked by At

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.Threshold and CachedOutputStream.MaxSize
  • Use different versions of apache-cxf (3.2.1 or 3.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.

  1. happy case: document is loaded into CachedOutputStream and available after the for-loop.

  2. 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();

1

There are 1 best solutions below

0
Łukasz On

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.