web.utilSetRequestBody

Sets a string to be the request body for the next request sent in the 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..

Syntax

            
            web.utilSetRequestBody ( <bodyStr> );
ArgumentDescription
bodyStrThe string to be set as the new request body.

Return Values

Not applicable

Parameterization

The following argument(s) can be parameterized using standard parameterization: bodyStr

General Information

This is a utility function that can be called from callback routine Request Callback.

Example

web.utilSetRequestBody("<AMFPacket AMF_version=\"3\">"); 

Example: Asynchronous Conversations

Copy code
//Automatically generated file for implementing asynchronous callback functions.
//You can modify the automatically generated callback implementations or add new ones.
//Asynchronous callback functions can be registered using web_reg_async_attributes steps.
            function Push_0_RequestCB()
            {

            lr.outputMessage(">>> Push_0_RequestCB");

            }

            function Push_0_ResponseHeadersCB(
            aHttpStatusCode,
            aAccumulatedHeadersStr,
            aAccumulatedHeadersLen)
            {
            //Enter your implementation for ResponseHeadersCB() here.

            lr.outputMessage(">>> Push_0_ResponseHeadersCB " + aHttpStatusCode + " / " 
            + aAccumulatedHeadersStr.substr(0, 10) + " / " 
            + aAccumulatedHeadersLen);

            }

            function Push_0_ResponseBodyBufferCB(
            aLastBufferStr,
            aLastBufferLen,
            aAccumulatedStr,
            aAccumulatedLen,
            aHttpStatusCode)
            {
            //Enter your implementation for ResponseBodyBufferCB() here.

            lr.outputMessage(">>> Push_0_ResponseBodyBufferCB "  + aLastBufferStr.substr(0, 20) 
            + " / " + aLastBufferLen + " / " + aAccumulatedStr.substr(0, 20) 
            + " / " + aAccumulatedLen + " / " + aHttpStatusCode);

            }

            function Push_0_ResponseCB(
            aResponseHeadersStr,
            aResponseHeadersLen,
            aResponseBodyStr,
            aResponseBodyLen,
            aHttpStatusCode)
            {
            //Enter your implementation for ResponseCB() here.

            //TODO - To make the script wait for a specific response, use web_sync in the relevant Action file.
            //See the Modifying Callbacks section in the VuGen Help Center for more details.
            lr.outputMessage(">>> Push_0_ResponseCB " + aResponseHeadersStr.substr(0, 20) + " / " 
            + aResponseHeadersLen + " / " + aResponseBodyStr.substr(0, 20) + " / " 
            + aResponseBodyLen + " / " + aHttpStatusCode);

            }


            function Action()
            {

            web.regAsyncAttributes(
            {
            id: "Push_0",
            pattern: "Push",
            url: "http://myserver.abc.com/cgi-bin/nph-pushJS_FF.exe",
            //requestCB: =Push_0_RequestCB",
            responseHeadersCB:    'Push_0_ResponseHeadersCB',
            responseBodyBufferCB:
            function Push_0_ResponseBodyBufferCB(
            aLastBufferStr,
            aLastBufferLen,
            aAccumulatedStr,
            aAccumulatedLen,
            aHttpStatusCode)
            {
            //Enter your implementation for ResponseBodyBufferCB() here.
            lr.outputMessage(">>> Push_0_ResponseBodyBufferCB " + aLastBufferStr.substr(0, 20) 
            + " / " + aLastBufferLen + " / " + aAccumulatedStr.substr(0, 20) 
            + " / " + aAccumulatedLen + " / " + aHttpStatusCode);
            }
            });

            web.url(
            { 
            name: "push_to_iframe_new_object_FF.html",
            url: "http://myserver.abc.com/webgui/push/push_to_iframe_new_object_FF.html",
            resource: "0",
            recContentType: "text/html",
            snapshot: "t1.inf",
            mode: "HTML",
            });
        

            lr.thinkTime(30);
            web.stopAsync("Push_0");    

            return 1
            }