Julie Marulappa · Sep 27, 2018

Is their a way to make an http adapter wait a certain number of seconds?

I have an http adapter that calls out to a web service and is looking for a "Completed" response. I want the adapter to wait a certain number of seconds before calling out again to get a response. I have tried setting the retry interval on the business operation but that does not do it. See my code below.

While pResponse.StringValue = "Processing" {
set tSC=..Adapter.PostURL(tURL,.tHTTPResponse,,tId)
do tHTTPResponse.Data.Rewind()
set pResponse.StringValue = tHTTPResponse.Data.Read(3000000,.tSC)
$$$TRACE("Second Response: "_pResponse.StringValue)


3 0 5 270


HANG command exists.

You can put between each command (if you have enought time ;-)) ) an hang command:

while response.StringValue="Processing" {
hang 5 // pause for 5 seconds
// get new response

Regards and
have a nice day

Instead of


you can use


for the same effect, but greater readability.

Redefine HTTP adapter like this:

Class Production.Adapter.HTTPOutboundAdapter Extends EnsLib.HTTP.OutboundAdapter

Method PostURL(pURL As %String, Output pHttpResponse As %Net.HttpResponse, pFormVarNames As %String, pData...) As %Status [ CodeMode = expression ]
..SendFormDataArray(.pHttpResponse, "POST", ..GetRequest(), .pFormVarNames, .pData, pURL)

ClassMethod GetRequest() As %Net.HttpRequest
    set request = ##class(%Net.HttpRequest).%New()
    set request.Timeout = 300 // Wait 300 seconds for response
    quit request


And use it instead of default adapter.

Hang  is not recommended to use in business component as the business component/adapter as the component or adapter will be blocked for that specified time.

However I would suggest something else in your code, to use Read($zutil(96,39)) instead of fixed value. $zutil(96,39) contains the number of characters  that a String can  hold.  If Intersystems  increase the number of characters for a string in future it will automatically take that maximum characters .