You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Versus_Spirit <ve...@hotmail.com> on 2006/09/22 08:52:13 UTC

Re: No object was found for class type class java.util.Calendar

I just found a solution,
his :
There is a, may be, a bug in org.apache.axis.encoding.ConstructorTarget.

When axis instanciate a class with a custom constructor (no the default
parameterless), it check if class type from webservice are same as
constructor parameters, here is the code that do this :

    if
(values.get(i).getClass().getName().toLowerCase().indexOf(classes[c].getName().toLowerCase())
!= -1) 

The problem is

the bean class contructor (for me) take a java.util.calendar and the
webservice return a java.util.gregorianCalendar, indexOf failed.

To correct it without changed axiscode. I change the bean class contructor
(generated with wsdl2java) to take gregoriancalendar.


unrealone wrote:
> 
> Hallo,<br/>
> I have a strange problem with getting Calendar/Date (java.util.*) objects
> via an Axis/SOAP method. The method's return type is a complex type mapped
> as a bean with the <em>beanMapping</em> tag and this complex type has a
> Date field (I tried both Date and Calendar - neither worked).<br/>
> <br/>
> When calling the method from the client, an exception is thrown upon
> deserialization:<br/><br/>
> <font color="#FF0000">org.xml.sax.SAXException: No object was found for
> class type class java.util.Calendar</font><br/><br/>
> This is even more strange, since I set up another test method that simply
> returns a Calendar (or Date - again I tried both) instance. This method
> works just fine so I really don't see how this is different from the
> previous bean-field case.<br/>
> <br/>
> Just to summarize again:<br/>
> case #1 - <font color="#FF0000">complex bean-mapped type with a field of
> the type java.util.Date or java.util.Calendar returned by the webservice
> method - the above-mentioned exception is thrown upon
> deserialization</font><br/>
> <br/>
> case #2 - <font color="#0000FF">just java.util.Date or java.util.Calendar
> (Axis should handle ser/deser automatically - so no mapping or other black
> magic) returned by a webservice method - everything OK</font><br/>
> <br/>
> <br/>
> PLUS I checked the request/response with the <em>tcpmon</em> utility and
> the Date/Calendar values are serialized the same way in both cases:<br/>
> <br/>
> &lt;date
> xsi:type="xsd:dateTime"&gt;2006-08-30T12:33:50.197Z&lt;/date&gt;<br/>
> <br/>
> I am 99% sure that the complex classes' beanMapping is correct - when I
> remove the Date field, the object gets from the server to the client with
> NO PROBLEMS.
> <br/><br/>
> <font color="#0000FF">I'll appreciate any help you can give me - I feel
> kind of silly to even ask this since the issue looks quite elementary, but
> it's just not working for me</font>
> 
> 
> <hr>
> some sources here:<br/>
> <br/>
> <xmp>
> public class CdrRecordSO implements Serializable {
> ...   
>    private Calendar date;  // THIS IS THE FIELD THAT CAUSES PROBLEMS
> 
>    public Calendar getDate() {
>       return this.date;
>    }
> 
>    public void setDate(Calendar date) {
>       this.date = date;
>    }
> ...
> }
> </xmp>
> 
> 

-- 
View this message in context: http://www.nabble.com/No-object-was-found-for-class-type-class-java.util.Calendar-tf2190378.html#a6442007
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: No object was found for class type class java.util.Calendar

Posted by unrealone <ja...@gmail.com>.
Hello Versus_Spirit,

thanx for your reply! 

Yeah - I found the bug in ConstructorTarget too (after some cursing and
tracing). There's some "not-very-functional" :-) code that's suppose to
determine the actual constructor parameter types...
I thought I'd fix it and I partially did, but there were some other problems
and I really didn't have the time and the nerve to look for them....

Eventually, the sollution that worked for me was to remove the non-default
constructor from the bean (I have a feeling that a proper JavaBean should
only have a default constructor) and populate the fields by setters only. So
in the end ConstructorTarget won't be involved...and it works fine...





Versus_Spirit wrote:
> 
> I just found a solution,
> 
> There is, may be, a bug in org.apache.axis.encoding.ConstructorTarget.
> 
> When axis instanciate a class with a custom constructor (not the default
> parameterless), it check if class type from webservice are same as
> constructor parameters, here is the code that do this :
> 
>     if
> (values.get(i).getClass().getName().toLowerCase().indexOf(classes[c].getName().toLowerCase())
> != -1) 
> 
> The bean class contructor (for me) take a java.util.calendar and the
> webservice return a java.util.gregorianCalendar, indexOf failed.
> 
> To correct it without changed axiscode. I change the bean class contructor
> (generated with wsdl2java) to take gregoriancalendar not a calendar.
> 
> 

-- 
View this message in context: http://www.nabble.com/No-object-was-found-for-class-type-class-java.util.Calendar-tf2190378.html#a6442204
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org