Hi All,
I am not sure why Rest would return "HTTP Status 500 - Request processing failed; nested exception is java.lang.NullPointerException". Below is the code. Does anyone has any ideas? Thank you for your input.
%let hostName = domain ;
%let SASBIWS_path = /SASRest;
%let stpName = /getCrmDetails_APP ;
filename htin temp;
data _null_;
infile cards;
input;
file htin;
put _infile_;
cards4;
<getCrmDetails_APP>
<parameters>
<contact_id>880468EE</contact_id>
</parameters>
</getCrmDetails_APP>
;;;;
FILENAME htout "C:\Users\me\Desktop\temp\response.xml";
proc http
method="post"
URL="http://&hostName.&SASBIWS_path.&stpName"
in=htin
out=htout
ct="application/xml"
verbose
;
run;
Your path should look like this:
/SASBIWS/rest/storedProcesses/EOT4MAC/stp_02_ws
Where
Red is the base name to call the stored process passing the parameters as XML, like in your first screenshot
In blue is the full pathname to the stored process
Have a look at the doc here:
Bruno
To call a Stored Process using REST, the URL has to look like:
http://host:port/SASBIWS/rest/storedProcesses/stp_path
where stp_path is the full name your STP including any SAS folder names.
So your macro var SASBIWS_path should set to /SASBIWS/rest/storedProcesses
Hi Bruno,
I have set SASBIWS_path to SASBIWS_path = /SASBIWS/rest/storedProcesses and I still get the error.
Is your STP stored directly in the SAS Folder root?
Have a look at the following discussion, it contains a working example
Hi Bruno,
No, my STP is not stored directly in SAS Folder root. How do I find a full qualify path for the STP? Sorry, I am very new to SAS.
Thank you for your help.
Hi Bruno,
I was able to figure out the path, and able to make the call successfully.
My Store Process has int1=3 and int2=8 parameter. Under Execution tab, I put the below code for source file, so when the Rest end point get called, does these codes get executed?
%global int1 int2 ;
*ProcessBody;
%let Sum = %eval(&int1 + &int2);
run;
Thank you.
Yes, this code gets executed.
You do not need the RUN; statement, as you are only using macro statements.
I assume the macro variable SUM is defined as an output parameter.
Please note, that the %EVAL function will only work with integer values.
Hi Bruno,
Thank you for your reply.
Yes, my parameters are (Numeric) interger. However, I still get the below error for some reasons.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: +
Hi Bruno,
I found your post from below URL and used the package which you provided then imported it in SAS Management Console.
When I tried to call it with from the Store Process location, I got 302 error message.
When I tried to call it with from Web Service location, I got 500 error message.
Please help!
Thank you.
Your path should look like this:
/SASBIWS/rest/storedProcesses/EOT4MAC/stp_02_ws
Where
Red is the base name to call the stored process passing the parameters as XML, like in your first screenshot
In blue is the full pathname to the stored process
Have a look at the doc here:
Bruno
Thanks Bruno!
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.