0

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

Community
  • 1
  • 1
jofroe
  • 431
  • 1
  • 5
  • 14
  • did you ever find a solution for this ? I'm currently stuck with the same problem. Small attachments work fine, larger ones are just missing from the request, although cid is generated and placed inline. – Jimmy Selgen Nielsen Jul 06 '18 at 12:18
  • Using jax-ws metro instead of cxf would solve the issue. But I have to use cxf .. so I'm still stuck with the problem. Unfortunately, I did not have time to create a standalone app to prove the issue for a proper bug report. – jofroe Jul 18 '18 at 09:20
  • I found a workaround for something similar lately. https://stackoverflow.com/questions/51216192/spring-boot-apache-cxf-3-2-5-with-mtom-sends-empty-attachment/51327860#51327860 – Jimmy Selgen Nielsen Jul 18 '18 at 13:51

1 Answers1

0

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.