Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I'm trying to share a session between a browser and and the .NET SDK, so that selections are mirrored on both ends. I'm connetcing to a QlikSense server using a certificate, and o like this:
//Connect to QlikSense server
senseLocation.AsDirectConnection(
"myuserdir", //User directory
"administrator", //UserID (this user is RootAdmin)
false,
false,
x509coll //Certificate
);
var appIdentifier = ...
var senseSession = Session.WithApp(appIdentifier, SessionType.Default);
var appInstance = senseLocation.App(appIdentifier, senseSession);
then I'm applying some selections:
app.GetField("Foo").Select("Bar");
however, the selection does not get applyed on the broser side. And likewise, if I apply some selections using the browser they are not applied when querying data via the SDK.
EDIT: more precisely: sometimes nothing happens, other times the last lines causes this error on the client session:
Which translates more or less to:
An error occurred
Connection to the QlikSense engine failed due to unspecified reasons
Refresh your browser or contact a system administrator
What am I missing here?
Hi! FYI: There's another thread on a similar topic here: Re: Net SDK session shared with client
Hello,
I have exactly the same problem,
Any solution?
Thanks
This might not solve your problem, but it seems that you get the behavior you are looking for if you connect using NTLM through the proxy. So this configuration should make your SDK selections visible in the client:
senseLocation.AsNtlmUserViaProxy(); var appIdentifier = ... var senseSession = Session.WithApp(appIdentifier, SessionType.Default); var appInstance = senseLocation.App(appIdentifier, senseSession);
Thank you for your response.
But i have a time out error.
please see the attached image
the server is like this: "http://my-server.home.local:4747"
Thanks
You shouldn't include the port number if you want to go through the proxy. By adding the port 4747 you are directing the traffic directly to the engine instead.
Thank you so much
It works very well !!!
But, do you know why we cannot connect with AsDirectConnection() with a certificate?
My code is like this:
the server is like this: "http://my-server.home.local:4747"
I have not error of compilation neither execution:
But I cannot connect to the Engine.
Thanks
Have you checked your firewall settings? Perhaps the port is blocked?
Thank you again for your response.
To be sure that the port 4747 is Open, i turned off the firewall.
As you can see in the image bellow the port 4747 is open on my server
And I retried to connect from the server where Qlik Sense is installed (without certification) using the code bellow , but I have steel the same error:
private IApp ConnectWithDirectConnection(string server, string qlikSenseAppId)
{
IApp app = null;
var uri = new Uri(server);
ILocation location = Qlik.Engine.Location.FromUri(uri);
// Defining the location as a direct connection to Qlik Sense Server
location.AsDirectConnection(Environment.UserDomainName, Environment.UserName);
location.IsVersionCheckActive = false;
IAppIdentifier appId = location.AppWithIdOrDefault(qlikSenseAppId);
ISession session = Session.WithApp(appId, SessionType.Default);
IHub hub = LocationExtensions.Hub(location, session);
app = hub.OpenApp(appId.AppId);
app.GetField("Region").Select("Africa");
return app;
}
When I do not use 'session' ==> "IHub hub = LocationExtensions.Hub(location);" I do not have the error but when I make selections nothing happens in the application (app.GetField("Region").Select("Africa"); ==> no effect in UI)
I did some more research on this, and it looks like the system actively blocks you from connecting to a client session when you are using direct connection to the engine. It seems like there is some security mechanism in place that prevents it. If you try to access an active client session using direct connection, then the client will receive these messages on its web socket:
{"jsonrpc":"2.0","method":"OnClosed","params":{"qSessionState":"SESSION_ERROR_SECURITY_HEADER_CHANGED"}} {"jsonrpc":"2.0","method":"OnEngineWebsocketFailed","params":{"severity":"fatal","timestamp":"2019-03-28T13:55:10.9758005Z","message":"Connection to Qlik service failed, shutting down"}}
And you probably want to go through the proxy anyway when you connect to the client session as in a multi node system, you typically don't know which engine node the client session ends up on.