Highlighted
Absent Member.
Absent Member.
3090 views

Save parameter from web_reg_async_attributes poll

Jump to solution

Hi!

In my business process I'm performing an activation. During the activation process the server is continuously polled to check whether the activation is completed. When the activation is completed the answer of the poll is:

 

<?xml version='1.0' encoding='UTF-8'?>
<partial-response><redirect url="activationDone"></redirect></partial-response>

 

Because the activation time differs I'm now running a for loop for a fixed amount of iterations before the browser is redirected.

 

This is not an optimal solution because it makes it difficult to measure the response time.

 

What I'd like to do is check the answer returned from the server (from the poll) and if the answer contains the "redirect url='activationDone'" string redirect the browser.

 

I've tried to use the web_reg_save_param-function but so far unsuccessfully.

 

I'm using the web_reg_async_attributes-function and it works perfectly and want to search in the ResponseBodyBuffer.

 

Best regards

Robert Fred

0 Likes
1 Solution

Accepted Solutions
Highlighted
New Member.

Hey,

 

If you are using Polling, i suggest to use the Response Callback, and not the Response Body Buffer Callback.

The Response Callback is called for each separate response, while the  Response Body Buffer Callback is called for each response buffer in the same response.

 

Instead of web_reg_save_param_*, which will not work in an async conversation callback, Try using lr_save_param_regexp:

 

lr_save_param_regexp (
        aResponseHeadersStr,
        aResponseHeadersLen,
        "RegExp=<Your regular expression>",

        "ResultParam=<Your parameter name>",
         LAST );

 

I hope this helps,

Oded Keret

View solution in original post

0 Likes
3 Replies
Highlighted
New Member.

Hey,

 

If you are using Polling, i suggest to use the Response Callback, and not the Response Body Buffer Callback.

The Response Callback is called for each separate response, while the  Response Body Buffer Callback is called for each response buffer in the same response.

 

Instead of web_reg_save_param_*, which will not work in an async conversation callback, Try using lr_save_param_regexp:

 

lr_save_param_regexp (
        aResponseHeadersStr,
        aResponseHeadersLen,
        "RegExp=<Your regular expression>",

        "ResultParam=<Your parameter name>",
         LAST );

 

I hope this helps,

Oded Keret

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

Hello!

Thank you for your help.

I used the lr_save_param_regexp, but with the aResponseBodyStr (activationDone appeared in the body). Then I used the web_sync-function to wait for the correct poll response. Also I put the RegExp expressions in bracket as follows:

 

lr_save_param_regexp(
        aResponseBodyStr,
        aResponseBodyLen,
         "RegExp=(activationDone)",
         "ResultParam=redirectURL",
        LAST);

 

Now the script works much better 🙂

 

Best Regards

Robert

0 Likes
Highlighted
Frequent Contributor.. Frequent Contributor..
Frequent Contributor..

Hi Robert,

 

Could you please share the code that was used by you? Itll be really helpful for me.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.