Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-1624

RPCMessageReceiver serializes java.util.Date not as "xs:dateTime"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • nightly
    • None
    • rpc
    • None
    • Windows XP

    Description

      I don't know whether this is a bug or a feature.

      When I return an object with two fields, one of type java.util.Calendar and the other of type java.util.Date I get the following SOAP response:

      <soapenv:Envelope xmlns:soapenv = "http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Header/>
      <soapenv:Body>
      <ns:getDatesResponse xmlns:ns = "http://service.mydomain.com/xsd">
      <ns:return>
      <calendar xmlns = "http://data.mydomain.com/xsd">2006-11-06T21:03:39.781Z</calendar>
      <date xmlns = "http://data.mydomain.com/xsd">Mon Nov 06 22:03:39 CET 2006</date>
      </ns:return>
      </ns:getDatesResponse>
      </soapenv:Body>
      </soapenv:Envelope>

      Both fields are of type "xs:dateTime" in the generated WSDL (see attachment).

      The generated ADB client, however, can for obvious reasons not parse the "Mon Nov 06 22:03:39 CET 2006" and generates the following exception:

      Exception in thread "main" java.lang.RuntimeException: java.lang.NumberFormatException
      at com.mydomain.service.DatingServiceStub.fromOM(DatingServiceStub.java:1677)
      at com.mydomain.service.DatingServiceStub.getDates(DatingServiceStub.java:160)
      at test.DateTest.main(DateTest.java:14)
      Caused by: java.lang.NumberFormatException
      at org.apache.axis2.databinding.utils.ConverterUtil.convertToDateTime(ConverterUtil.java:515)
      at com.mydomain.service.DatingServiceStub$MyDate$Factory.parse(DatingServiceStub.java:1049)
      at com.mydomain.service.DatingServiceStub$GetDatesResponse$Factory.parse(DatingServiceStub.java:1371)
      at com.mydomain.service.DatingServiceStub.fromOM(DatingServiceStub.java:1664)
      ... 2 more

      Why does RPCMessageReceiver treat java.util.Date differently than java.util.Calendar?

      I am trying to move severeal Axis 1.3 services to Axis2 and in Axis 1.3 a java.util.Date was serializes as "xs:dateTime".

      Regards, Robert

      Attachments

        1. src.zip
          1 kB
          Robert Staerk
        2. DatingService.wsdl
          5 kB
          Robert Staerk
        3. DatingService.aar
          2 kB
          Robert Staerk

        Issue Links

          Activity

            People

              deepal Deepal Jayasinghe
              staerk Robert Staerk
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: