web.regAsyncAttributes

Registers the next action function as the beginning of an Asynchronous ConversationClosed An Asynchronous Conversation is a series of related web tasks, including tasks caused by redirection. An Asynchronous Conversation starts with the request for the desired response, includes all the requests and responses that are caused by this request (authentication, redirection, and so on) and ends when the desired response is received or when the series of interactions is canceled. if the function has requests with the specified URL.

ExampleAsynchronous Functions - JavaScript

Syntax

int web.regAsyncAttributes( {object} );

JSON Object

{  
   id:"<string>",
   url:"<string>" | url:{value:"<string>", flag: <"IC" or "RE">} ,
   pattern:"<string>",
   pollIntervalMs:"<string>",
   xmlHttpRequest:"<string>",
   crossStep:"<string>",
   responseHeadersCB:"<string>",
   responseBodyBufferCB:"<string>",
   requestCB:"<string>",
   responseCB:"<string>"
}
.
Argument Description
idThe Conversation ID.
url

The full absolute URL, exactly as expected in the next action function.

patternOne of None, Push, Poll, or LongPoll. See Asynchronous Conversation Patterns
pollIntervalMsThe number of milliseconds to wait after the end of one poll instance, before another instance can be started.
xmlHttpRequest

Sets whether or not the task is handled as a javascript XMLHttpRequest and handled asynchronously to other tasks.

One of No, Async, or Sync.

If the Pattern is None or Push, the default is No.

If the Pattern is Poll or LongPoll, the default is Async.

crossStep

If Yes, the steps can end without waiting for the server response for the specified url to complete.

Yes or No. The default is Yes for all Pattern values except None.

responseHeadersCB

The name of a user-coded C callback function. The specified function is invoked at most once for each response, when all response headers have been received.

See Response Header Buffer Callback

responseBodyBufferCB

The name of a user-coded C callback function. The specified function is invoked zero or more times for each response body buffer received. It is invoked with data extracted from the last read buffer, and also invoked with all response body accumulated to this point.

It is also invoked once with empty data when the response has ended.

See Response Body Buffer Callback

requestCB

The name of a user-coded C callback function. The specified function is invoked once for each conversation task. The function and can modify the url and the request body.

See Request Callback

responseCB

The name of a user-coded C callback function. The specified function is invoked once at the end of a conversation, with the accumulated response headers and body of the last request in the conversation. If the last request did not return a response, the callback function is invoked and passed an empty string as the callback function argument.

See Response Callback

Return Values

This function returns LR_PASS (0) if the registration succeeded.

Parameterization

You can use standard LoadRunner Professional parameterization with all string values in JavaScript objects.

General Information

The URL argument is not necessarily the primary URL of the next action function. For example, it can be a redirection or a resource. The Conversation registered will be that specified by the url argument.

Concept Link IconSee Also

Example

Use without URL flags:

web.regAsyncAttributes(
{
      id : 'Poll_0', 
      pattern : 'Poll', 
      url : 'http://kalimanjaro/webgui/polling/dummy.txt?key=0', 
      pollIntervalMs : 4900, 
      requestCB : 'Poll_0_RequestCB', 
      responseCB : 'Poll_0_ResponseCB'
}
);

Ignore case:

web.regAsyncAttributes(
{
      id : 'Poll_0', 
      pattern : 'Poll', 
      url: {value: 'http://kAlImAnJaRo/webgui/polling/dUmMy.tXt?kEy=0', flag: 'IC'},
      pollIntervalMs : 4900, 
      requestCB : 'Poll_0_RequestCB', 
      responseCB : 'Poll_0_ResponseCB'
}
);

Regular expression:

web.regAsyncAttributes(
 {
      id : 'Poll_0', 
      pattern : 'Poll', 
      url: {value: 'http://kalimanjaro/webgui/polling/*', flag: 'RE'},
      pollIntervalMs : 4900, 
      requestCB : 'Poll_0_RequestCB', 
      responseCB : 'Poll_0_ResponseCB'
 }
);