You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by glawi <ma...@yahoo.fr> on 2011/07/08 17:15:31 UTC

Re: java.lang.IndexOutOfBoundsException in cxf producer

Hi all, I got the same issue whith Camel 2.7.2.

Here's my WSDL : 
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://www.service-now.com"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:tns="http://www.service-now.com/frostbyte"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sncns="http://www.service-now.com"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <wsdl:types>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
targetNamespace="http://www.service-now.com/frostbyte"><xsd:element
name="execute"><xsd:complexType><xsd:sequence><xsd:element maxOccurs="1"
minOccurs="0" name="number"
type="xsd:string"/></xsd:sequence></xsd:complexType></xsd:element><xsd:element
name="executeResponse"><xsd:complexType><xsd:sequence><xsd:element
maxOccurs="1" minOccurs="0" name="ci" type="xsd:string"/><xsd:element
maxOccurs="1" minOccurs="0" name="caller"
type="xsd:string"/></xsd:sequence></xsd:complexType></xsd:element></xsd:schema>
  </wsdl:types>
  <wsdl:message name="executeSoapIn">
    <wsdl:part name="frostbyte" element="tns:execute"/>
  </wsdl:message>
  <wsdl:message name="executeSoapOut">
    <wsdl:part name="frostbyte" element="tns:executeResponse"/>
  </wsdl:message>
  <wsdl:portType name="ServiceNowSoap">
    <wsdl:operation name="execute">
      <wsdl:input message="sncns:executeSoapIn"/>
      <wsdl:output message="sncns:executeSoapOut"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="ServiceNowSoap" type="sncns:ServiceNowSoap">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="execute">
      <soap:operation
soapAction="http://www.service-now.com/frostbyte/execute" style="document"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="ServiceNow_frostbyte">
    <wsdl:port name="ServiceNowSoap" binding="sncns:ServiceNowSoap">
      <soap:address
location="https://arkeadeva.service-now.com/frostbyte.do?SOAP"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>


And now my route : 
from("direct:frostbyte").bean(FrostByteTransformer.class,
"applyTreatmentOnInputData")
	
.enrich("cxf:bean:snowEndpointFrostbyte?wrapped=true&defaultOperationName=execute&loggingFeatureEnabled=true")
	
		.bean(FrostByteTransformer.class, "applyTreatmentOnOutputData");


The endPoind definition : 
<cxf:cxfEndpoint id="snowEndpointFrostbyte"
address="${snow.baseUrl}/frostbyte.do?SOAP" wsdlURL="wsdl/frostbyte.wsdl" 
		serviceClass="com.servicenow.ws.client.generated.frostbyte.ServiceNowSoap"
endpointName="s:ServiceNowSoap" serviceName="s:ServiceNow_frostbyte" 
		xmlns:s="http://www.service-now.com" />


The FrostByteTransformer.applyTreatmentOnInputData code : 
final Incident incident = (Incident)
inputData.getIn().getBody(Map.class).get(DataMapFields.INCIDENT);

		 final Execute request = new Execute();
		 request.setNumber(incident.getNumber());
		 final List<String> req = new ArrayList<String>();
		 req.add(incident.getNumber());
		 inputData.getOut().setBody(incident.getNumber());


And finally the stackTrace following the SOAP request and response traces : 
ATTENTION: Interceptor for
{http://www.service-now.com}ServiceNow_frostbyte#{http://www.service-now.com}execute
has thrown exception, unwinding now
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
	at java.util.ArrayList.RangeCheck(ArrayList.java:547)
	at java.util.ArrayList.get(ArrayList.java:322)
	at
org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(HolderInInterceptor.java:67)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)
	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:737)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2335)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:2198)
	at
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$2.run(AutomaticWorkQueueImpl.java:253)
...




Have you any idea ? 

--
View this message in context: http://camel.465427.n5.nabble.com/java-lang-IndexOutOfBoundsException-in-cxf-producer-tp468541p4565102.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: java.lang.IndexOutOfBoundsException in cxf producer

Posted by glawi <ma...@yahoo.fr>.
Thanks for the answer, but I got this illumination this night  :) I missed
the Holders.

Ok, everything works now. Thanks again.

--
View this message in context: http://camel.465427.n5.nabble.com/java-lang-IndexOutOfBoundsException-in-cxf-producer-tp468541p4575140.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: java.lang.IndexOutOfBoundsException in cxf producer

Posted by Willem Jiang <wi...@gmail.com>.
On 7/8/11 11:15 PM, glawi wrote:
> Hi all, I got the same issue whith Camel 2.7.2.

>
>
> The FrostByteTransformer.applyTreatmentOnInputData code :
> final Incident incident = (Incident)
> inputData.getIn().getBody(Map.class).get(DataMapFields.INCIDENT);
>
> 		 final Execute request = new Execute();
> 		 request.setNumber(incident.getNumber());
> 		 final List<String>  req = new ArrayList<String>();
> 		 req.add(incident.getNumber());
> 		 inputData.getOut().setBody(incident.getNumber());
You need to set the request parameter with a Holder.
I just checked the SEI which is generated from your WSDL, the parameter 
list should be set like this
Object[] parameter = new Object[3];
parameter[0] = incident.getNumber();
parameter[1] = new Holder<String>();
parameter[2] = new Holder<String>();
MessageContentsList request = new MessageContextsList(paramter);
inputData.getOut().getBody(request);

You should get the response from parameter[1] and parameter[2].
>
>
> And finally the stackTrace following the SOAP request and response traces :
> ATTENTION: Interceptor for
> {http://www.service-now.com}ServiceNow_frostbyte#{http://www.service-now.com}execute
> has thrown exception, unwinding now
> java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
> 	at java.util.ArrayList.RangeCheck(ArrayList.java:547)
> 	at java.util.ArrayList.get(ArrayList.java:322)
> 	at
> org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(HolderInInterceptor.java:67)
> 	at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)
> 	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:737)
> 	at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2335)
> 	at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:2198)
> 	at
> org.apache.cxf.workqueue.AutomaticWorkQueueImpl$2.run(AutomaticWorkQueueImpl.java:253)
> ...
>
>
>
>
> Have you any idea ?
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/java-lang-IndexOutOfBoundsException-in-cxf-producer-tp468541p4565102.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang