Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have implemented the Qlik Sense session API . i have followed the instruction given in this video : https://www.youtube.com/watch?v=MpC2h5y2NRE .
1. Created the Virtual Proxy in my QlikSense Server .
2. Created certificate and imported in the Server.(in Personal).
3. I would like to paste my code here for your view .
// First locate the Qlik Sense certificate
X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadOnly);
certificateFoo = store.Certificates.Cast<X509Certificate2>().FirstOrDefault(c => c.FriendlyName == "QlikClient");
store.Close();
//The following line is required because the root certificate for the above server certificate is self-signed.
//Using a certificate from a trusted root certificate authority will allow this line to be removed.
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
//Create URL to REST endpoint for tickets
string url = server + "/qps/session"; //" + virtualProxy + "/
//Create the HTTP Request and add required headers and content in Xrfkey
string Xrfkey = "0123456789abcdef";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url + "?Xrfkey=" + Xrfkey);
request.ClientCertificates.Add(certificateFoo);
request.Method = method;
request.Accept = "application/json";
request.Headers.Add("X-Qlik-Xrfkey", Xrfkey);
request.CookieContainer = cookiesContainer;
//The body message sent to the Qlik Sense Proxy api will add the session to Qlik Sense for authentication
string body = "{ 'UserId':'" + user + "','UserDirectory':'" + userdirectory + "',";
body += "'Attributes': [],";
body += "'SessionId': '" + txtSession.Text + "'";
body += "}";
byte[] bodyBytes = Encoding.UTF8.GetBytes(body);
if (!string.IsNullOrEmpty(body))
{
request.ContentType = "application/json";
request.ContentLength = bodyBytes.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(bodyBytes, 0, bodyBytes.Length);
requestStream.Close();
}
// make the web request and return the content
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream stream = response.GetResponseStream();
return stream != null ? new StreamReader(stream).ReadToEnd() : string.Empty;
I am facing issues like ,
1. Certificate comes as Null , it throws Error .
2. The remote server returned an error: (404) Not Found. I am not able to create a session in this .
I have hosted my application with the separate domain in my server , do i need to work with IIS for any configuration ??
Thanks for your support.
Hello @Aro raj !
Have you solved your issue with 404 Error when trying to make request to Qlik Sense virtual proxy?
I got the same problem...
i am facing same problem since two days . i am trying to generate ticket through .net but when i call TicketRequest() function it returns "The remote server returned an error: (404) Not Found." .