You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by David Kenzik <da...@kenzik.com> on 2001/09/07 17:38:21 UTC

GregorianCalendar (De)Serialization Problem

I've exposed a test method that dumps my passed GregorianCalendar object as
a string:

	...
	public void test(GregorianCalendar c)
	{
		System.out.println(c.toString());
	}
	...

The client side is doing the following:

	...
	call.setMethodName("test");
	// Also tried:
	// Calendar testCal=new GregorianCalendar();
	GregorianCalendar testCal=new GregorianCalendar();
	System.out.println(testCal.toString());
	params.addElement(new Parameter("c",GregorianCalendar.class,testCal,null));
	call.setParams(params)
	response=call.invoke(url,"");
	...

I'm finding that some information is lost over the wire. 

The client side shows, as the javadocs suggest, that the testCal is indeed
set to the current date/time. However, the server side loses all the time
settings: HOUR, HOUR_OF_DAY, MINUTE, SECOND, MILLISECOND; and the 'time' key
is off by the aforementioned time settings.

According to the Apache-SOAP docs, GregorianCalendar is a predefined type
mapping.

Is this a known issue? Is this a new bug? Am I doing something wrong?

Any input wuld be appreciated. 

-- 
David S. Kenzik
david@kenzik.com -  http://kenzik.com
Original Music   -  http://kenzik.com/music

Re: GregorianCalendar (De)Serialization Problem

Posted by David Kenzik <da...@kenzik.com>.
Answering myself:

To solve this problem, simply set the appropriate format when you construct
the SimpleDateFormat inside CalendarSerializer.java.

The present CalendarSerializer defaults to 'yyyy-MM-dd'.

-- 
David S. Kenzik
david@kenzik.com -  http://kenzik.com
Original Music   -  http://kenzik.com/music

  David Kenzik said...

 > I've exposed a test method that dumps my passed GregorianCalendar object as
 > a string:
 > 
 > 	...
 > 	public void test(GregorianCalendar c)
 > 	{
 > 		System.out.println(c.toString());
 > 	}
 > 	...
 > 
 > The client side is doing the following:
 > 
 > 	...
 > 	call.setMethodName("test");
 > 	// Also tried:
 > 	// Calendar testCal=new GregorianCalendar();
 > 	GregorianCalendar testCal=new GregorianCalendar();
 > 	System.out.println(testCal.toString());
 > 	params.addElement(new Parameter("c",GregorianCalendar.class,testCal,null));
 > 	call.setParams(params)
 > 	response=call.invoke(url,"");
 > 	...
 > 
 > I'm finding that some information is lost over the wire. 
 > 
 > The client side shows, as the javadocs suggest, that the testCal is indeed
 > set to the current date/time. However, the server side loses all the time
 > settings: HOUR, HOUR_OF_DAY, MINUTE, SECOND, MILLISECOND; and the 'time' key
 > is off by the aforementioned time settings.
 > 
 > According to the Apache-SOAP docs, GregorianCalendar is a predefined type
 > mapping.
 > 
 > Is this a known issue? Is this a new bug? Am I doing something wrong?
 > 
 > Any input wuld be appreciated. 
 > 
 > -- 
 > David S. Kenzik
 > david@kenzik.com -  http://kenzik.com
 > Original Music   -  http://kenzik.com/music


Re: GregorianCalendar (De)Serialization Problem

Posted by David Kenzik <da...@kenzik.com>.
Answering myself:

To solve this problem, simply set the appropriate format when you construct
the SimpleDateFormat inside CalendarSerializer.java.

The present CalendarSerializer defaults to 'yyyy-MM-dd'.

-- 
David S. Kenzik
david@kenzik.com -  http://kenzik.com
Original Music   -  http://kenzik.com/music

  David Kenzik said...

 > I've exposed a test method that dumps my passed GregorianCalendar object as
 > a string:
 > 
 > 	...
 > 	public void test(GregorianCalendar c)
 > 	{
 > 		System.out.println(c.toString());
 > 	}
 > 	...
 > 
 > The client side is doing the following:
 > 
 > 	...
 > 	call.setMethodName("test");
 > 	// Also tried:
 > 	// Calendar testCal=new GregorianCalendar();
 > 	GregorianCalendar testCal=new GregorianCalendar();
 > 	System.out.println(testCal.toString());
 > 	params.addElement(new Parameter("c",GregorianCalendar.class,testCal,null));
 > 	call.setParams(params)
 > 	response=call.invoke(url,"");
 > 	...
 > 
 > I'm finding that some information is lost over the wire. 
 > 
 > The client side shows, as the javadocs suggest, that the testCal is indeed
 > set to the current date/time. However, the server side loses all the time
 > settings: HOUR, HOUR_OF_DAY, MINUTE, SECOND, MILLISECOND; and the 'time' key
 > is off by the aforementioned time settings.
 > 
 > According to the Apache-SOAP docs, GregorianCalendar is a predefined type
 > mapping.
 > 
 > Is this a known issue? Is this a new bug? Am I doing something wrong?
 > 
 > Any input wuld be appreciated. 
 > 
 > -- 
 > David S. Kenzik
 > david@kenzik.com -  http://kenzik.com
 > Original Music   -  http://kenzik.com/music