I searched our bugbase to see if we had anything about the milliseconds in there but didn’t find anything.  So please file away and include a C# class or a WSDL and we’ll take a look.  Get it in now and we can try to make sure it’s fixed in 2.0

 

Matt

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Matthew Shirey
Sent: Tuesday, June 28, 2005 12:55 PM
To: [email protected]
Subject: Re: [flexcoders] Flex, C# Web Services, and Dates

 

Well, Since Flex isn't automatically parsing the date correctly.  It might be best for me to change the type on the Web Service side to string, manually call the .ToString() method for the date there.  Send the date as a string, then use the DateFormatter as you did and manually parse it on the Flex side.  I played around with it a bit more and I finally figured out what was going on.  Basically, if the date contains milliseconds, then Flex parses it correctly.  If not, then it fails to parse it.  I tried an experiment where I added 1 millisecond to the values I was pulling from the database, and then all worked fine.  Since adding and removing a millisecond to make parsing work seems a little too hackish, I think I'll try the string method I just mentioned.  It's a real problem though that I hope is fixed in 2.0.  All of the work I do involves C# web services.  Until now I haven't had a problem.  But this is a pretty big wart.

-- Matthew

On 6/27/05, Matt Chotin <[EMAIL PROTECTED]> wrote:

Yes, please try to play around with this and if you figure out what's up file a bug report (http://www.macromedia.com/go/wish).  If you can supply a WSDL that's even better because we can then try to verify that it will be fixed in 2.0. 

 

Matt

 


From: [email protected] [mailto:[email protected]] On Behalf Of Rick Bullotta
Sent: Monday, June 27, 2005 7:14 PM
To: [email protected]
Subject: RE: [flexcoders] Flex, C# Web Services, and Dates

 

If you don't need HH:MM:SS resolution, try this for a test:

 

Generate your WSDL, and save it to a file.  Tweak the WSDL to use xsd:date instead of xsd:dateTime, point your Flex app to the modified WSDL, and see if that addresses the issue.  There are lots of posts I found on Google regarding .NET's dateTime serialization woes…and it seems to, by default, serialize in varying formats depending on resolution and time zone.  To be fair, the formats it is generating should be properly parsed/processed on the Flex side based on the following:

 

Also, I experimented a bit with the DateFormatter object's parseDateString method and it worked properly on all of the formats you generated

 

            <mx:Script>

                        <![CDATA[

                                    function parseDateString(str:String):Date

                                    {

                                                return DateFormatter.parseDateString(str);

                                    }

 

                                    function doTest() {

                                                alert(dateFmt.format(parseDateString("2005-06-01T00:00:00")));

                                                alert(dateFmt.format(parseDateString("2005-06-27T18:40:41.390625-07:00")));

                                                alert(dateFmt.format(parseDateString("2005-05-31T17:00:00-07:00")));

                                    }

                        ]]>

            </mx:Script>

 

            <mx:DateFormatter id="dateFmt" formatString="{'M/D/Y' + newline + 'JJ:NN:SS'}" />

 

 

Seems like there's a disconnect somewhere inside of the deserialization in Flex, but I can't be certain.  Sounds like it is worth creating a bug report.

 

- Rick

 

 


From: [email protected] [mailto:[email protected]] On Behalf Of Matthew Shirey
Sent: Monday, June 27, 2005 9:36 PM
To: [email protected]
Subject: Re: [flexcoders] Flex, C# Web Services, and Dates

 

well, the WSDL says:

<s:element minOccurs="1" maxOccurs=" 1" name="StartDate" type=" s:dateTime" />

Because I am close to pulling all my hair out on this one, I decided to try something on the server end.  In the web method, I hard coded the StartDate propery to return DateTime.Now.  To my surpise, this actually worked.  I then tried hardcoding it to return new DateTime(2005, 6, 1, 0, 0, 0, 0).  This produced the original error.  It seems like things are a little wierd on both ends.  Depending on the date value on the server end, the server is actually sending the XML formatted differently.  I am more confused now than ever.  Does any one here have any experience using C# Web Services with Flex using the C# DateTime type?  I would be interested in some best practices type guidlines.  However the DateTime.Now value is delt with, it works, but any other date value I create doesn't work.  It's quite confusing...

-- Matthew




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com



YAHOO! GROUPS LINKS

 

 





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to