I'm trying: |
Trying against a test http page works fine: ALTER FUNCTION "DBA"."GetNSRData"() returns long varchar url 'http://help.websiteos.com/websiteos/example_of_a_simple_html_page.htm' And trying my https page without certificate gives: ERROR: SQL Anywhere Error -990: The secure connection to the remote host failed: A certificate file must be specified Trying with wrong certificate(changed 3 first letters) gives: ERROR: SQL Anywhere Error -990: The secure connection to the remote host failed: Error parsing certificate file, error code 545 So it looks like it gets past the certificate, but the error: ERROR: SQL Anywhere Error -983: HTTP request failed. Status code '<NONE>' Does not give me much to go on. And it fails without talking to our webserver... Ah, just found:
(09 Dec '20, 01:30)
Ove Halseth2
Replies hidden
1
You are using v12.0.1, which reached end of mainstream maintenance 4 years ago. The build you are using is almost five years old and contains an ancient build (by security standards) of OpenSSL. Have you considered testing on a supported version of SQL Anywhere? All the certificate issues you have been encountering appear to be resolved in v17.0.10. Reg
(09 Dec '20, 09:25)
Reg Domaratzki
This is the default behaviour unless you have specified a keep-alive timeout value using the KTIMEOUT (short form KTO) protocol-option-string.
(09 Dec '20, 09:31)
Reg Domaratzki
|
I found the solution in this thread: I had to use the root certificate.
So for my version of SQL Anywhere, this function works: Bah, but then it failed again when trying with the url I wanted to get data from: Where the certificate is the root certificate from data-nsr.udir.no exported as base64 the same way that worked for the test against our own webserver...
(09 Dec '20, 02:01)
Ove Halseth2
Replies hidden
With v17.0.10.6175, I do get here HTTP request failed. Status code '405 Method Not Allowed' SQLCODE=-983, ODBC 3 State="HY000" so this does not seem to be a certificate problem but a wrong URL or wrong HTTP method. Adding "TYPE 'HTTP:GET'" to the function's definition makes the call work for me and returns a JSON object (with data of a Norwegian school, methinks).
(09 Dec '20, 04:34)
Volker Barth
Yes, I'm after data on Norwegian schools :)
(09 Dec '20, 09:12)
Ove Halseth2
|
What version of SQL Anywhere is this being encountered? I do not get an error for this code sample.
The Select GetWebData() throws this error in V17...
Similar error in V16...
IMHO, the switch within v16 from Certicom (?) to OpenSSL and within v17 from OpenSSL to SAP's own crypt lib makes it difficult to state that a HTTPS web client call does work with v16/v17 generally... Been there, done that... :)
This is not the same error but do also have a look at that FAQ because of the HTTP version option.
Well this is odd, no error is reported in v17 if the function name used is different. I tested this as foo, foobar, and myproc and get a return value. Out of habit, I tested by altering an existing proc foo that I have in my test db. With GetWebData, I see the following:
There was an error reading the results of the SQL statement. The displayed results may be incorrect or incomplete. The specified certificate is not valid SQLCODE=-1588, ODBC 3 State="HY000"
It seems to be working fine for me. Select GetWebData() returns what looks to be the source of the page in German.
Reg
PS: Attempts at pasting HTML into my response have been removed.
It is version: dbsrv12 GA 12 0 1 3967 linux 2013/09/04 15:54:03 posix 64 production
Great! Or... I was hoping that it was something wrong with my statement, not something missing in my installation... What version are you testing on?
Oh, and it is just a dummy static page that i could easily find trace of it in our webserver log. And as long as I have been trying, nothing in our webserver log. But I think I found trace of your tries: nn.71.69.247 - - [08/Dec/2020:13:09:43 +0100] "POST /filer/fjernhjelp.html HTTP/1.0" 200 4311 "-" "SQLAnywhere"
And German is close, it's Norwegian :)
If you turn on webclient logging, what do you see in your log?
CALL sa_server_option( 'WebClientLogFile', '/home/sybase/db/wisweb/webclient.log' );
CALL sa_server_option( 'WebClientLogging', 'ON' );
FWIW, with 17.0.10.6175 the request from the original question does work for me, i.e. with the name "GetWebData()".
I was using version 17.0.10.6230 when I was able to successfully connect, and Volker was able to connect with 17.0.10.6175. Build 6230 will be the next Windows EBF posted shortly.