Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-1119

Request fails with Unmarshalling Error : unexpected element for an element which is part of the WSDL

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 2.0.1
    • Invalid
    • None
    • None
    • @SOAPBinding(style=Style.RPC, use=Use.ENCODED)

    Description

      Right now our in CXF implemented service is throwing the following exception:
      Unmarshalling Error : unexpected element (uri:"", local:"starttime"). Expected elements are (none)

      I checked our code & configuration but I couldnt find a bug in it, right now I think that an exception occurs, when the value should be converted into a Calendar object, but I have no clue, who to solve the problem. I hope someone where has an idea.

      Below you can see the related part of the WSDL, which clearly includes an element starttime.
      WSDL
      <wsdl:message name="autocometSetStart">
      <wsdl:part name="sessionId" type="xsd:string"/>
      <wsdl:part name="id" type="xsd:int"/>
      <wsdl:part name="starttime" type="xsd:dateTime"/>
      <wsdl:part name="status" type="xsd:int"/>
      <wsdl:part name="client" type="xsd:string"/>
      </wsdl:message>

      The service interface includes this element also:
      =================================================
      @WebMethod
      @WebResult(name = "autocometSetStartReturn")
      public AutocometSetStartResult autocometSetStart(
      @WebParam(name = "sessionId") String sessionId,
      @WebParam(name = "id") int id,
      @WebParam(name = "starttime") Calendar starttime,
      @WebParam(name = "status") int status,
      @WebParam(name = "client") String client );

      The soap request send by an other client looks like (and triggers the exception):
      =================================================================================
      Host: 127.0.0.1:9003
      User-Agent: gSOAP/2.7
      Content-Type: text/xml; charset=utf-8
      Content-Length: 679
      Connection: keep-alive
      SOAPAction: "autocometSetStart"

      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cometxsd="http://werk-ii.de/soap/comet/Schema" xmlns:comet="http://werk-ii.de/soap/comet">
      <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <comet:autocometSetStart>
      <sessionId>s6460748655808</sessionId>
      <id>5</id>
      <starttime>2007-10-18T14:46:31+02:00</starttime>
      <status>1002</status>
      <client>HYTEST1</client>
      </comet:autocometSetStart>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      The response caused by the exception:
      =====================================
      HTTP/1.1 500 Internal Server Error
      Server: Apache-Coyote/1.1
      Content-Type: text/xml;charset=utf-8
      Content-Length: 294
      Date: Thu, 18 Oct 2007 12:46:30 GMT
      Connection: close

      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
      <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>Unmarshalling Error : unexpected element (uri:"", local:"starttime"). Expected elements are (none) </faultstring>
      </soap:Fault>
      </soap:Body></soap:Envelope>

      And the stacktrace from the Tomcat log:
      =======================================
      INFO: Interceptor has thrown exception, unwinding now
      org.apache.cxf.interceptor.Fault: Unmarshalling Error : unexpected element (uri:"", local:"starttime
      "). Expected elements are (none)
      at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:368)
      at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:274)
      at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:40)
      at org.apache.cxf.binding.soap.interceptor.RPCInInterceptor.handleMessage(RPCInInterceptor.j
      ava:120)
      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
      at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:7
      3)
      at org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDestination.java:78)

      at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.ja
      va:231)
      at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:139)
      at org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:271)
      at org.apache.cxf.transport.servlet.CXFServlet.doPost(CXFServlet.java:249)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
      ava: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:175)
      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.valves.AccessLogValve.invoke(AccessLogValve.java:563)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.ja
      va:584)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: javax.xml.bind.UnmarshalException

      • with linked exception:
        [javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"starttime"). Expected element s are (none)]
        at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(Unmarshal
        lerImpl.java:395)
        at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.jav
        a:334)
        at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java
        :304)
        at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:354)
        ... 25 more
        Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"starttime"). Expect ed elements are (none)
        at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingCo
        ntext.java:523)
        at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:199)
        at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:194)
        at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:
        71)
        at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElem
        ent(UnmarshallingContext.java:920)
        at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(Unmarshalling
        Context.java:366)
        at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingC
        ontext.java:347)
        at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVis
        itor.java:35)
        at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStrea
        mConnector.java:201)
        at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.j
        ava:135)
        at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.jav
        a:332)
        ... 27 more

      Attachments

        Activity

          People

            Unassigned Unassigned
            andreas.bucksteeg Andreas Bucksteeg
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: