Hi all,
    I was trying to consume webservices from Axis1.4. Returned object is a bean 
which contain a simple String array. This webservice was consumed perfectly by 
Axis client.
    but threw exception when use CXF client(Generated by wsdl2java.bat). I 
worked on this for a whole day, and couldn't find any clue. Can anybody help me 
out??
   Below is the exception and WSDL file:
   org.apache.cxf.interceptor.Fault: 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.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:791)
    at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:632)
    at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:154)
    at 
org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:201)
    at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
    at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:736)
    at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1563)
    at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1448)
    at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1356)
    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
    at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:614)
    at 
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
    at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:484)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:414)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:317)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:269)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
    at $Proxy23.getArrayBean(Unknown Source)
    at 
cxf.client.helloarray.HelloWorldArray_GetArray_Client.main(HelloWorldArray_GetArray_Client.java:50)
Caused by: javax.xml.bind.UnmarshalException
 - with linked exception:
[javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"name"). 
Expected elements are 
<{http://localhost:8080/AxisTest/services/GetArray}name>,<{http://localhost:8080/AxisTest/services/GetArray}strArray>]
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:425)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:362)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:339)
    at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:768)
    ... 20 more
Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"", 
local:"name"). Expected elements are 
<{http://localhost:8080/AxisTest/services/GetArray}name>,<{http://localhost:8080/AxisTest/services/GetArray}strArray>
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:642)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:254)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:249)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:116)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.childElement(Loader.java:101)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.childElement(StructureLoader.java:243)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:478)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:459)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:242)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:176)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
    ... 22 more
Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"", 
local:"name"). Expected elements are 
<{http://localhost:8080/AxisTest/services/GetArray}name>,<{http://localhost:8080/AxisTest/services/GetArray}strArray>
    ... 33 more
Exception in thread "main" 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:50)
Caused by: javax.xml.bind.UnmarshalException
 - with linked exception:
[javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"name"). 
Expected elements are 
<{http://localhost:8080/AxisTest/services/GetArray}name>,<{http://localhost:8080/AxisTest/services/GetArray}strArray>]
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:425)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:362)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:339)
    at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:768)
    at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:632)
    at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:154)
    at 
org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:201)
    at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
    at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:736)
    at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1563)
    at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1448)
    at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1356)
    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
    at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:614)
    at 
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
    at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:484)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:414)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:317)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:269)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
    ... 2 more
Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"", 
local:"name"). Expected elements are 
<{http://localhost:8080/AxisTest/services/GetArray}name>,<{http://localhost:8080/AxisTest/services/GetArray}strArray>
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:642)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:254)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:249)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:116)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.childElement(Loader.java:101)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.childElement(StructureLoader.java:243)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:478)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:459)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:242)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:176)
    at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
    ... 22 more
Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"", 
local:"name"). Expected elements are 
<{http://localhost:8080/AxisTest/services/GetArray}name>,<{http://localhost:8080/AxisTest/services/GetArray}strArray>
    ... 33 more

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions 
targetNamespace="http://localhost:8080/AxisTest/services/GetArray"; 
xmlns:apachesoap="http://xml.apache.org/xml-soap"; 
xmlns:impl="http://localhost:8080/AxisTest/services/GetArray"; 
xmlns:intf="http://localhost:8080/AxisTest/services/GetArray"; 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
<!--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"; 
xmlns="http://www.w3.org/2001/XMLSchema";>
   <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>

Reply via email to