1 Reply Latest reply on Apr 4, 2008 9:03 AM by Gerald Quintana

    Date, Time and DateTime

    Gerald Quintana Newbie

      Hello,

      I applied the wsconsume tool from JBoss 4.2.2 successfully on a WSDL. But when I deploy my WS implementation in JBoss, I get the following errors:

      2008-04-04 11:35:02,490 ERROR [org.jboss.ws.metadata.wsdl.xmlschema.JBossXSErrorHandler] JBossWS_datex2.eu_schema_1_0_1_048914.xsd[domain:http://www.w3.org/TR/xml-schema-1]::[key=cos-st-restricts.1.1]::Message=cos-st-restricts.1.1: The type 'DateTime' is atomic, so its {base type definition}, 'xs:anySimpleType', must be an atomic simple type definition or a built-in primitive datatype.
      2008-04-04 11:35:02,493 ERROR [org.jboss.ws.metadata.wsdl.xmlschema.JBossXSErrorHandler] JBossWS_datex2.eu_schema_1_0_1_048914.xsd[domain:http://www.w3.org/TR/xml-schema-1]::[key=cos-st-restricts.1.1]::Message=cos-st-restricts.1.1: The type 'Time' is atomic, so its {base type definition}, 'xs:anySimpleType', must be an atomic simple type definition or a built-in primitive datatype.
      2008-04-04 11:35:02,497 ERROR [org.jboss.ws.metadata.wsdl.xmlschema.JBossXSErrorHandler] JBossWS_datex2.eu_schema_1_0_1_048914.xsd[domain:http://www.w3.org/TR/xml-schema-1]::[key=cos-st-restricts.1.1]::Message=cos-st-restricts.1.1: The type 'Date' is atomic, so its {base type definition}, 'xs:anySimpleType', must be an atomic simple type definition or a built-in primitive datatype.

      I don't understand what this error message says, but when I call the WS, I get the following error :
      2008-04-04 11:44:52,143 ERROR [org.jboss.wsf.stack.jbws.RequestHandlerImpl] Cannot close output stream


      The Date/Time/DateTime type are defined like this:
      <xs:complexType name="Date">
       <xs:simpleContent>
       <xs:extension base="xs:date" />
       </xs:simpleContent>
       </xs:complexType>
       <xs:complexType name="DateTime">
       <xs:simpleContent>
       <xs:extension base="xs:dateTime" />
       </xs:simpleContent>
       </xs:complexType>
       <xs:complexType name="Time">
       <xs:simpleContent>
       <xs:extension base="xs:time" />
       </xs:simpleContent>
       </xs:complexType>
      


      In the WS impl, to instanciate the DateTime, I wrote:
      DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar));


      Could someone tell me where I am wrong?

        • 1. Re: Date, Time and DateTime
          Gerald Quintana Newbie

          JBoss WS has a problem the XMLGregorianCalendar, when it generates back the WSDL from Java objects, I get xsd:anySimpleType instead of xsd:dateTime.

          I found a workaround (maybe not the best solution), I customized the JAXB binding to avoid the XMLGregorianCalendar:

          <?xml version="1.0" encoding="utf-8"?>
          <bindings
           xmlns="http://java.sun.com/xml/ns/jaxb"
           xmlns:xsd="http://www.w3.org/2001/XMLSchema"
           version="2.0">
           <globalBindings>
           <javaType name="java.util.Calendar" xmlType="xsd:dateTime"
           parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
           printMethod="javax.xml.bind.DatatypeConverter.printDateTime"/>
           <javaType name="java.util.Calendar" xmlType="xsd:date"
           parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
           printMethod="javax.xml.bind.DatatypeConverter.printDate"/>
           <javaType name="java.util.Calendar" xmlType="xsd:time"
           parseMethod="javax.xml.bind.DatatypeConverter.parseTime"
           printMethod="javax.xml.bind.DatatypeConverter.printTime"/>
           </globalBindings>
          </binding>
          

          With this, I get Calendar instead of an XMLGregorianCalendar.

          However I still have the "Cannot close output stream" error from the RequestHandlerImpl. This is not related to the date/time problem.