cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctoestreich <>
Subject RE: CXF as Client - Response Attachment - HolderInInterceptor IndexOutOfBoundsException
Date Fri, 16 Mar 2012 15:06:26 GMT
I tried generating wsdl2java with -exsh true and false.  Neither had any
effect on the wsdl, client or problem.  Here is what I saw in the
HolderInInterceptor.  The problem could very well be upstream. 

The block of code that loops over the parts below fails on the line
holder.value = inObjects.get(part) due to the get delegating to using
part.index.  The index in part is "real" and not an array index.  With the
object in part having a .index of 3 and inObjects having 3 elements it would
try and get inObjects[3], which fails and throws the IOB.

for (MessagePartInfo part : parts) {
                if (part.getIndex() != 0 && part.getTypeClass() != null) {
                    Holder holder = (Holder)outHolders.get(part.getIndex() -
                    //adding the check allows this to continue on
                    //but it still kaks in the actual HolderInInterceptor
                    if (holder != null) {
                        holder.value = inObjects.get(part); //fails here
                        inObjects.put(part, holder);

there are 2 objects in the parts variable, but their indexes are 2 and 3. 
The outHolders has 3 items and correctly uses the part.getIndex() - 1 as
there is no get(3) only get(2). 

On the other hand the call to holder.value = inObjects.get(part); is 

 public Object get(MessagePartInfo key) {
        Object o = super.get(key.getIndex());
        return o == REMOVED_MARKER ? null : o;

which incorrectly uses the getIndex and there is no [3] element in

I am not sure where else that call is used, but I bet it is pretty common. 
It seems like we have to stick another null object into the inObjects
somehow or the check has to be added to the HolderInInterceptor for bounds:

if (holder != null && part.getIndex() < inObjects.size()) {
                        holder.value = inObjects.get(part);
                        inObjects.put(part, holder);

or the get has to correctly use part.index-1.  

It looks like you are in code that I haven't had a chance to look at
(BindingOperationInfo, etc).  

There is a demo project at with
the child project soapClient being the grails project and the other 4 are
soap servers.  Kyle setup a nice scenario for testing.  You can run the
start.bat to launch 4 servers on 4 different ports and then fire up the
grails project with 'grails run-app' (it is 1.3.7) and go to the client
controller and attempt to invoke all 4 services.  You can also view the
WSDLs there if perhaps they are missing something to indicate the attachment

Thanks - Christian

View this message in context:
Sent from the cxf-user mailing list archive at

View raw message