kartike
1 Nickel

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.

Labels (1)
0 Kudos
11 Replies
JasonCwik
2 Iron

Re: Solution For timeout exception

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

0 Kudos
kartike
1 Nickel

Re: Solution For timeout exception

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

0 Kudos
Highlighted
JasonCwik
2 Iron

Re: Solution For timeout exception

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

kartike
1 Nickel

Re: Solution For timeout exception

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.

0 Kudos
kartike
1 Nickel

Re: Solution For timeout exception


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.

0 Kudos
rbala1
2 Iron

Re: Solution For timeout exception

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

0 Kudos
kartike
1 Nickel

Re: Solution For timeout exception

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.

0 Kudos
JasonCwik
2 Iron

Re: Solution For timeout exception

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.

0 Kudos
JasonCwik
2 Iron

Re: Solution For timeout exception

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();

0 Kudos