Thanks for the response, I'm new to SOAP and didn't know where to look next.
SwAInInterceptor is failing because SoapBodyInfo is null. The relevant code is: BindingOperationInfo bop = message.getExchange().getBindingOperationInfo() if (bop.isUnwrapped()) {bop = bop.getWrappedOperation()} boolean client = isRequestor(message) // client == true BindingMessageInfo bmi = client ? bop.getOutput() : bop.getInput() SoapBodyInfo sbi = bmi.getExtensor(SoapBodyInfo.class) sbi is null at this point and a null check stops execution. So messageContentsList is not populated with the attachment as it should be. Using reflection to investigate the BindingMessageInfo object I learn: 1. No delegate is in use. 2. The only extensor available is "SOAPBody ({http://schemas.xmlsoap.org/wsdl/soap/}body): required=null use=literal". 3. Don't know if this is relevant, if I ask the SOAPBody extensor its class I get "$Proxy42" Since no extensor match is found for a SoapBodyInfo class we get a null value returned, so sbi is null. Thoughts? Thanks, Kyle -----Original Message----- From: Daniel Kulp [mailto:dk...@apache.org] Sent: Wednesday, March 14, 2012 1:50 PM To: users@cxf.apache.org Cc: Dickerson, Kyle B. Subject: Re: CXF as Client - Response Attachment - HolderInInterceptor IndexOutOfBoundsException On Wednesday, March 14, 2012 10:09:47 AM Dickerson, Kyle B. wrote: > We've don't believe the problem is the grails plugin. > > At issue is that HolderInInterceptor attempts to populate the holder for > the attachment from MessageContentsList but the attachment isn't part of > that list, it's available via message.getAttachments. > > It would seem logical that there needs to be a piece of code that > processes attachments into the correct type and sticks them into the > MessageContentsList so that the holder will be populated with the correct > object. But this isn't happening. > > Either that or when populating holders, HolderInInterceptor needs to look > for things in the attachment list if it can't find it in the > MessageContentLists. > > Does anyone know why the correct handling of attachments is not occurring? > Is it a code failure that needs to be fixed? The SwAInInterceptor should be doing exactly that and should be running before the HolderInInterceptor. Any chance you can debug into that to see what is happening there? Dan > > Thanks, > Kyle > > -----Original Message----- > From: Dickerson, Kyle B. [mailto:dickers...@llnl.gov] > Sent: Monday, March 12, 2012 3:46 PM > To: users@cxf.apache.org > Subject: CXF as Client - Response Attachment - HolderInInterceptor > IndexOutOfBoundsException > > I'm using Grails with the cxf-client plugin, but I don't know whether the > issue is with the plugin or not. I'm already communicating with the > plugin author, but I'm hoping someone here can shine some light on the > situation. This is for WSDL-first code using wsdl2java to generate the > client classes. > > I'm working with a service that returns some data as an attachment. The > response looks fine and the attachmentInInterceptor seems to work fine > (the attachment is accessible from message.getAttachments()) however, > when HolderInInterceptor runs it seems to be looking for the attachment > in the MessageContentsList and it's not there. I've stuck a custom > Interceptor in just before the HolderInInterceptor runs so that I can > inspect what's going on. > > So what I'm seeing is that the MessageContentsList contains what it should > (I assume) and the attachment is available via message.getAttachments(). > The MessagePartInfo list has an entry for the responseObject which > works fine and the Holder for that is correctly populated. But the > MessagePartInfo list contains an entry for the attachment, it pulls up > the Holder for the attachment, but then there's nothing in > MessageContentsList to populate it with, which is where it throws the > IndexOutOfBoundsException (HolderInInterceptor.java:65). > > Does this suggest there's something wrong with the generated classes? > > I've already built a set of example servers and a client to talk to them > that shows this issue is only occurring when attachments and holders are > used. If I have holders without an attachment there is no issue. I can > get this example to anyone interested. For the example servers I used > the same WSDL to generate the server classes. > > It looks like I can "make it work" by sticking the attachment into the > MessageContentsList before the HolderInInterceptor runs, in which case > the code gets through all the interceptors and back to my code, but then > the thing in my Holder is not the correct type (should be byte[], instead > I'm getting a LoadingByteArrayOutputStream). I assume this is > altogether a bad idea regardless. > > Thanks, > Kyle -- Daniel Kulp dk...@apache.org - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com