-
Notifications
You must be signed in to change notification settings - Fork 600
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Calling TagUI as a webservice / REST service #169
Comments
Hi @ramu-yarru thanks for your encouragement. Appreciate your trying out the webservice API feature and raising this question. The default folder to look for flow_filename is tagui/src folder. I've updated readme so that this information is clearer. Can you check the contents of tagui_service.log to see if the requests are being received? Is there any tagui_service.* files created that may show clues if the crontab job runs correctly? For returning response directly it is not enabled by design. In order to do something like that, PHP will need command line execution access, but this is not enabled by default and it is a security risk to enable something like that. Thus TagUI webservice is designed to run via crontab periodically instead of returning results immediately. One way to implement getting results fast is set crontab frequency to be high, and you can output results to some file that is accessible via web browser to check the result from your calling application. Some other ways canl be writing a PHP wrapper to actually use the exec() function to run tagui immediately and return the response. Lemme know if you run into any issues! Copying @Aussiroth and @lohvht for info. |
Hi @kensoh, thank you for the reply. I can see the following text in tagui_service.in and tagui_service.log files. No errors are recorded in these file except the below text. [1] ./tagui techforce chrome added into queue My actual requirement is, I need to invoke tagui flow from another program and based on the response returned by the flow, i need to decide which subsequent path to execute. Thats why I am trying to get immediate response from tagui webservice. As you suggested, let me set the crontab frequency to high and test it. I am curious to know about the alternative option (writing a PHP wrapper to actually use the exec() function) that you have suggested since it is more relevant to my use case as it returns immediate response. But unfortunately I have very basic knowledge on PHP, so could you please elaborate in detail on this option (like writing a PHP wrapper to use exec() function) Thanks, |
I see.. For instant results, see the example below (using this stackoverflow example) - service.php <?php
$out = array();
exec("tagui demo", $out);
foreach($out as $line) {
echo $line . "\n";
}
?> demo
when you run php service.php
|
Adding to above, you can then use quiet option to control the exact output of what you want to be returned. And proper PHP syntax such as below to receive parameters from your webservice URL - $service_settings = $_GET['SETTINGS']; For example, calling Closing the issue for now, but please keep your questions coming if you run into anything! Tagging @Aussiroth and @lohvht for info. |
Hi Ken, Thank you for the reply. As you suggested above, I am calling my TagUI flow by the following URL **<?php $service_settings = $_GET['SETTINGS']; ?>** Unfortunately, this is not working if I pass two parameters (for example: demo chrome) for SETTINGS in the URL. It perfectly works fine if I pass one parameter for SETTINGS. I even tried splitting the parameters into two variables using explode function, but that also didn't work for me. $service_settings variable PHP exec is not accepting more than one parameter. Could you please suggest here. Thanks, |
Hi @ramu-yarru when the settings has "" it may need to trim away, you can try using something like below to see if that works for filename + option(s) - <?php
$service_settings = $_GET['SETTINGS'];
$service_settings = trim($service_settings, '"');
$out = array();
exec('tagui'.' '.$service_settings, $out, $return_var);
if($return_var !== 0){
echo "failed";
}
else{
echo "passed";
}
?> Copying @Aussiroth @lohvht for info - |
Hi @kensoh, I can see the following text in tagui_service.log files. No errors are logged in these file except the below text. in service.php have added the below code : I am trying to invoke the tagui script in TC_CD_R001_1.txt file. Thanks, |
Hi Syed, thanks for the details. Can you check 2 things to see if they help?
Let me know how it goes! |
Hi Kensoh, Thanks for your reply. Thanks |
I see.. Try the following to see if there are more clues -
|
Hi Kensoh, The issue that am facing now is when i call the above API-1 , new chrome browser is launched and the test execution starts, simultaneously when i call above API-2 for another test case, new chrome browser is launched but the chrome browser launched by API-1 is closed without completing the test case execution. Thanks |
Hi Syed, I suspect you may not be using this as intended. From documentation, it is implemented with crontab to call tagui_crontab. This allows the service to add items into the queue using the tagui_service.php that comes with TagUI, to be executed on a periodic basis set in crontab - From documentation, https://github.com/kelaberetiv/TagUI#api By using the setup in above documentation, the service will check the queue to run only 1 instance at a time and not expected to run multiple automation processes at the same time. |
Hi,
Thank you for the wonderful tool.
I have one question regarding calling TagUI flow as a webservice or REST service. I have deployed the webservice on my webserver(XAMPP->Apache) and hitting the URL you mentioned in the documentation from my browser after including my flow file name in SETTINGS. I am getting the below message in my browser.
[6] ./tagui techforce added into queue
But my flow is not getting triggered. Note that I have set frequency of tagui chrontab to 5 minutes.
Where should I keep my flow file (path on file system) in order for the cron to trigger my flow?
Is there any way to get response from my flow file as a response to the API invocation? If so, could you please throw some light on how can we achieve this.
Thanks,
Ram
The text was updated successfully, but these errors were encountered: