axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dinh Minh Quan <...@elca.ch>
Subject dateTime type dose not work in Axis Beta 3
Date Thu, 11 Jul 2002 08:35:13 GMT
Hello,

I tried to get the Axis beta 3, and run it. It is better than beta 2 and
very great, but I found a little problem with 'dateTime' type, it raised the
exception:

Bad types (class java.util.Calendar -> class java.util.Date).

My  xml request belows:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:si="http://soapinterop.org/xsd"
  xmlns:intf="http://pcqdm:8080/demoaxisleafsoapleaf/services/leafsoapleaf">
<SOAP-ENV:Body>
<intf:printDate>
<in0 xsi:type="xsd:dateTime">2002-08-25T00:00:00Z</in0>
</intf:printDate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

It works well with Axis beta 2 and the problem is in
org.apache.axis.utils.JavaUtil class. The method 'isConvertable(Object,
Class)' will check the compatibility of types, it seems that it misses some
cases (dateTime ...) :
    public static boolean isConvertable(Object obj, Class dest)
    {
        ......        
        if (src != null) {
            // If we're directly assignable, we're good.
            if (dest.isAssignableFrom(src))
                return true;

            // If it's a wrapping conversion, we're good.
            if (getWrapperClass(src) == dest)
                return true;
            if (getWrapperClass(dest) == src)
                return true;
            
            // If it's List -> Array or vice versa, we're good.
            if ((Collection.class.isAssignableFrom(src) || src.isArray()) &&
                (Collection.class.isAssignableFrom(dest) || dest.isArray()))
                return true;
            
            if ((src == Hex.class && dest == byte[].class) ||
                (src == byte[].class && dest == Hex.class))
                return true;
            
            // Allow mapping of HashMaps to Hasttables
            if (src == HashMap.class && dest == Hashtable.class)
                return true;

            // It should be OK for Calendar and Date
            if (src == Calendar.class && dest == Date.class)
                return true;
            
        }
        .....
        return false;
    }

Thank to Axis Group, have a nice day!
Quan

Mime
View raw message