title: Apache CXF 2.2.7 Spring 3 Web Service Unmarshalling Error: unexpected element
body: <p>I have developed a simple web service application using Apache CXF 2.2.7 and Spring 3, deployed onto Tomcat as a WAR file, but I'm getting the following error message:</p>
  
  <blockquote>
    <p>12-Apr-2010 15:56:12 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
    WARNING: Interceptor for {<a href="http://services.aristabi.com/" rel="nofollow noreferrer">http://services.aristabi.com/</a>}ReportingServiceImplService#{<a href="http://services.aristabi.com/" rel="nofollow noreferrer">http://services.aristabi.com/</a>}getNewBusinessVolumeByCreateDate_v2 has thrown exception, unwinding now
    org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element (uri:"<a href="http://services.aristabi.com/" rel="nofollow noreferrer">http://services.aristabi.com/</a>", local:"searchCriteria"). Expected elements are &lt;{}searchCriteria> 
     at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:764)
     at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:623)
     at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:128)
     at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:106)
     at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
     at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
     at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98)
     at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:406)
     at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:178)
     at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
     at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
     at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
     at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
     at java.lang.Thread.run(Thread.java:619)
    Caused by: javax.xml.bind.UnmarshalException
     - with linked exception:
    [javax.xml.bind.UnmarshalException: unexpected element (uri:"<a href="http://services.aristabi.com/" rel="nofollow noreferrer">http://services.aristabi.com/</a>", local:"searchCriteria"). Expected elements are &lt;{}searchCriteria>]
     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:749)
     ... 25 more
    Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"<a href="http://services.aristabi.com/" rel="nofollow noreferrer">http://services.aristabi.com/</a>", local:"searchCriteria"). Expected elements are &lt;{}searchCriteria>
     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:245)
     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)
     ... 27 more
    Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"<a href="http://services.aristabi.com/" rel="nofollow noreferrer">http://services.aristabi.com/</a>", local:"searchCriteria"). Expected elements are &lt;{}searchCriteria>
     ... 38 more</p>
  </blockquote>
  
  <p>This is probably a simple issue, but I can't seem to be able to resolve it. Can anyone point me in the right direction to solve this issue?</p>
  
  <p>Thanks,
  Zahanghir</p>
  
  <p>Btw, this is what my wsdl looks like</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt;&lt;wsdl:definitions name="ReportingServiceImplService" targetNamespace="http://services.aristabi.com/" xmlns:ns1="http://cxf.apache.org/bindings/xformat" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://services.aristabi.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
  &lt;wsdl:types&gt;
  &lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified"   targetNamespace="http://services.aristabi.com/" xmlns:tns="http://services.aristabi.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
  &lt;xs:element name="getNewBusinessVolumeByCreateDate" type="tns:getNewBusinessVolumeByCreateDate" /&gt;
  &lt;xs:element name="getNewBusinessVolumeByCreateDateResponse" type="tns:getNewBusinessVolumeByCreateDateResponse" /&gt;
  &lt;xs:element name="getNewBusinessVolumeByCreateDate_v2" type="tns:getNewBusinessVolumeByCreateDate_v2" /&gt;
  &lt;xs:element name="getNewBusinessVolumeByCreateDate_v2Response" type="tns:getNewBusinessVolumeByCreateDate_v2Response" /&gt;
  &lt;xs:element name="newBusinessLead" type="tns:newBusinessLead" /&gt;
  &lt;xs:element name="quotes" type="tns:quotes" /&gt;
  &lt;xs:element name="searchCriteria" type="tns:searchCriteria" /&gt;
  &lt;xs:complexType name="getNewBusinessVolumeByCreateDate"&gt;
  &lt;xs:sequence&gt;
    &lt;xs:element minOccurs="0" name="agent" type="xs:string" /&gt;
    &lt;xs:element minOccurs="0" name="broker" type="xs:string" /&gt;
    &lt;xs:element minOccurs="0" name="businessUnit" type="xs:string" /&gt;
    &lt;xs:element minOccurs="0" name="fromMonth" type="xs:string" /&gt;
    &lt;xs:element minOccurs="0" name="fromYear" type="xs:string" /&gt;
    &lt;xs:element minOccurs="0" name="region" type="xs:string" /&gt;
    &lt;xs:element minOccurs="0" name="toMonth" type="xs:string" /&gt;
    &lt;xs:element minOccurs="0" name="toYear" type="xs:string" /&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  &lt;xs:complexType name="getNewBusinessVolumeByCreateDateResponse"&gt;
  &lt;xs:sequence&gt;
    &lt;xs:element minOccurs="0" name="return" type="tns:newBusinessLead" /&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  &lt;xs:complexType name="newBusinessLead"&gt;
  &lt;xs:sequence&gt;
    &lt;xs:element maxOccurs="unbounded" minOccurs="0" name="convertedQuotes" nillable="true" type="tns:quotes" /&gt;
    &lt;xs:element maxOccurs="unbounded" minOccurs="0" name="declinedQuotes" nillable="true" type="tns:quotes" /&gt;
    &lt;xs:element maxOccurs="unbounded" minOccurs="0" name="ntuQuotes" nillable="true" type="tns:quotes" /&gt;
    &lt;xs:element maxOccurs="unbounded" minOccurs="0" name="pendingQuotes" nillable="true" type="tns:quotes" /&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  &lt;xs:complexType name="quotes"&gt;
  &lt;xs:sequence&gt;
    &lt;xs:element minOccurs="0" name="month" type="xs:string" /&gt;
    &lt;xs:element name="premium" type="xs:int" /&gt;
    &lt;xs:element minOccurs="0" name="quoteStatus" type="xs:string" /&gt;
    &lt;xs:element name="volume" type="xs:int" /&gt;
    &lt;xs:element minOccurs="0" name="year" type="xs:string" /&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  &lt;xs:complexType name="arrayList"&gt;
  &lt;xs:complexContent&gt;
    &lt;xs:extension base="tns:abstractList"&gt;
      &lt;xs:sequence /&gt;
    &lt;/xs:extension&gt;
  &lt;/xs:complexContent&gt;
  &lt;/xs:complexType&gt;
  &lt;xs:complexType abstract="true" name="abstractList"&gt;
  &lt;xs:complexContent&gt;
    &lt;xs:extension base="tns:abstractCollection"&gt;
      &lt;xs:sequence /&gt;
    &lt;/xs:extension&gt;
  &lt;/xs:complexContent&gt;
  &lt;/xs:complexType&gt;
  &lt;xs:complexType abstract="true" name="abstractCollection"&gt;
  &lt;xs:sequence /&gt;
  &lt;/xs:complexType&gt;
  &lt;xs:complexType name="getNewBusinessVolumeByCreateDate_v2"&gt;
  &lt;xs:sequence&gt;
    &lt;xs:element minOccurs="0" name="searchCriteria" type="tns:searchCriteria" /&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  &lt;xs:complexType name="searchCriteria"&gt;
  &lt;xs:sequence&gt;
    &lt;xs:element minOccurs="0" name="agent" type="xs:string" /&gt;
    &lt;xs:element minOccurs="0" name="broker" type="xs:string" /&gt;
    &lt;xs:element minOccurs="0" name="businessUnit" type="xs:string" /&gt;
    &lt;xs:element minOccurs="0" name="fromMonth" type="xs:string" /&gt;
    &lt;xs:element minOccurs="0" name="fromYear" type="xs:string" /&gt;
    &lt;xs:element minOccurs="0" name="region" type="xs:string" /&gt;
    &lt;xs:element minOccurs="0" name="toMonth" type="xs:string" /&gt;
    &lt;xs:element minOccurs="0" name="toYear" type="xs:string" /&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  &lt;xs:complexType name="getNewBusinessVolumeByCreateDate_v2Response"&gt;
  &lt;xs:sequence&gt;
    &lt;xs:element minOccurs="0" name="return" type="tns:newBusinessLead" /&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  &lt;xs:element name="InvalidUserCredentialsException" type="tns:InvalidUserCredentialsException" /&gt;
  &lt;xs:complexType name="InvalidUserCredentialsException"&gt;
  &lt;xs:sequence /&gt;
  &lt;/xs:complexType&gt;
  &lt;xs:element name="tokenString" nillable="true" type="xs:string" /&gt;
  &lt;/xs:schema&gt;
  &lt;/wsdl:types&gt;
  &lt;wsdl:message name="InvalidUserCredentialsException"&gt;
  &lt;wsdl:part element="tns:InvalidUserCredentialsException" name="InvalidUserCredentialsException"&gt;
  &lt;/wsdl:part&gt;
  &lt;/wsdl:message&gt;
  &lt;wsdl:message name="getNewBusinessVolumeByCreateDateResponse"&gt;
  &lt;wsdl:part element="tns:getNewBusinessVolumeByCreateDateResponse" name="parameters"&gt;
  &lt;/wsdl:part&gt;
  &lt;/wsdl:message&gt;
  &lt;wsdl:message name="getNewBusinessVolumeByCreateDate"&gt;
  &lt;wsdl:part element="tns:getNewBusinessVolumeByCreateDate" name="parameters"&gt;
  &lt;/wsdl:part&gt;
  &lt;wsdl:part element="tns:tokenString" name="tokenString"&gt;
  &lt;/wsdl:part&gt;
  &lt;/wsdl:message&gt;
  &lt;wsdl:message name="getNewBusinessVolumeByCreateDate_v2Response"&gt;
  &lt;wsdl:part element="tns:getNewBusinessVolumeByCreateDate_v2Response" name="parameters"&gt;
  &lt;/wsdl:part&gt;
  &lt;/wsdl:message&gt;
  &lt;wsdl:message name="getNewBusinessVolumeByCreateDate_v2"&gt;
  &lt;wsdl:part element="tns:getNewBusinessVolumeByCreateDate_v2" name="parameters"&gt;
  &lt;/wsdl:part&gt;
  &lt;/wsdl:message&gt;
  &lt;wsdl:portType name="IReportingService"&gt;
  &lt;wsdl:operation name="getNewBusinessVolumeByCreateDate"&gt;
    &lt;wsdl:input message="tns:getNewBusinessVolumeByCreateDate" name="getNewBusinessVolumeByCreateDate"&gt;
  &lt;/wsdl:input&gt;
    &lt;wsdl:output message="tns:getNewBusinessVolumeByCreateDateResponse" name="getNewBusinessVolumeByCreateDateResponse"&gt;
  &lt;/wsdl:output&gt;
  &lt;/wsdl:operation&gt;
  &lt;wsdl:operation name="getNewBusinessVolumeByCreateDate_v2"&gt;
    &lt;wsdl:input message="tns:getNewBusinessVolumeByCreateDate_v2" name="getNewBusinessVolumeByCreateDate_v2"&gt;
  &lt;/wsdl:input&gt;
    &lt;wsdl:output message="tns:getNewBusinessVolumeByCreateDate_v2Response" name="getNewBusinessVolumeByCreateDate_v2Response"&gt;
  &lt;/wsdl:output&gt;
    &lt;wsdl:fault message="tns:InvalidUserCredentialsException" name="InvalidUserCredentialsException"&gt;
  &lt;/wsdl:fault&gt;
  &lt;/wsdl:operation&gt;
  &lt;/wsdl:portType&gt;
  &lt;wsdl:binding name="ReportingServiceImplServiceSoapBinding" type="tns:IReportingService"&gt;
  &lt;soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /&gt;
  &lt;wsdl:operation name="getNewBusinessVolumeByCreateDate"&gt;
    &lt;soap:operation soapAction="" style="document" /&gt;
    &lt;wsdl:input name="getNewBusinessVolumeByCreateDate"&gt;
      &lt;soap:header message="tns:getNewBusinessVolumeByCreateDate" part="tokenString" use="literal"&gt;
      &lt;/soap:header&gt;
      &lt;soap:body parts="parameters" use="literal" /&gt;
    &lt;/wsdl:input&gt;
    &lt;wsdl:output name="getNewBusinessVolumeByCreateDateResponse"&gt;
      &lt;soap:body use="literal" /&gt;
    &lt;/wsdl:output&gt;
  &lt;/wsdl:operation&gt;
  &lt;wsdl:operation name="getNewBusinessVolumeByCreateDate_v2"&gt;
    &lt;soap:operation soapAction="" style="document" /&gt;
    &lt;wsdl:input name="getNewBusinessVolumeByCreateDate_v2"&gt;
      &lt;soap:body use="literal" /&gt;
    &lt;/wsdl:input&gt;
    &lt;wsdl:output name="getNewBusinessVolumeByCreateDate_v2Response"&gt;
      &lt;soap:body use="literal" /&gt;
    &lt;/wsdl:output&gt;
    &lt;wsdl:fault name="InvalidUserCredentialsException"&gt;
      &lt;soap:fault name="InvalidUserCredentialsException" use="literal" /&gt;
    &lt;/wsdl:fault&gt;
  &lt;/wsdl:operation&gt;
  &lt;/wsdl:binding&gt;
  &lt;wsdl:service name="ReportingServiceImplService"&gt;
  &lt;wsdl:port binding="tns:ReportingServiceImplServiceSoapBinding" name="ReportingServiceImplPort"&gt;
    &lt;soap:address location="http://localhost:8889/AristaInsuranceServices/reportingService" /&gt;
  &lt;/wsdl:port&gt;
  &lt;/wsdl:service&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p>I don't have a XSD. Can you please point out what is wrong with the WSDL?</p>