DATA Step, Macro, Functions and more

Base SAS 9.4 TS 1M2 Rest Return HTTP Status 500 Error

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 17
Accepted Solution

Base SAS 9.4 TS 1M2 Rest Return HTTP Status 500 Error

[ Edited ]

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;


Accepted Solutions
Solution
‎06-21-2017 01:50 PM
SAS Super FREQ
Posts: 683

Re: Base SAS 9.4 TS 1M2 Rest Return HTTP Status 500 Error

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:

http://support.sas.com/documentation/cdl/en/wbsvcdg/64883/HTML/default/viewer.htm#n1wblekhip1yrln1fv...

 

Bruno

 

 

View solution in original post


All Replies
SAS Super FREQ
Posts: 683

Re: Base SAS 9.4 TS 1M2 Rest Return HTTP Status 500 Error

To call a Stored Process using REST, the URL has to look like:

http://hostSmiley Tongueort/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

Occasional Contributor
Posts: 17

Re: Base SAS 9.4 TS 1M2 Rest Return HTTP Status 500 Error

Hi Bruno,

 

I have set SASBIWS_path to SASBIWS_path = /SASBIWS/rest/storedProcesses and I still get the error.

SAS Super FREQ
Posts: 683

Re: Base SAS 9.4 TS 1M2 Rest Return HTTP Status 500 Error

Is your STP stored directly in the SAS Folder root?

 

Have a look at the following discussion, it contains a working example

https://communities.sas.com/t5/Administration-and-Deployment/REST-in-webservices-in-sas-9-4-m3/m-p/2...

 

 

 

Occasional Contributor
Posts: 17

Re: Base SAS 9.4 TS 1M2 Rest Return HTTP Status 500 Error

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.

Occasional Contributor
Posts: 17

Re: Base SAS 9.4 TS 1M2 Rest Return HTTP Status 500 Error

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.

 

SAS Super FREQ
Posts: 683

Re: Base SAS 9.4 TS 1M2 Rest Return HTTP Status 500 Error

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.

 

Occasional Contributor
Posts: 17

Re: Base SAS 9.4 TS 1M2 Rest Return HTTP Status 500 Error

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: +

SAS Super FREQ
Posts: 683

Re: Base SAS 9.4 TS 1M2 Rest Return HTTP Status 500 Error

You can use the %SYSEVALF function, it can deal with decimal numbers
Occasional Contributor
Posts: 17

Re: Base SAS 9.4 TS 1M2 Rest Return HTTP Status 500 Error

Hi Bruno,

 

I found your post from below URL and used the package which you provided then imported it in SAS Management Console.

https://communities.sas.com/t5/Administration-and-Deployment/REST-in-webservices-in-sas-9-4-m3/td-p/...

 

When I tried to call it with from the Store Process location, I got 302 error message.

 

STP.png

 

When I tried to call it with from Web Service location, I got 500 error message.

 

STP.png

 

Please help!

 

Thank you.

Solution
‎06-21-2017 01:50 PM
SAS Super FREQ
Posts: 683

Re: Base SAS 9.4 TS 1M2 Rest Return HTTP Status 500 Error

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:

http://support.sas.com/documentation/cdl/en/wbsvcdg/64883/HTML/default/viewer.htm#n1wblekhip1yrln1fv...

 

Bruno

 

 

Occasional Contributor
Posts: 17

Re: Base SAS 9.4 TS 1M2 Rest Return HTTP Status 500 Error

Thanks Bruno!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 11 replies
  • 150 views
  • 0 likes
  • 2 in conversation