davidvilla
Member
Hi,
I have a async web service call and a internal procedure to process the response.
In the above sample code, the async call issues requests and the event proc pExportResponse exports the response. But once all 500 requests are issued, the program terminates. I need to wait for all the 500 responses even though there are no more requests to be issued.
The WAIT-FOR statement above didn't help. If I put the WAIT-FOR within the i = 1 to 500 loop after each PROCESS EVENTS stmt, then the each request is waiting for the previous response to be processed. So that is not async. I may be messing up with the WAIT-FOR.
Kindly advise.
I have a async web service call and a internal procedure to process the response.
Code:
DO i = 1 TO 500:
RUN <WSmethod> IN <WebService> ASYNCHRONOUS SET hProc
EVENT-PROCEDURE "pExportResponse" (INPUT Ip1, OUTPUT Op1) NO-ERROR.
PROCESS EVENTS.
END.
WAIT-FOR PROCEDURE-COMPLETE OF hProc.
<Delete and disconnect block >
PROCEDURE pExportResponse:
DEFINE INPUT PARAMETER Op1 AS LONGCHAR NO-UNDO.
IF SELF = hproc THEN
DO:
EXPORT STREAM mystream "response-->" .
EXPORT STREAM mystream Op1.
END.
END.
In the above sample code, the async call issues requests and the event proc pExportResponse exports the response. But once all 500 requests are issued, the program terminates. I need to wait for all the 500 responses even though there are no more requests to be issued.
The WAIT-FOR statement above didn't help. If I put the WAIT-FOR within the i = 1 to 500 loop after each PROCESS EVENTS stmt, then the each request is waiting for the previous response to be processed. So that is not async. I may be messing up with the WAIT-FOR.
Kindly advise.