BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Criptic
Lapis Lazuli | Level 10

Hey 🙂

I'm trying to query the Wikipedia-API and I get the following Error: SSL Error: Missing CA trust list.

 

I tried with adding perm file via the options (options set= SSLCALISTLOC="/path_to_file/cacert-2017-06-07.pem"; I got the pem-file from here: https://curl.haxx.se/docs/caextract.html

 

My code looks like this:

options set= SSLCALISTLOC="path_to_file/cacert-2017-06-07.pem";
filename resp 'path_to_file/aaa.txt';

proc http
	url="https://en.wikipedia.org/w/api.php?action=query&titles=Main%20Page&prop=revisions&rvprop=content&format=json"
	out=resp
	method='GET'
	proxyhost="10.120.11.11"
	proxyport=8080;
run;

If I'm using a HTTP site everything works like a charm, the error only occurs with https.

 

I'm currently on SAS 9.4 M2 - can somebody please give me pointers.

 

Thanks in advance

David

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

Hi @Criptic,

 

Try changing your syntax to remove the SET= part:

 

options SSLCALISTLOC="path_to_file/cacert-2017-06-07.pem";

If your SAS session makes use of other SSL interactions, making this change could affect those other operations.  The list of certs and behavior depends on whether you are using SAS 9.4 m1 or m2, or m3/m4. See the doc for this option.

 

There is another option, SSLCACERTDIR Environment Variable, that allows you to "inject" a cert path into your session.  See that topic for a full description of the precendence list for SSL certs.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

View solution in original post

4 REPLIES 4
ChrisHemedinger
Community Manager

Sounds like a cool project! I've been meaning to look into something similar with Wikipedia.  Thanks for the nudge.

 

Looks like you might not have everything quite right with the TLS requirements.  Can you try with a simple "echo" service from httpbin.org? That's a great way to test that your program "plumbing" is working before complicating things with the actual site you want data from.

 

%macro echoResp(fn=);
    %global _respFilesize;
	data _null_;
		infile &fn;
		input;
		put _infile_;
	run;
%mend;

filename out temp;
filename input TEMP;
filename headout temp;

data _null_;
   file input;
   put "this is some sample text";
run;

proc http 
   url="https://httpbin.org/post"
   in=input
   out=out
   headerout=headout;
run;

%put Headers Out:;
%echoResp(fn=headout);

%put Response:;
%echoResp(fn=out);

My log:

 

Headers Out:
59         %echoResp(fn=headout);

NOTE: The infile HEADOUT is:
      Filename=#LN00106,
      RECFM=V,LRECL=32767,File Size (bytes)=302,
      Last Modified=30Jun2017:08:47:16,
      Create Time=30Jun2017:08:47:16

HTTP/1.1 200 OK
Connection: keep-alive
Server: meinheld/0.6.1
Date: Fri, 30 Jun 2017 12:47:17 GMT
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
X-Powered-By: Flask
X-Processed-Time: 0.00111889839172
Content-Length: 404
Via: 1.1 vegur
NOTE: 12 records were read from the infile HEADOUT.
      The minimum record length was 0.
      The maximum record length was 38.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

60         
61         %put Response:;
Response:
62         %echoResp(fn=out);

NOTE: The infile OUT is:
      Filename=#LN00104,
      RECFM=V,LRECL=32767,File Size (bytes)=404,
      Last Modified=30Jun2017:08:47:16,
      Create Time=30Jun2017:08:47:16

{
  "args": {}, 
  "data": "", 
  "files": {}, 
  "form": {
    "this is some sample text\r\n": ""
  }, 
  "headers": {
    "Accept": "*/*", 
    "Connection": "close", 
    "Content-Length": "26", 
    "Content-Type": "application/x-www-form-urlencoded", 
    "Host": "httpbin.org", 
    "User-Agent": "SAS/9"
  }, 
  "json": null, 
  "origin": "104.x.x.x", 
  "url": "https://httpbin.org/post"
}
NOTE: 19 records were read from the infile OUT.
      The minimum record length was 1.
      The maximum record length was 57.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

 

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Criptic
Lapis Lazuli | Level 10

Thank you for your reply. I tried your suggestions but I still get the same error: SSL Error: Missing CA trust list. Do you have any further suggestions or ideas?

ChrisHemedinger
Community Manager

Hi @Criptic,

 

Try changing your syntax to remove the SET= part:

 

options SSLCALISTLOC="path_to_file/cacert-2017-06-07.pem";

If your SAS session makes use of other SSL interactions, making this change could affect those other operations.  The list of certs and behavior depends on whether you are using SAS 9.4 m1 or m2, or m3/m4. See the doc for this option.

 

There is another option, SSLCACERTDIR Environment Variable, that allows you to "inject" a cert path into your session.  See that topic for a full description of the precendence list for SSL certs.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Criptic
Lapis Lazuli | Level 10

This documentation was exactly what I needed, thank you!

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

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.

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
  • 4 replies
  • 1882 views
  • 3 likes
  • 2 in conversation