Re: Dyanmic number of requests within a web_concurrent_start (end) (479 Views)
Reply
Frequent Advisor
Dan_J_Corey
Posts: 58
Registered: ‎04-16-2013
Message 1 of 7 (546 Views)

Dyanmic number of requests within a web_concurrent_start (end)

[ Edited ]

I'm using 11.52 patch 1 web protocol

 

I need to grab pictures of a random customer's puchases.  Some customers have zero on record purchases, some customers purchase hundreds of items.  When the browser requests these pictures, it does so in at the same time (i.e. a web concurrent request).  

 

Any tips on how I can create simulataneous requests of n number of pictures?  Obviously, I can easily correlate the pictures I'm being sent and put them into a for loop to grab every one of them but that doesn't account for concurrency.  

 

I'm hoping there's a function call I'm not aware of that makes this kind of thing nice and easy.  Otherwise, I suppose I might be able construct an eloborate web_custom_request (or series of requests), but it seems like there should be a good way to do this kind of thing.  

Please use plain text.
HP Expert
Editus
Posts: 639
Registered: ‎04-06-2011
Message 2 of 7 (507 Views)

Re: Dyanmic number of requests within a web_concurrent_start (end)

Hello

I dont really understand your goal, but yes you can do it using the function web_concurrent_start, then after this add all the calls or functions to get the pictures and then add web_concurrent_end, what ever is between web_concurrent_start and web_concurrent_end will be executed simultaneously.

 

Check on function reference for additional details.

 

hope this helps

 

regards

Please use plain text.
Frequent Advisor
Dan_J_Corey
Posts: 58
Registered: ‎04-16-2013
Message 3 of 7 (504 Views)

Re: Dyanmic number of requests within a web_concurrent_start (end)

Thank you for your response.  Sorry, maybe I could've been clearer.  I'm aware of the web_concurrent_start and web_concurrent_end functions.  What I need is to have a dynamic number of calls within the that call.  

 

For example:

Customer 1 has bought four items.  

web_concurrent_start

picture 1 (item a) 

picture 2 (item b)

picture 3 (item c)

picture 4 (item d)

web_concurrent_end

--- iteration ends, new customer

Customer 2 has bought two items.  

web_concurrent_start

picture 1 (item e) 

picture 2 (item f)

web_concurrent_end

--- iteration ends, new customer

Customer 3 has bought six items.  

web_concurrent_start

picture 1 (item g) 

picture 2 (item h)

picture 3 (item i)

picture 4 (item j)

picture 5 (item k)

picture 6 (item l)

web_concurrent_end

---

 

How can I get a variable number of requests sent within a web_concurrent_start block?  

Please use plain text.
HP Expert
Editus
Posts: 639
Registered: ‎04-06-2011
Message 4 of 7 (495 Views)

Re: Dyanmic number of requests within a web_concurrent_start (end)

ok I got the idea, I would need to know more and see one script to give someting more specific but here is my idea.

Lets say there is a maximum of 10 pictures you will need, all the uses will purchase 10 articles or less, so you create inside the web_concurrent block the 10 requests for getting 10 pictures, each request will evaluate using a If statement if there is need for that picture or not, since you know how many itemd each user got you simply parametize that part, in example, user AAAA purchased 7 items, so you paramtetrize the user name and the 10 picture names, but the last 3 pictures will be called 0000.jpg in the parameter value, so the if will evaluate if the name is or not 0000.jpg before execute the statement to call the picture, not sure if you get the idea.

 

maybe if you share more details about the info you will have in advance, and how the function that call those pictures looks like and the picture name format or something that helps to understand better how far we can get using custom code.

 

 

regards

Please use plain text.
Frequent Advisor
Dan_J_Corey
Posts: 58
Registered: ‎04-16-2013
Message 5 of 7 (487 Views)

Re: Dyanmic number of requests within a web_concurrent_start (end)

Thank you for the response.  I was thinking of the same approach but there can be hundreds of pictures or zero pictures, so I'd have to create hundreds of (usually unused) web requests to accomodate this kind of thing.  The programmer in me sees this kind of approach as less than great, but I suppose I'll have to deal with it.  

 

I'll give this some more thought and research and post here if I come up with a good solution.  

Please use plain text.
HP Expert
Editus
Posts: 639
Registered: ‎04-06-2011
Message 6 of 7 (484 Views)

Re: Dyanmic number of requests within a web_concurrent_start (end)

Can you please share one or two functions for calling those pictures, I would like to try to find out a recursive code for doing this.

regards
Please use plain text.
Frequent Advisor
Dan_J_Corey
Posts: 58
Registered: ‎04-16-2013
Message 7 of 7 (479 Views)

Re: Dyanmic number of requests within a web_concurrent_start (end)

It's just a simple web_url call

 

     web_url("womens.jpg"
        "URL=http://<hostname>/womens.jpg"
        "TargetFrame="
        "Resource=1"
        "RecContentType=image/jpeg"
        "Referer=http://<hostname>/Search.html"
        "Snapshot=t93.inf"
        LAST);

    web_url("pants.jpg"
        "URL=http://<hostname>/images/pants.jpg"
        "TargetFrame="
        "Resource=1"
        "RecContentType=image/jpeg"
        "Referer=http://<hostname>/Search.html"
        "Snapshot=t94.inf"
        LAST);

    web_url("6487221274360_180x240.jpg"
        "URL=http://<hostname>/<webservice>/6487221274360_180x240.jpg"
        "TargetFrame="
        "Resource=1"
        "RecContentType=image/jpeg"
        "Referer=http://{server}/Search.html"
        "Snapshot=t95.inf"
        LAST);

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation