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

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;

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

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

11 REPLIES 11
BrunoMueller
SAS Super FREQ

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

Mixer
Obsidian | Level 7

Hi Bruno,

 

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

BrunoMueller
SAS Super FREQ

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...

 

 

 

Mixer
Obsidian | Level 7

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.

Mixer
Obsidian | Level 7

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.

 

BrunoMueller
SAS Super FREQ

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.

 

Mixer
Obsidian | Level 7

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

BrunoMueller
SAS Super FREQ
You can use the %SYSEVALF function, it can deal with decimal numbers
Mixer
Obsidian | Level 7

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.

BrunoMueller
SAS Super FREQ

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

 

 

Mixer
Obsidian | Level 7

Thanks Bruno!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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