Start a Conversation

Unsolved

This post is more than 5 years old

3167

September 5th, 2011 01:00

Solution For timeout exception

Hi,

Im getting the following error while running the sample application to upload a files into cloud.

"The request timestamp was outside the valid time window"

when i do change the system time GMT+2.It will work correctly no exception thrown.

i dont want to make changes in system time.when i run the sample in another system i need to change the system time again.I dont want to do like that.

I need to change date and time coding itself using c#.

Please can you give me a solution..

Regards,

Karthik.

281 Posts

September 5th, 2011 02:00

kartike wrote:

Hi,

Im getting the following error while running the sample application to upload a files into cloud.

"The request timestamp was outside the valid time window"

when i do change the system time GMT+2.It will work correctly no exception thrown.

i dont want to make changes in system time.when i run the sample in another system i need to change the system time again.I dont want to do like that.

I need to change date and time coding itself using c#.

Please can you give me a solution..

Regards,

Karthik.

Hi karthik,

Please see my solution in

https://community.emc.com/docs/DOC-10621

Basically, you issue a dummy request to the server to get its time stamp and calculate your times from that value

18 Posts

September 5th, 2011 02:00

Hi ,

Sorry i studied that document.I coundn't understand it.

I am using the code C#.

Can u please give me a solution in C#?

Regards,

Karthik

281 Posts

September 5th, 2011 03:00

I won't be able to give you an actual C# example until I return on Tuesday from holiday. Essentially, make a web request to http://server/rest and read the "date"

Response header. You then use that date as a basis for computing the date for your requests. O

18 Posts

September 5th, 2011 03:00

Hi

These are the steps i have followed to create sample,

            const string host = "cloudonestorage.peer1.com";
            const int port = 443;
            const string userName = "";
            const string secret = "";

            EsuRestApi cloudRest = new EsuRestApi(host, port, userName, secret);         
            UploadHelper upload = new UploadHelper(cloudRest);
            ObjectId objectId = null;
            objectId = upload.CreateObject("C://Users//karthike//Desktop//Element.docx", null, null);   

How can i make a we request to server and get the date?

Hi, How can i get the response header date using C#?

Can you please give me a solution?

Thanks,

Karthik E.

18 Posts

September 5th, 2011 06:00


Hi

I cant get the response from http://server/rest.Insead im using https://cloudonestorage.peer1.com.

Then only can get the response from server. Is this right?

I cant understand last statement(bold) that you mentioned below.Please let me know.

i can read the date response header.

Essentially, make a web request to http://server/rest and read the "date" Response header.

"You then use that date as a basis for computing the date for your requests". O

Regards,

Karthik.

222 Posts

September 5th, 2011 11:00

Karthik,

Jason is suggesting that you make simple HTTP request to this URL:  https://cloudonestorage.peer1.com/rest

In the HTTP response will be a Date header that reflects the current server time.  You can parse that header and compare the server time to your local system time and adjust your outgoing request timestamp accordingly.

Raj

18 Posts

September 5th, 2011 21:00

Hi,

I gave the web request and get the response header date.

header date is like : Tue, 06 Sep 2011 04:29:18 GMT

My local sytem time is like: Tue, 06 Sep 2011 04:22:32 GMT

Now i need to add 7 min to local time and then add that value to header in following code in EsuRestApi.cs,

                DateTime dateHeader1 = DateTime.Now.ToUniversalTime();
                dateHeader1.AddMinutes(7);
                string dateHeader = dateHeader1.ToString("r");

              
                log.TraceEvent(TraceEventType.Verbose, 0,  "Date: " + dateHeader );
                headers.Add( "Date", dateHeader );

Is this Right? I followed tihs procedure.I can get the same timeout error.Did i do anything wrong?

Is there any other way to adjust the outgoing request timestamp?

How can i adjust the outgoing request timestamp?

Please give me a solution.

Regards,

Karthik.

281 Posts

September 6th, 2011 06:00

Hi Karthik,

Try:

                DateTime dateHeader1 = DateTime.Now.ToUniversalTime();
                dateHeader1 = dateHeader1.AddMinutes(7);
                string dateHeader = dateHeader1.ToString("r");

              
                log.TraceEvent(TraceEventType.Verbose, 0,  "Date: " + dateHeader );
                headers.Add( "Date", dateHeader );

DateTime objects are immutable.

I'm working on getting this built-in to the dotnet API.

281 Posts

September 6th, 2011 14:00

Karthik,

Can you check out the latest version of EsuRestApi.cs from subversion?  I added a CalculateServerOffset() method and a ServerOffset property.  You can insert the following code at startup:

EsuRestApi api = new EsuRestApi(...);

api.ServerOffset = api.CalculateServerOffset();

45 Posts

December 31st, 2012 03:00

Hi Jason,

Do you think this solution works for Load balanced ATMOS servers having different time? Is the ATMOS server time supposed to be a fixed value?

Thanks,

Ravi

110 Posts

December 31st, 2012 05:00

Ravi,

All Atmos nodes are set to UTC time.  A load-balanced cloud with endpoint inclusions in different time zones may exhibit different latencies for different RMGs/locations.  This method simply pings the endpoint and uses the date stamp in the response to calculate the offset.  It's as good as any other method I can think of to determine offset.  A signed request should have a validity window of +/- 5 minutes.  As long as the client and Atmos nodes are synced to accurate time servers, there shouldn't be any issues.

- Stu

No Events found!

Top