Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a .NET MVC web application that requires SSL. I am able to successfully access the Proxy Service to obtain a session ID and store it in my forms authentication cookie to allow for single sign-on. I am able to display a specific app or sheet within an iframe by simply specifying the URL. Instead of hard-coding the GUIDs for the apps and sheets, I would like to use the Repository Service to get a list of available apps and sheets. Whenever I call qrs/virtualproxy/app/hublist, I get the html for the login screen returned. I have tried adding various headers, but can't seem to find the right combination. Here's my code:
public string GetAppList(string method, string server, string virtualProxy, string user, string userdirectory, HttpCookie session) { string url = server + "/qrs/" + virtualProxy + "/app/hublist";
//Create the HTTP Request and add required headers and content in Xrfkey string Xrfkey = "0123456789abcdef"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url + "?Xrfkey=" + Xrfkey); request.Method = method; request.Accept = "application/json"; request.ContentType = "application/json"; request.Headers.Add("X-Qlik-Xrfkey", Xrfkey); request.Headers.Add("X-Qlik-User", "UserDirectory=" + userdirectory + ";UserId=" + user); request.Headers.Add("X-Qlik-Virtual-Proxy-Prefix", virtualProxy);
// 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; }
Basically, I want the call to work like the .NET SDK command location.AsExistingSessionViaProxy(sessionCookie.Value, sessionCookie.Name). Is this possible?
Thanks.
I could not use the SDK because the does not expose all of the properties we needed. See .NET SDK app properties.
Sorry, I do not have any experience with SMSESSION.
Hi Elva,
U had mentioned you were able to extract the SMSESSION. Could you please help me on how did you do this in QlikView? You used any macro codes for this?
Also after fetching the SMSESSION, what is the approach to use it as a Header in calling a Web Service?
Regards!
Sorry, Dicky.
I did not extract SMSESSION. I did extract all of the session cookies for Qlik Sense in my MVC .NET code as documented above. I have never used SMSESSION.
Elva
Not a problem Elva. Thanks for suggesting,
Do you have any other suggestions just to kick off my requirement in QlikView?
if not SMSESSION, any help on how to pass the X-API-KEY as a header to call the URL (HTTP Request)
Regards!
The one thing I would try would be something like:
request.Headers.Add("X-Qlik-Xrfkey", Xrfkey);
where you substitute the literal X-API-KEY for the first parm (enclosed in quotes) and the value as the second parm.
Good luck!
Hi elva.lester,
a bit novice here.
Could you please help a more on how to use the script if I have the URL to pass the header into? Something like, once called from a button click, where can I validate the results too.
I have also created a separate thread for this, if you want to help out there -
Generate a user specific SMSESSION cookie calling a WebService
Regards!