Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
When trying to run load script in Qlik Sense using REST connection to NPrinting (using NTLM authentication) you get the below error message:
The following error occurred:
HTTP protocol error 403 (Forbidden):
The server refused to fulfill the request.
Qlik Sense September 2020 Patch 2 and later versions
R&D released a permanent fix for this issue which is included in Qlik Sense September 2020 Patch 2,
However, in the load script, you must still replace
let vCookieRaw = Peek('Set-Cookie',0,'_response_header'); let vCookie = TextBetween('$(vCookieRaw)','Secure,','Path=/',2);
with
Let vCookieRaw = Peek('Set-Cookie',0,'cookie_items'); Let vCookie = TextBetween(vCookieRaw,'SameSite=None,',' Path=/',SubStringCount(vCookieRaw,'SameSite=None')-1);
Workaround Qlik Sense June 2020
If using Qlik Sense June 2020 and cannot perform an upgrade but a file can be replaced.
NOTE: Please backup existing folder before proceeding below
Download the file attached on this article (below: qvrestconnector-enterprise.zip), unzip it and
1. Replace existing QvRestConnector folder content on the driver with this files.
The QvRestConnector folder is located in:
C:\Program Files\Common Files\Qlik\Custom Data\QvRestConnector
2. Replace the following
let vCookieRaw = Peek('Set-Cookie',0,'_response_header'); let vCookie = TextBetween('$(vCookieRaw)','Secure,','Path=/',2);
with*
//Extracts session cookie from the API response Let vCookieRaw = Peek('Set-Cookie',0,'cookie_items'); Let vCookie = TextBetween(vCookieRaw,'SameSite=None,',' Path=/',SubStringCount(vCookieRaw,'SameSite=None')-1);
*For some cases:
A request to NP returns one or more Set-Cookie headers that are parsed in the connector code. The value of the header is a list of semicolon separated key-value pairs. In case of multiple values with the same key, the last one should be used.
The sample load script extracts the key-value pair with NPWEBCONSOLE_SESSION as key. Then you could use the Sense string functions to achieve this result in a way that would work also in case of future changes to the cookies:
let session = TextBetween(vCookieRaw, 'NPWEBCONSOLE_SESSION', '; ', SubStringCount(vCookieRaw, 'NPWEBCONSOLE_SESSION'));
let vCookie = 'NPWEBCONSOLE_SESSION'&session&';';
Example of the key value pair (ending with semicolon) to extract:
NPWEBCONSOLE_SESSION=5d7ff2747
Do we need to stop engine service for replacing the connector. We recently upgraded Sense from Apr 2019 to June 2020 and facing this issue. The connector available here, didn't work for me, it failed data reload tasks for monitoring apps as well.
Pl let me now if I am missing something.
Thanks for your help.
Digvijay
Please take a look to https://community.qlik.com/t5/Qlik-NPrinting-Discussions/Nprinting-REST-API-broke-after-June-2020-up... also.
Maybe you need to add the extra header too.
You said that the RnD crew permanent fix the issue on 2020 but I'm getting the same error on May 2024 Patch 3. Not the same application that is related to NPrinting but the error is occured from the same source.
SaaS Readiness App:
HTTP protocol error 403 (Forbidden):
The server refused to fulfill the request.
RestConnectorMasterTable:
SQL SELECT
"contentHash",
"senseId",
"originalClassName",
"version",
"deploymentType",
"releaseLabel",
"deprecatedProductVersion",
"productName",
"copyrightYearRange"
FROM JSON (wrap on) "root"
WITH CONNECTION(
URL "https://centralservername/api/about/v1/systeminfo",
QUERY "xrfkey" "abcdefg123456789",
HTTPHEADER "X-Qlik-Xrfkey" "abcdefg123456789",
HTTPHEADER "User-Agent" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36"
)
It's occured because of the `WITH CONNECTION` side. Because I'm successfully getting data without `WITH CONNECTION`. Also I'm successfully go to `https://centralservername/api/about/v1/systeminfo` address. I tried on localhost but the result was same.
I tried to replace RestConnector files with zip file that you uploaded then I tried again but there isn't any difference. You said that I should replace the Cookie things but there isn't any cookie variable as I said the app is SaaS Readiness default app.
Is there any suggestion for this issue on May 2024 Patch 3?
Best regards,
Ramazan
Hello @ramazanerduran
As this particular issue is resolved, we are likely looking at a different root cause or different iteration of a similar problem. Please log a support ticket to have this properly investigated.
All the best,
Sonja