Following up on my last email... Here's some examples of different dates providing slightly different formats coming from the web service:

Hardcoded to DateTime.Now (this is the only one that seems to work with flex):

<StartDate>2005-06-27T18:40:41.390625-07:00</StartDate>

Hardcoded to new DateTime(), no parameters:

<StartDate>0001-01-01T00:00:00</StartDate>

Hardcoded to new DateTime(2006, 6, 1, 0, 0, 0):

<StartDate>2006-06-01T00:00:00</StartDate>

Reading value from database:

<StartDate>2005-06-01T00:00:00</StartDate>

I even tried converting to local time using dt.toLocalTime():

<StartDate>2005-05-31T17:00:00-07:00</StartDate>

this actually seems like its closest to the DateTime.Now attempt, but it is still not recognized by flex.  It seems like flex needs to have the milliseconds there?  Anyway, I sure hope someone else has a clue what to do, this one really has me stumped.  I'm close to coding my own date object to hold the year, month, day, hour, minutes, and seconds values seprately and turn them back into a date once flex has them.  Again, this seems a little extreme for a situation where it should just work...  any thoughts?

-- Matthew




On 6/27/05, Matthew Shirey <[EMAIL PROTECTED]> wrote:
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

On 6/27/05, Rick Bullotta < [EMAIL PROTECTED]> wrote:

The YYYY-MM-DDTHH:MM:SS format is from .NET's default XML serializer, which uses something like an ISO date format (.NET's format string "s").   When you dump it on the server side, it is probably just using the object's ToString() method, which seems like it chose a different format.  One question, I guess, is what schema data type the WSDL is telling Flex to expect.  Second question (to the Macromedia crew) is how Flex handles deserialization depending on what that schema data type is….

 

- Rick

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Matthew Shirey
Sent: Monday, June 27, 2005 6:41 PM


To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Flex, C# Web Services, and Dates

 

Thanks for the reply, I did try what you suggested just to be sure, but like I said before, it seems that by the time the result event handler has fired, the data is already bad.  I just cannot see why the XML in the SOAP response is:

<StartDate>2005-06-01T00:00:00</StartDate>

yet the object created is:

StartDate[Local Time] : Wed Dec 31 16:00:00 1969 (+0:00)


this just doesn't make any sense...

-- Matthew

On 6/27/05, Rick Bullotta < [EMAIL PROTECTED]> wrote:

Here's an example with an HttpService, you can do something similar:

 

Add:

 

result="manageData(event)"

 

…to your mx:HttpService tag…

 

Define the handler something like this, where it will look through the returned data structure and replace the StartDate objects with a "parsed" version…in my example, my structure is a multi-row XML document.  One of the elements is named "DateTime" and is in the same format you are trying to parse.  If you only have a single row, the handler might look slightly different.

 

function manageData(event) {

            for(var i:Number=0; i< event.result.Row.length; i++) {

                        var d:Date = parseDateString(event.result.Row[i].DateTime);

                        event.result.Rowsets.Rowset.Row[i].DateTime = d;

            }

}

                                   

- Rick


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Matthew Shirey
Sent: Monday, June 27, 2005 6:13 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Flex, C# Web Services, and Dates

 

Might you have some information on where to put this exactly?  It seems like it's too late by the time the object has been created from the result of the web service call.  All it seems to contain is "Invalid Date".  When I look at the object that was created in the Network Monitor, it does seem to have a date, but not the one I sent it. 

From the network monitor, here's the date piece of the xml recieved in the SOAP "Response" entry:

<StartDate>2005-06-01T00:00:00</StartDate>

Here's the piece of the object created from the Network Monitor Web Service "onResult" entry :

StartDate[Local Time] : Wed Dec 31 16:00:00 1969 (+0:00)

as you can see, it doesn't even have the proper value in it.  I've created an onResult event handler to try to print out the value and all I get from obj.StartDate is "Invalid Date".

This one really has me stuck guys.  Any help would be greatly appreciated, thank you,

-- Matthew

On 6/25/05, Manish Jethani <[EMAIL PROTECTED]> wrote:

On 6/25/05, Rick Bullotta < [EMAIL PROTECTED]> wrote:

> Is there a way to use the import statement in "inline" script in an
> <mx:Script> block?  The compiler complains if we try this.

Yes, certainly.

  <mx:Script>
    import foo.Bar;

    function blah():Void
    {
      Bar.bar();
    }
  </mx:Script>

Must be something wrong with the way you are importing.  If you still
have the problem, you could post the exact compiler error.


--
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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/




--
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







--
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