Hi all,
I am new to call REST web services from SAS. I have written below code to call it using some papers. I aim to get session_id however it gives me following log and cannot get session id. Can you help me to call it successfully? It is okay to put result into SAS dataset so that I can use session_id for other requests. Also added REST request used in SOAPUI. Thanks!
-----------------------------BEGIN REQUEST CODE----------------------
*** FILENAME and URL will call REST;
%let user=sasdemo;
%let password=SASpwd1;
filename price url 'http://kkbcsd00:8080/SASWIPClientAccess/rest/sessions?userid=&user.&password=&password.' debug;
data price;
infile price length=len;
input record $varying200. len;
run;
-----------------------------END REQUEST CODE----------------------
---------------------------LOG---------------------------------
NOTE: >>> GET /SASWIPClientAccess/rest/sessions?userid=sasdemo&password=SASpwd1 HTTP/1.0
NOTE: >>> Host: kkbcsd00:8080
NOTE: >>> Accept: */*.
NOTE: >>> Accept-Language: en
NOTE: >>> Accept-Charset: iso-8859-1,*,utf-8
NOTE: >>> User-Agent: SAS/URL
NOTE: >>>
NOTE: <<< HTTP/1.1 405 Method Not Allowed
NOTE: <<< Server: Apache-Coyote/1.1
NOTE: <<< X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1
NOTE: <<< Set-Cookie: JSESSIONID.SASServer1=59EA70C2F4EA3D813AD13A41079DAB95; Path=/
NOTE: <<< Allow: POST
NOTE: <<< Content-Type: text/html;charset=utf-8
NOTE: <<< Content-Length: 1098
NOTE: <<< Date: Wed, 12 Aug 2015 13:32:28 GMT
NOTE: <<< Connection: close
NOTE: <<<
ERROR: Invalid reply received from the HTTP server. Use the debug option for more info.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.PRICE may be incomplete. When this step was stopped there were 0 observations and 1 variables.
WARNING: Data set WORK.PRICE was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
---------------------REQUEST FROM SOAPUI-----------
<?xml version="1.0" encoding="UTF-8"?>
<credentials>
<userid>sasdemo</userid>
<password>SASpwd1</password>
</credentials>
Not sure if it could work out .
1) check proc http
2) check DS2 package of HTTP
Hi Xia,
I have tried with proc http, however it did not work as well. but i didn't understand what you mean by your second advice?
OH, There is a PROC DS2 . It is added from SAS9.4 . And In it there is a http package also can do PROC HTTP work.
Chack its documentation.Not sure if it could work.
Xia Keshan
Xia, the environment is SAS9.3 unfortunately
Do you have any idea about the error I get in the code?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.