2 Replies Latest reply on Dec 10, 2009 9:31 AM by maxfuse

    org.apache.cxf.interceptor.Fault: Index: 1, Size: 1 - CXF client - FUSE 4.1

    maxfuse

      Hi,

      we are using Fuse ESB 4.1.0.2 with Camel 1.6.1.0-fuse and CXF 2.2.2.1-fuse; in one of our bundles we have defined a CXF client with datamode set to POJO, because we need MTOM and that seems to be the only supported way to achieve it (http://camel.apache.org/cxf.html).

       

      Our customer's WSDL (see below) has an implicit header for authentication data (the header is defined in the wsdl:binding section but not in the wsdl:portType).

      We use the maven cxf-codegen-plugin to execute wsdl2java to generate client sources.

       

      The problem arises when - from one of our routes - we generate a message and send it to the cxf client bean; before it even reaches the server we get the following exception and then the exchange is routed to the dead letter queue:

       

      11:52:24,685 | WARN | nerContainer-973 | PhaseInterceptorChain | org.apache.cxf.endpoint.ClientImpl 471 | Interceptor has thrown exception, unwinding now

      org.apache.cxf.interceptor.Fault: Index: 1, Size: 1

      at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:119)

      ...

      Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1

      at java.util.ArrayList.RangeCheck(ArrayList.java:547)

      at java.util.ArrayList.get(ArrayList.java:322)

      at com.intersec.schema.mcms._3.SingleMms_WrapperTypeHelper1.createWrapperObject(Unknown Source)

      at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:103)

      ... 39 more

       

      Of course the com.intersec package has to do with the cxf-generated client code.

       

      Now, I've dug a bit but the only relevant result I could find is a cxf issue with out-of-band headers that was fixed in cxf 2.0.3:

      https://issues.apache.org/jira/browse/CXF-1129

       

      Not sure if what I'm seeing in our route is our error somewhere, a new issue with cxf or a regression, so I've tried with the workaround suggested in the cxf Jira entry (running the wsdl2java with '-exsh true'), unfortunately with no results (same error).

       

      Any pointers anyone?

       

      Relevant parts of our source code:

       

      CXF client definition

       

      ();

            

            

            Header identityHeader = new Header(new QName("com.intersec.schema.mcms._3", "callerIdentity"), identity, new JAXBDataBinding(CallerIdentity.class));

            headers.add(identityHeader);

            x.getOut().setHeader(Header.HEADER_LIST, headers);

            x.getOut().setBody(params);

            x.getOut().setHeader(Client.REQUEST_CONTEXT , requestContext);

            x.getOut().setHeader(CxfConstants.OPERATION_NAME, "singleMms");

            

          }

        })

       

        // web service request

        .to("cxf:bean:" + getCxfEndpointId())

       

      ...

       

      Max

       

      Edited by: maxfuse on Dec 7, 2009 2:09 PM

       

      Edited by: maxfuse on Dec 7, 2009 3:05 PM

        • 1. Re: org.apache.cxf.interceptor.Fault: Index: 1, Size: 1 - CXF client - FUSE 4.1
          maxfuse

          The problem was actually in our implementation in that we were adding the wrong parameter type(s) to the params list.

           

          The document at http://camel.apache.org/cxf.html (paragraph 'How to prepare the message for the camel-cxf endpoint in POJO data format') says:

           

          "First you need to specify the operation name in the message header, then add the method parameters to a list, and initialize the message with this parameter list."

           

          Actually the client expects the sequence of elements that constitutes the wsdl element listed as parameter (in our case not the singleMms element itself, but its contents, unwrapped).

           

          Edited by: maxfuse on Dec 9, 2009 5:04 PM

          • 2. Re: org.apache.cxf.interceptor.Fault: Index: 1, Size: 1 - CXF client - FUSE 4.1
            maxfuse

            For completeness' sake, I'm attaching some additional info from Willem Jiang on servicemix's mailing list:

             

            camel-cxf endpoint producer (Client) supports the wrapped message, you just need to set the wrapped option in the camel-cxf endpoint from url like this :

            cxf://xxxx?wrapped=true

            or in the cxfEndpoint like this

             

             

              <entry key="wrapped" value="true" />

            </cxf:properties>

            </cxf:cxfEndpoint>

             

            By default the wrapped option value is false.