How to call a SAS STP in background using proc http and http_tokenauth

别等时光非礼了梦想. 提交于 2020-08-27 22:06:28

问题


I'm trying to call a stored process (STP) from SAS via proc http using the option background, to ensure that my main process does not wait for the STP to be finished. I do use the following code:

filename resp "<path to response file>";
%let url = https://<ServerName>:<port>/SASStoredProcess/do;
%let question_mark = ?;

proc http
url="%str(&url.)&question_mark.%nrstr(_action=background&_program=<path to STP>&num1=11&num2=22)"
out=resp
http_tokenauth;
HEADERS "Content-Type"="application/x-www-form-urlencoded" "Accept"="application/json";
quit;

Unfortunately, in my response file I do always receive the SAS logon page.

Sending username/pw as part of my URL does work, but it is not wanted for security reasons. Hence I need to use http_tokenauth, which works for non background STPs. Also, when I just paste my URL to the browser, it does work.

How can I ensure it does also work using proc http and http_tokenauth?

Additional Information:

Setup:

I do have a STP which is called by a process engine via REST and expects an immediate answer containing an ID.(Main STP) This main STP then needs to call a sub STP containing a process, which will approx. take one hour to be finished. Hence I do not want the Main STP to wait for the sub STP to be finished. Therefore the sub STP should be called in background.


回答1:


You'd be better off using proc stp, although this does mean your process will run under your session (not the SAS General Servers) identity.

If you really want to call STPs as part of your workstream, why not create a web interface and call the services that way? The SASjs framework can help you there, and anything you build will be immediately portable to SAS Viya.



来源:https://stackoverflow.com/questions/63336796/how-to-call-a-sas-stp-in-background-using-proc-http-and-http-tokenauth

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!