Lets say we have two method parameters which are in the SOAP body and a third which is an attachment. By the time we get to the soap interceptor we'll only have two objects in the list. So we need to append the attachment to the end. The other case is where we have an attachment which is sandwiched between two body parameters. In this case we need to insert the attachment in the list. Hope that helps, - Dan
On 6/18/07, Glen Mazza <[EMAIL PROTECTED]> wrote:
Out of curiosity, why might an attachment have an index greater than the list size? Would that primarily be the result of a programmatic error on the part of the web service/client developer? Thanks, Glen Am Montag, den 18.06.2007, 03:31 +0000 schrieb [EMAIL PROTECTED]: > Author: dandiep > Date: Sun Jun 17 20:31:42 2007 > New Revision: 548190 > > URL: http://svn.apache.org/viewvc?view=rev&rev=548190 > Log: > Make SwaInInterceptor a bit more robust. Any attachment that has an index greater than the list size can simply be appended to the end of the list. This prevents conflicts with the HolderInInterceptor. Attachments which have an index less than the list size can be inserted. > > Modified: > incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAInInterceptor.java > > Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAInInterceptor.java > URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAInInterceptor.java?view=diff&rev=548190&r1=548189&r2=548190 > ============================================================================== > --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAInInterceptor.java (original) > +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAInInterceptor.java Sun Jun 17 20:31:42 2007 > @@ -75,16 +75,6 @@ > boolean found = false; > > int idx = mpi.getMessageInfo().getMessagePartIndex(mpi); > - /*while (idx >= inObjects.size()) { > - inObjects.add(null); > - }*/ > - > - //fix for testSwaWithHeaders of ClientServerSwaTest > - inObjects.add(idx, null); > - > - if (inObjects.get(idx) != null) { > - continue; > - } > > for (Attachment a : message.getAttachments()) { > if (a.getId().startsWith(start)) { > @@ -110,16 +100,24 @@ > o = dh; > } > > - inObjects.set(idx, o); > + // If the current index is greater than the # of objects, > + // just append the attachment to the end > + if (idx >= inObjects.size()) { > + inObjects.add(o); > + } else { > + inObjects.add(idx, o); > + } > found = true; > break; > } > } > > if (!found) { > - > - > - inObjects.add(idx, null); > + if (idx >= inObjects.size()) { > + inObjects.add(null); > + } else { > + inObjects.add(idx, null); > + } > } > } > } > >
-- Dan Diephouse Envoi Solutions http://envoisolutions.com | http://netzooid.com/blog
