Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Non responsive endpoints

edited June 2018 in SRP HTTP Framework
Morning,

When using HTTPClient_services to send a HTTP request, sometimes the call just sits there spinning its wheels.
When we enter the same url into the browser it appears as if the whole site is down or inaccessible.

The assumption therefore is that HTTPClient_Services is waiting for a response before returning.
Is there a way to have HTTPClient_Services back off when the site is non responsive?

Comments

  • Howdy! Yes, I think you can accomplish your goals with the product "as is". First, you must call the SendHTTPRequest service with the UseAsynchronous flag set to 1 (which is the default, but I wanted to make sure you know this was required). Otherwise, this forces the underlying XMLHTTP library to wait as long as it wants. When the UseAsynchronous flag is set to 1, it allows us to introduce our own loop and wait mechanism.

    There is a default timeout of 30 minutes. If you want to reset this to another timeout, just call this before your SendHTTPRequest call:
    HTTPClient_Services('SetTimeoutDuration', 60) ; // 60 seconds
    Let me know if this helps.
  • I should also add that this is not a permanent setting. It will remain for this session only (it gets cached) but it is not stored as the new default. You can update the GetTimeoutDuration service if you want to make this permanent.
  • Thanks Don,
    I considered setting the UseAsynchronous flag to false so it would skip that loop.
    Now that I know the actual consequences of that, I'll stick to the default.

    Would I be correct to assume then, that if the timeout kicks in, there will then be no response and an error that will then be passed through error_services?
  • The service doesn't set its own error as a result of the timeout because we can't assume that a response won't come back at the last millisecond. Or...perhaps it was there anyway and the XMLHTTP object wasn't acknowledging it properly. Either way, if it is a non-responsive end point then I would expect the subsequent attempt to call the responseBody method of the XMLHTTP object to fail and this would produce an error that this service will return. Having said that, I can't recall if I ever tested to see what would happen.
Sign In or Register to comment.