
UNSOLVED
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.
Responses (11)
Solutions (0)
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
Reply 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.
Reply
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.
Reply 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
Reply 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.
Reply 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.
Reply 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();
Reply

JasonCwik
281 Posts
1164
0
Posted September 5th, 2011 02:00
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