Like Tom said, the format date string is probably like this:
"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
The code following works for me.

...
Date theDate = null;
String formattedStr = "2007-05-10T15:22:07.000Z";
SimpleDateFormat tempFormat = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
try {
        theDate = tempFormat.parse(formattedStr);
} catch (java.text.ParseException pe) {
        System.out.println("We got a parsing exception: " +
pe.getMessage());
}
Calendar cal = new GregorianCalendar();
cal.setTime(theDate);
..
-jeff
 

-----Original Message-----
From: Tom Hughes [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 02, 2007 3:48 PM
To: [email protected]
Subject: Re: [Axis2] ConvertUtil.convertToDateTime - Unparseable date

I believe the offending tag is the TimeStamp in the BaseResponse type.
It is 
defined as xs:dateTime. According to the document the required format is
:
'-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?

It seems to me the date: 2007-07-01T19:20:11.4766598GMT+01:00  is valid.

Is there a way to hook into the conversion and add my own formatters?

thanks, Tom

>From: "Ajith Ranabahu" <[EMAIL PROTECTED]>
>Reply-To: [email protected]
>To: [email protected]
>Subject: Re: [Axis2] ConvertUtil.convertToDateTime - Unparseable date
>Date: Mon, 2 Jul 2007 11:19:04 -0700
>
>It could be a problem with the date string format. You can have a look
>at the http://www.w3.org/TR/xmlschema-2/#isoformats to see the allowed
>date string formats. It seems that this date string may have a problem
>but I could be mistaken since I  went through it rather quickly
>
>Ajith
>
>On 7/2/07, Tom Hughes <[EMAIL PROTECTED]> wrote:
>>Hello,
>>
>>Just starting out with Axis2. I'm trying to interface with an existing
web
>>service. I generated my client using the wsdltojava tool and the adb
>>binding. When I send a request I get the following stacktrace :
>>
>>Jul 1, 2007 7:25:33 PM org.apache.commons.httpclient.HttpMethodBase
>>readResponse
>>INFO: Discarding unexpected response: HTTP/1.1 100 Continue
>>java.lang.RuntimeException: java.lang.NumberFormatException:
Unparseable
>>date: "2007-07-01T19:20:11.4766598GMT+01:00"
>>at
>>com.globalbettingexchange.www.externalapi.SecureServiceStub.fromOM(Unk
nown
>>Source)
>>at
>>com.globalbettingexchange.www.externalapi.SecureServiceStub.GetAccount
Balances(Unknown
>>Source)
>>at com.tom.sportsbetting.Main.main(Main.java:25)
>>Caused by: java.lang.NumberFormatException: Unparseable date:
>>"2007-07-01T19:20:11.4766598GMT+01:00"
>>at
>>org.apache.axis2.databinding.utils.ConverterUtil.convertToDateTime(Con
verterUtil.java:589)
>>at
>>com.globalbettingexchange.www.externalapi.SecureServiceStub$GetAccount
BalancesResponse$Factory.parse(Unknown
>>Source)
>>at
>>com.globalbettingexchange.www.externalapi.SecureServiceStub$GetAccount
BalancesResponse99$Factory.parse(Unknown
>>Source)
>>... 3 more
>>
>>I'm using the latest release, 1.2
>>I've attached the wsdl. Can anyone help?
>>
>>thanks, Tom
>>
>>_________________________________________________________________
>>Txt a lot? Get Messenger FREE on your mobile.
>>https://livemessenger.mobile.uk.msn.com/
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
>--
>Ajith Ranabahu
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>

_________________________________________________________________
Win tickets to the sold out Live Earth concert!
http://liveearth.uk.msn.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to