Hi,
It looks like you just change the WSDL, and didn't use the wsdl2java to
generate the new SEI.
Can you updated the generated SEI and try again ?
On Tue Dec 20 01:59:49 2011, will mad wrote:
Hi,
I have written a simple route that regularly send a soap message using cxf :
from("timer:test?period=20000&delay=5000").to("bean:systemManagerBean?method=getDevicesSimple");
Here is the operation in my systemManagerBean calling the cxf endpoint :
public void getDevicesSimple() {
Exchange senderExchange = new DefaultExchange(context,
ExchangePattern.InOut);
List<String> params = new ArrayList<String>();
params.add("a");
senderExchange.getIn().setBody(params);
senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAME,
"GetDevices");
Exchange responseExchange =
producerTemplate.send("cxf:bean:cxfDeviceRegistryWsEndpoint?synchronous=true",
senderExchange);
MessageContentsList messageContentsList =
(MessageContentsList)responseExchange.getOut().getBody();
logger.debug("resp1 : " + messageContentsList.get(2));
logger.debug("resp2 : " + messageContentsList.get(3));
}
I have a weird issue occurring when my wsdl specifies that there are 2
elements in the response. If I specify that there is only one element in
the response, everything works perfectly. But if I add a second element in
the response, I encounter the following exception :
2011-12-19 17:50:27,281 | WARN | org.apache.cxf.common.logging.LogUtils
| Interceptor for {
http://wgcorp.net/DeviceRegistrySimple}DeviceRegistryPortTypeService#{http://wgcorp.net/DeviceRegistrySimple}GetDeviceshas
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:63)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:733)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2286)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2156)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2010)
at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at
org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:661)
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516)
at
org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:129)
at
org.apache.camel.impl.SynchronousDelegateProducer.process(SynchronousDelegateProducer.java:61)
at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:99)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:91)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)
at
org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:63)
at
org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:333)
at
org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:303)
at
org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:208)
at
org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:303)
at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:138)
at
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:105)
at
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:91)
at
net.eads.itcore.esb.pelco.SystemManagerBean.getDevicesSimple(SystemManagerBean.java:204)
...
Here is the wsdl (with two elements in the response "GetDevicesResponse"
resp1and resp2) :
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="DeviceRegistrySimple"
targetNamespace="http://wgcorp.net/DeviceRegistrySimple" xmlns:soap="
http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="
http://wgcorp.net/DeviceRegistrySimple">
<!-- Types -->
<wsdl:types>
<xsd:schema targetNamespace="http://wgcorp.net/DeviceRegistrySimple"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="GetDevices">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="arg1" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetDevicesResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="resp1" type="xsd:string" />
<xsd:element name="resp2" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<!-- Messages -->
<wsdl:message name="GetDevices">
<wsdl:part name="parameters" element="tns:GetDevices" />
</wsdl:message>
<wsdl:message name="GetDevicesResponse">
<wsdl:part name="parameters" element="tns:GetDevicesResponse" />
</wsdl:message>
<!-- Ports -->
<wsdl:portType name="DeviceRegistryPortType">
<wsdl:operation name="GetDevices">
<wsdl:input message="tns:GetDevices" />
<wsdl:output message="tns:GetDevicesResponse" />
</wsdl:operation>
</wsdl:portType>
<!-- Bindings -->
<wsdl:binding name="DeviceRegistry" type="tns:DeviceRegistryPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetDevices">
<soap:operation
soapAction="urn:#GetDevices" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="DeviceRegistry">
<wsdl:port name="DeviceRegistry" binding="tns:DeviceRegistry">
<soap:address location="http://localhost:60001/control/DeviceRegistry-1" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
The cxf endpoint definition in camel context :
<cxf:cxfEndpoint id="cxfDeviceRegistryWsEndpoint"
address="http://localhost:60001/control/DeviceRegistrySimple"
serviceClass="net.wgcorp.deviceregistrysimple.DeviceRegistryPortType">
<cxf:properties>
<entry key="dataFormat" value="POJO" />
</cxf:properties>
</cxf:cxfEndpoint>
The message is correctly sent to the distant endpoint, I receive the
response but I have this WARN in my logs... Moreover the result message
contents list is empty at index 0 and 1. Any ideas on what is wrong ?
Thanks for your help.
William
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang