cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wojtek (JIRA)" <>
Subject [jira] Created: (CXF-1697) Problem with converting to Calendar
Date Thu, 10 Jul 2008 13:44:33 GMT
Problem with converting to Calendar

                 Key: CXF-1697
             Project: CXF
          Issue Type: Bug
    Affects Versions: 2.0.4
         Environment: CXF 2.0.4
            Reporter: Wojtek
             Fix For: 2.0.4

'm receiving following error: "Unmarshalling Error: unexpected element (uri:"", local:"from").
Expected elements are (none)". It occurs when xs:dateTime is mapped to java.util.Calendar.

Here is the part of WSDL:

    <xs:element name="getDownloadHistory" type="getDownloadHistory"/>

    <xs:complexType name="getDownloadHistory">
            <xs:element minOccurs="0" name="application" type="xs:string"/>
            <xs:element minOccurs="0" name="id" type="xs:string"/>
            <xs:element minOccurs="0" name="type" type="historyType"/>
            <xs:element minOccurs="0" name="from" type="xs:dateTime"/>
            <xs:element minOccurs="0" name="to" type="xs:dateTime"/>

    <xs:element name="getDownloadHistoryResponse" type="getDownloadHistoryResponse"/>
    <xs:complexType name="getDownloadHistoryResponse">
            <xs:element maxOccurs="unbounded" minOccurs="0" name="return" type="downloadRecord"/>

Here is the service interface:

    List<DownloadRecord> getDownloadHistory(
            @WebParam(name = "application")
            final String applicationID,
            @WebParam(name = "id")
            final String userID,
            @WebParam(name = "type")
            final HistoryType type,
            @WebParam(name = "from")
            final Calendar from,
            @WebParam(name = "to")
            final Calendar to);

I'm using following SOAP binding:

@SOAPBinding(style = SOAPBinding.Style.DOCUMENT,
             use = SOAPBinding.Use.LITERAL,
             parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)

Here is a SOAP request:

<soapenv:Envelope xmlns:soapenv="" xmlns:dow="">

And SOAP response:

<soap:Envelope xmlns:soap="">
         <faultstring>Unmarshalling Error: unexpected element (uri:"", local:"from").
Expected elements are (none)</faultstring>

It seems that everything is correctly configured but I still have the same error.

I've found that in JAXBEncoderDecoder#unmarshall, in case of abstract class (like java.util.Calendar),
is unmarshalled without class by JAXB what causes in result mentioned error: "Unmarshalling
Error: unexpected element (uri:"", local:"from"). Expected elements are (none)".

Here is the "if" statement checking if class is abstract.

            if (clazz == null || (!clazz.isPrimitive() && !clazz.isArray() &&
                && (Modifier.isAbstract(clazz.getModifiers())
                || Modifier.isInterface(clazz.getModifiers())))) {
                unmarshalWithClass = false;

Is it correct "Modifier.isAbstract(clazz.getModifiers())"? Can someone confirm if it is a
bug and real cause of problem? If I remove "Modifier.isAbstract(clazz.getModifiers())" everything
works fine. 

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message