3 Replies Latest reply on Sep 23, 2009 3:19 AM by Balaji Sridhar

    ColdFusion Remote Service Calls and Dates

    Christine Panus

      Hi all, I'm hoping someone can help me out with my confusion.  I’m sending an object including datetime data from ColdFusion to a Flash application.  The datetime in the ColdFusion object include milliseconds, however, if I use the getTime() function on the Date object in the Flex application, the milliseconds have been zeroed out.  Is there any way to retain the milliseconds when the data is passed through the flexgateway?

       

      Thanks,

      Christine

        • 1. Re: ColdFusion Remote Service Calls and Dates
          Balaji Sridhar Level 2

          Hi Christine,

           

           

          Can you send us the snippet of your CF code so that we can take a look at it and provide an appropriate solution?

           

           

          Thanks,

          Balaji

          • 2. Re: ColdFusion Remote Service Calls and Dates
            Christine Panus Level 1

            Hi Balaji,

             

            I have attached a demo of my proxy webservice called pxTest.cfc.  pxTest.cfc contains two functions, testDate and pushBackTestDate.  I also attached a simple Flex App called testDate.mxml.  And a Test file called test.cfm.

             

            Save pxTest.cfc to your CFC folder.  Create a new project called TestDate.  Go to the data/services tab, click "Connect to Data/Service" and select Data Service ColdFusion.  Browse to PxTest.cfc and select it for the CFC location.  Click Next, then click Finish.  Configure ReturnType as Date for both pushBackTestDate and testDate.  Paste the code from TestDate.mxml into the blank TestDate.mxml file that was created when you created the project TestDate.  Run the TestDate.mxml application.

             

            On load of the application a date was requested and received from pxTest.cfc.  Click Confirm Test Date and note the date returned, and the milliseconds value for that date.  Next click Push User Data back, this will call the method pushBackTestDate sending the date from the Flex app back into CF.  All pushBackTestDate does is set the value returned into session and return it back to the Flex app again.

             

            Click the button Show Pushed Data Result to see the date that was returned.  In my tests this date no longer has a value for milliseconds.  As long as pxTest.cfc and test.cfm run in the same session you will be able to see the dates sent and returned by running test.cfm.  The dump of that session variable and time formatted versions of that variables are displayed below:

             

            RETURNED{ts '2009-09-17 12:57:50'}
            SEND{ts '2009-09-17 12:57:50'}

             

            TimeFormat Send 12:57:50 13

            TimeFormat Returned 12:57:50 0


            Note the date sent contains milliseconds, the date returned does not have milliseconds.  Hopefully this demo will work for you and demonstrate the issue.  Please let me know if you need more information.

             

            Thanks,

            Christine

            • 3. Re: ColdFusion Remote Service Calls and Dates
              Balaji Sridhar Level 2

              Hi Christine,

               

              Thanks for your attachments and detailed explanation.

               

              We are able to reproduce your issue.

               

              It looks like Flex is sending back the date with milli-seconds (we verified this through remoting using BlazeDS for a Java function).

               

              So I think this could be an issue with CF (during de-serializing), can you log a bug in the CF bug base, http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html

               

              Hope this helps!

               

              Thanks,

              Balaji

              http://balajisridhar.wordpress.com