用CXF调用Axis1发布的webservice出错,崩溃中
场景:使用CXF客户端(由wsdl2java生成)来访问axis1生成的webservice。每当webservice返回值的对象里有数组的时候,就出错:
javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: unexpected element (uri:"", local:"name"). Expected elements are <{http://localhost:8080/AxisTest/services/GetArray}name>,<{http://localhost:8080/AxisTest/services/GetArray}strArray>
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146)
at $Proxy23.getArrayBean(Unknown Source)
at cxf.client.helloarray.HelloWorldArray_GetArray_Client.main(HelloWorldArray_GetArray_Client.java:46)
但是该webservice用axis自己生成的客户端访问是没有问题的,并且axis发布的其他webservice(不包含数组格式的数据)用CXF访问也是没有问题。从表面上猜想可能是因为命名空间的问题,但是从wsdl来看似乎又没有问题
wsdl如下:
<wsdl:definitions targetNamespace="http://localhost:8080/AxisTest/services/GetArray">
−
<!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)
-->
−
<wsdl:types>
−
<schema elementFormDefault="qualified" targetNamespace="http://localhost:8080/AxisTest/services/GetArray">
−
<complexType name="ArrayOf_xsd_string">
−
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:string"/>
</sequence>
</complexType>
−
<complexType name="ArrayBean">
−
<sequence>
<element name="name" nillable="true" type="xsd:string"/>
<element name="strArray" nillable="true" type="impl:ArrayOf_xsd_string"/>
</sequence>
</complexType>
<element name="getArrayBeanReturn" type="impl:ArrayBean"/>
</schema>
</wsdl:types>
−
<wsdl:message name="getArrayBeanResponse">
<wsdl:part element="impl:getArrayBeanReturn" name="getArrayBeanReturn"/>
</wsdl:message>
<wsdl:message name="getArrayBeanRequest">
</wsdl:message>
−
<wsdl:portType name="HelloWorldArray">
−
<wsdl:operation name="getArrayBean">
<wsdl:input message="impl:getArrayBeanRequest" name="getArrayBeanRequest"/>
<wsdl:output message="impl:getArrayBeanResponse" name="getArrayBeanResponse"/>
</wsdl:operation>
</wsdl:portType>
−
<wsdl:binding name="GetArraySoapBinding" type="impl:HelloWorldArray">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
−
<wsdl:operation name="getArrayBean">
<wsdlsoap:operation soapAction=""/>
−
<wsdl:input name="getArrayBeanRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
−
<wsdl:output name="getArrayBeanResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
−
<wsdl:service name="HelloWorldArrayService">
−
<wsdl:port binding="impl:GetArraySoapBinding" name="GetArray">
<wsdlsoap:address location="http://localhost:8080/AxisTest/services/GetArray"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>