我有一個經典的ASP頁面,它調用一個外部的web服務。 這是實際過程中是如何工作的:如何延遲執行經典ASP中的部分腳本?
'[Part0 : Call the external webservice]
wsResponse = setConfirmation(...)
' [PART1: external webservice is responding]
if not wsResponse is Nothing then
'....Process the response from the webservice according to wsResponse
code =wsResponse.getCode
if code = 'C' then
'We confirm the transaction and call a storedprocedure in SqlServer
else
'if code is different from C, we assume, the transaction status is 'not confirmed' or 'cancelled'
'[PART2: no answer from external webservice]
Else
'so wsReponse is nothing..We don't get any answer from the external webservice
'transaction is not confirmed
'the transaction status is set to 'not confirmed' in database
所以我想要做的是,在PART2(當沒有答案是從外部Web服務獲得),等待30秒之前發出數據庫「未確認」狀態。所以我想再次做PART0即:再次調用外部web服務至少10次,看看它是否響應。一種遞歸過程。 所以我在想這樣做的2路:
在PART2,把ASP睡30秒,並再次PART0(調用Web服務),如果還是沒有反應,在DB寫,交易未證實,但如果回覆,那麼做PART1。
在PART2中,調用PART0至少重複10次,如果經過10次試驗後,沒有響應,則寫入DB,交易未確認。
所以我的問題是:有沒有更好的方法來做到這一點或哪些或1或2會更好?還有,對於1,我們如何讓ASP像dotnet或PHP那樣睡覺?
感謝您的回答。
Regards
感謝您的答覆,但我不能使用pingdom.com出於很多原因。 – fisdelom