BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Crysis85
Obsidian | Level 7

Hello,

 

I'm starting to figure out how to leverage stored processes exposed as web services. I'm starting to test Stored Processes with a PROC HTTP.

 

The code for the SP is this

%global wsRC wsValue wsMsg returnString;

%let wsMsg = someDate=&someDate;

%macro runCode;
  proc sql noprint;
select &statName( &columnName ) into :wsValue trimmed from &tableName ; quit; %if &sqlrc = 0 %then %do; %let wsrc=&sqlrc; %end; %else %do; %let wsrc=&sqlrc; %let wsMsg = ERROR: &syserrortext; %let wsValue = .; %let syscc = 0; %end; %mend; %runCode

The PROC HTTP that uses this Stored Process is this

%let hostName = 192.168.1.61;
%let port = 7980;
%let SASBIWS_path = /SASBIWS/rest/storedProcesses;
%let stpName = /SAS Validation/SAS Stored Procedures/stp_02_ws;

*
* build parm list for REST XML request
*;
filename htin temp;
data _null_;
  infile cards;
  input;
  file htin;
  put _infile_;
cards4;
<any>
<parameters>
<tableName>sashelp.cars</tableName>
<columnName>invoice</columnName>
<statName>MEAN</statName>
<someDate>2016-01-17</someDate>
</parameters>
</any>
;;;;


*
* call STP as REST WS
*;
filename htout "/home/lasradm/Test/rest_test";
proc http
  method="POST"
  URL="http://&hostName:&port.&SASBIWS_path.&stpName"
  in=htin
  out=htout
  ct="application/xml"
  WEBUSERNAME="lasradm"
  WEBPASSWORD="sas"
 	
  verbose
  ;
run;

*
* display result
*;
data _null_;
  infile htout;
  input;
  putlog _infile_;
run;

filename htin clear;
filename htout clear;

This works fine, on the log I can see the result embedded in XML code.

Now I tryed to write a similar program passing different parameters to the SP. Didn't work. I restrict the problem on the library. As long as I use SASHELP it works. If I use a library defined by me (with all the permissions) it gives this generic error

 

HTTP Status 500 - Request processing failed; nested exception is com.
sas.web.services.WSException: SAS completed with nonzero SYSCC '1,012'.  SYSMSG: ''

Can't figure out where the problem lies.

I'm using SAS 9.4

 

edit: I found this code on this topic https://communities.sas.com/t5/Administration-and-Deployment/REST-in-webservices-in-sas-9-4-m3/td-p/...

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

Hi

 

The error handling within the STP should return the proper error message. However it looks like you can not reset the SYSCC macro var.

 

Have a look here http://support.sas.com/kb/56/197.html and check whether the necessary hotfix is applied.

 

Bruno

View solution in original post

5 REPLIES 5
Kurt_Bremser
Super User

SASHELP is the same for all users under all circumstances. Another library may be defined in metadata, but if the user running the STP server has no access to the directory or if there is a metadata permission problem, that library will not work.

Crysis85
Obsidian | Level 7
I figured that, I gave all permissions to the folder that library is pointing to, I gave all permissions to the library itself in the management console. Still the same error, another suggestion on how can I solve this?
Kurt_Bremser
Super User

For which user did you set permissions on the physical directory? The OS user running the STP server (usually sassrv) needs the permissions, not the user with which you call the STP. That one needs mostly metadata permissions.

BrunoMueller
SAS Super FREQ

Hi

 

The error handling within the STP should return the proper error message. However it looks like you can not reset the SYSCC macro var.

 

Have a look here http://support.sas.com/kb/56/197.html and check whether the necessary hotfix is applied.

 

Bruno

Crysis85
Obsidian | Level 7

Thanks, installing the hotfix resolved the problem.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 4384 views
  • 1 like
  • 3 in conversation