You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Glen Daniels <gd...@macromedia.com> on 2002/03/05 16:48:15 UTC

RE: date vs dateTime (was: cvs commit: xml-axis/java/src/org/apac he/axis/encoding DefaultTypeMappingImpl.java)

I got one word for you, Russell.  Can you guess what it is? :)

Yup, METADATA!

Many-to-one mappings are fine, as long as you have enough information to know what you need to do.  On the incoming side, we can feel free to accept any XML type which we know how to coerce to the appropriate Java type (or we could also be stricter about this depending on configuration).  On the outgoing side, we serialize to whatever the default mapping of that type is unless we've got some metadata which tells us otherwise.  For instance, if we had an OperationDesc which noted a returnType of "xsd:datTime", the logic that serializes the return value from the java method should have access to that and do the right thing (this doesn't work yet, but should).  Note also that you can remap particular default types in your service-specific typemapping, so you can easily make Date map to xsd:dateTime for your service (this works now).

--Glen

> -----Original Message-----
> From: Russell Butek [mailto:butek@us.ibm.com]
> Sent: Tuesday, March 05, 2002 10:23 AM
> To: axis-dev@xml.apache.org
> Subject: Re: date vs dateTime (was: cvs commit:
> xml-axis/java/src/org/apache/axis/encoding 
> DefaultTypeMappingImpl.java)
> 
> 
> The only way to fix this is to have a different Java class for date vs
> dateTime.  Do we really want to roll our own DateTime class?
> 
> I don't know whether we want to fix it.  I just want us all 
> to be aware
> that we WILL have users run into this issue and that we WILL 
> have to admit
> that it's broken, and unlikely to be fixed, unless someone 
> wants to create
> a special class.
> 
> This problem will exist all over the place, not just here.  We don't
> support xsd:Name, xsd:ID, xsd:NMTOKEN, etc.  All of these 
> would probably
> map to java.lang.String since they're all derived from 
> xsd:string.  But
> that would break roundtripping unless we create a new class 
> for each of
> these XML types.  Ditto for xsd:integer derived types like
> nonPositiveInteger, nonNegativeInteger, etc.
> 
> I'd prefer that this were fixed in one place (like the WSDL 
> and/or JAX-RPC
> specs) rather than haphazardly in our implementation.  The 
> specs should not
> allow many-to-one mappings.
> 
> Russell Butek
> butek@us.ibm.com
> 
> 
> Davanum Srinivas <di...@yahoo.com> on 03/05/2002 09:12:01 AM
> 
> Please respond to axis-dev@xml.apache.org
> 
> To:    axis-dev@xml.apache.org
> cc:
> Subject:    Re: date vs dateTime (was:  cvs commit:
>        xml-axis/java/src/org/apache/axis/encoding
>        DefaultTypeMappingImpl.java)
> 
> 
> 
> Russell,
> 
> How do i fix it? Any pointers? I ran "all-tests" before 
> checking the code
> in.
> 
> Thanks,
> dims
> 
> --- Russell Butek <bu...@us.ibm.com> wrote:
> > WARNING!!  WARNING!!
> >
> > You've just broken WSDL->Java->WSDL roundtripping!
> >
> > WSDL date -> Java Date -> WSDL dateTime.
> >
> > Last week at the interop meetings we've discovered that we 
> really need
> > WSDL->Java->WSDL roundtripping for the round III group D 
> tests.  You've
> > introduced a case where a group D scenario won't work.
> >
> > I'm not saying we shouldn't support date (breaking round 
> tripping isn't
> as
> > bad as not working at all), but we MUST be VERY aware of 
> the hole we're
> > digging for ourselves.
> >
> > Russell Butek
> > butek@us.ibm.com
> > ---------------------- Forwarded by Russell Butek/Austin/IBM on
> 03/05/2002
> > 08:26 AM ---------------------------
> >
> >
> >
> >
> >
> > dims@apache.org on 03/05/2002 08:19:57 AM
> >
> > Please respond to axis-dev@xml.apache.org
> >
> > To:    xml-axis-cvs@apache.org
> > cc:
> >
> > Subject:    cvs commit: xml-axis/java/src/org/apache/axis/encoding
> >        DefaultTypeMappingImpl.java
> >
> >
> >
> >
> > dims        02/03/05 06:19:57
> >
> >   Modified:    java/src/org/apache/axis Constants.java
> >                java/src/org/apache/axis/encoding
> >                         DefaultTypeMappingImpl.java
> >   Log:
> >   adding support for 
> "http://www.w3.org/2001/XMLSchema:date". "date" is a
> >   perfectly valid XML Schema data type and .NET and other 
> WS frameworks
> >   handle it. Also see
> >   http://www.w3.org/2001/XMLSchema.xsd.
> >
> >   Revision  Changes    Path
> >   1.55      +1 -0      
> xml-axis/java/src/org/apache/axis/Constants.java
> >
> >   Index: Constants.java
> >   
> ===================================================================
> >   RCS file: 
> /home/cvs/xml-axis/java/src/org/apache/axis/Constants.java,v
> >   retrieving revision 1.54
> >   retrieving revision 1.55
> >   diff -u -r1.54 -r1.55
> >   --- Constants.java    28 Feb 2002 18:47:21 -0000    1.54
> >   +++ Constants.java    5 Mar 2002 14:19:57 -0000     1.55
> >   @@ -442,6 +442,7 @@
> >        public static final QName SOAP_VECTOR = new QName
> >        ("http://xml.apache.org/xml-soap", "Vector");
> >
> >        public static       QName XSD_DATE = new
> >   QName(Constants.URI_CURRENT_SCHEMA_XSD, "dateTime");
> >   +    public static       QName XSD_DATE1 = new
> >   QName(Constants.URI_CURRENT_SCHEMA_XSD, "date");
> >        public static       QName XSD_DATE2= new
> >        QName(Constants.URI_1999_SCHEMA_XSD,    "timeInstant");
> >        public static       QName XSD_DATE3= new
> >        QName(Constants.URI_2000_SCHEMA_XSD,    "timeInstant");
> >
> >
> >
> >
> >   1.11      +7 -1
> >   
> xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java
> >
> >   Index: DefaultTypeMappingImpl.java
> >   
> ===================================================================
> >   RCS file:
> >
> /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DefaultTy
> peMappingImpl.java,v
> 
> >
> >   retrieving revision 1.10
> >   retrieving revision 1.11
> >   diff -u -r1.10 -r1.11
> >   --- DefaultTypeMappingImpl.java   12 Feb 2002 16:50:20 
> -0000    1.10
> >   +++ DefaultTypeMappingImpl.java   5 Mar 2002 14:19:57 
> -0000     1.11
> >   @@ -264,7 +264,13 @@
> >                       new 
> DateDeserializerFactory(java.util.Date.class,
> >                                                   
> Constants.XSD_DATE3),
> >                       true);
> >   -        myRegister(Constants.XSD_DATE,       
> java.util.Date.class,
> >   +        myRegister(Constants.XSD_DATE1,       
> java.util.Date.class,
> >   +                   new 
> DateSerializerFactory(java.util.Date.class,
> >   +                                             
> Constants.XSD_DATE1),
> >   +                   new 
> DateDeserializerFactory(java.util.Date.class,
> >   +                                               
> Constants.XSD_DATE1),
> >   +                   true);
> >   +        myRegister(Constants.XSD_DATE,       
> java.util.Date.class,
> >                       new 
> DateSerializerFactory(java.util.Date.class,
> >                                                 Constants.XSD_DATE),
> >                       new 
> DateDeserializerFactory(java.util.Date.class,
> >
> >
> >
> >
> >
> 
> 
> =====
> Davanum Srinivas - http://xml.apache.org/~dims/
> 
> __________________________________________________
> Do You Yahoo!?
> Try FREE Yahoo! Mail - the world's greatest free email!
> http://mail.yahoo.com/
> 
>