NetTalk Central

Author Topic: NetWebForm generation timeout?  (Read 3236 times)

bekeland

  • Newbie
  • *
  • Posts: 37
    • View Profile
NetWebForm generation timeout?
« on: November 03, 2008, 01:56:06 PM »
I have a NetWebForm and am using the Generate Form | Start embed.  In this embed I call a window that communicates with PayPal by posting a string and receiving a response.  When that returns, the NetWebForm should come up with my order confirmation number.  I am having an issue where it is like the NetWebForm does not complete it's generation.  Maybe the response from PayPal takes too long and the NetWebForm stops?  Is there some timeout issue in there that can be extended?  This is not a session timeout issue.  Most of the time this all works.  A couple times a week this comes up where I've sent my query to PayPal in this embed, but something kills the NetWebForm to where the rest of my code that completes the order and displays the confirmation just doesn't happen.  I am communicating with PayPal and they are blaming my server and a timeout.  Is there any sort of timeout on a NetWebForm generating?  Thanks much.

Brian Ekeland

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11181
    • View Profile
Re: NetWebForm generation timeout?
« Reply #1 on: November 03, 2008, 10:56:28 PM »
Hi Brian,

Typically the browser will time-out if it requests a page, but gets no response within about 30 seconds.
As far as I know there's no way to change this timeout value.

So the important thing to do is make sure at least _something_ has been sent to the browser within that time. After that you can take some time (although not an endless amount of time) to get something done.

I recommend you simply move your code down a bit. What I'd do (off the top of my head without checking) is have a display field saying something like
"contacting PayPal - please wait...."
And then embed your code after that has been sent.
(Form fields are sent from the value::whatever routine for that field, so you can embed after that.)

Then you do the calc, and the next form field is the display of the "paypal response".

Cheers
Bruce

bekeland

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: NetWebForm generation timeout?
« Reply #2 on: November 04, 2008, 08:39:47 AM »
I am sending a header out from the XHTML tab in the "before <div>" that does show up in the browser with a message to the user to wait for the order conf and if it doesn't show up to contact us.  The user does get that but when it fails, nothing else, where they should get either a failure or order conf set of fields.  What about the window where I am doing the PayPal communication, where I post the DoDirectPayment to them.  Is there some timing in the ThisWebClient.Post() that is not waiting long enough for the PayPal response?  PayPal is telling me they are sending the response.  My server app is acting like nothing is coming back.  I am still waiting on them to tell me how long it took for one of these that failed and what a maximum wait should be.  So could there be some timing issue with NetTalk in this window with the Post?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11181
    • View Profile
Re: NetWebForm generation timeout?
« Reply #3 on: November 04, 2008, 10:51:45 PM »
Hi Brian,

yes, of course, you're right - that's the other thing to consider.
If you send a packet to PayPal, and then "wait for a reply" then there is presumably some timout gonna happen there as well.
Of course this one is a lot easier to control. But by default it's quite long, so I'm not expecting a timeout.

a) for testing you might wanna turn on Error Messages - especially for the PayPal web client procedure. If you are getting any kind of error then naturally you'd want to know it. You'd then be notified if the error was a timeout.

b) in your web client, have you added your code to the .Process or .PageReceived method? .PageReceived is probably (definitely) better. Presumably you have some code in there to do stuff when the reply arrives - so perhaps put some debugging in there to see if it ever gets into that method. (be careful not to put your debugging inside an IF statement).

Cheers
Bruce

bekeland

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: NetWebForm generation timeout?
« Reply #4 on: November 05, 2008, 09:03:10 AM »
I did some testing two different ways with a sleep() and then a timer loop on the clock.  I was just trying to simulate PayPal taking extra time to send the response.  What I came up with was that if my function call to the window that posts to PayPal took around 6 seconds or more, when it returns, the rest of my NetWebForm would NOT display in the browser.  If the function call took less than 6 seconds, the entire NetWebForm would display.  Does this make any sense?

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: NetWebForm generation timeout?
« Reply #5 on: November 05, 2008, 11:13:25 AM »
I use a please wait process to send a single character to the browser while I'm waiting for something to finish.
I have a post ( http://www.nettalkcentral.com/index.php?option=com_smf&Itemid=36&topic=201.0 ) that explains how you might do that.
In your case, I think you might have to start the waiter on a separate thread before you call paypal then post an end event to the waiter thread when Paypal comes back.

hth
chris
Real programmers use copy con newapp.exe

bekeland

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: NetWebForm generation timeout?
« Reply #6 on: November 06, 2008, 09:14:48 AM »
Chris, thanks for that.  I went through your post and worked it into my window where I'm waiting for the PayPal response, simply using the window timer.  I want to see something so I did not do the NoShow and used a period instead of the x, so I get a series of ... which I think will be helpful in my case.  I still don't know that this will solve the problem, but will at least give the user something to look at.  And if the dots stop without getting anything else it should be a better indicator to the customer that something is wrong.  I am also going to add code to review the call/response log I keep to look for PayPal calls with no response.  Thanks again.

Brian

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11181
    • View Profile
Re: NetWebForm generation timeout?
« Reply #7 on: November 07, 2008, 07:31:05 AM »
6 seconds sounds like a very short timeout Brian....
I'm not sure where that's coming from...

Cheers
Bruce