Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
michasiuk
Contributor III
Contributor III

Certificate Issue When trying to make a server connection using API's

I have bee trying to make to the Qlik Sense server using the engine API's with the following script. 

$computerPort = "4747"
$computerName = "Computer01"
$userDirectory = "Domain"
$userName = "UserName01"

add-type -path "D:\QlikNprinting\PowerShell\TypeLib\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll"
add-type -path "D:\QlikNprinting\PowerShell\TypeLib\QlikSense.NetSDK\lib\net452\Qlik.Engine.dll"
add-type -path "D:\QlikNprinting\PowerShell\TypeLib\QlikSense.NetSDK\lib\net452\Qlik.Sense.JsonRpc.dll"
add-type -path "D:\QlikNprinting\PowerShell\TypeLib\QlikSense.NetSDK\lib\net452\Qlik.Sense.Client.dll"


$uri = "wss://$($computerName):$($computerPort)"

Write-host "uri: $uri"

$location = [Qlik.Engine.Location]::FromUri($uri)

$location

[Qlik.Engine.LocationExtensions]::AsDirectConnection($location,$userDirectory,$userName)

# get the app's appIdentifier
$AppIdentifiers = [Qlik.Engine.LocationExtensions]::GetAppIdentifiers($Location)

For some reason getting the following error.

I not very knowledgeable with with the API's as of yet and am still learning so I am wondering how use the certificate in the script to connect to the Qlik Sense Server.

Exception calling "GetAppIdentifiers" with "1" argument(s): "Value cannot be null.
Parameter name: certificates"
At D:\QlikNprinting\PowerShell\Script\TestConnect.ps1:25 char:1
+ $AppIdentifiers = [Qlik.Engine.LocationExtensions]::GetAppIdentifiers($Location) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentNullException

1 Reply
michasiuk
Contributor III
Contributor III
Author

Changes the code again slightly to the following:

cls


#$ProxyUsesSSL = $true
$TrustAllCerts = $true

$computerPort = "4747"
$computerName = "epreapp029sa.application.enet"
$userDirectory = "ENETAPP"
$userName = "UserName01"

add-type -path "D:\QlikNprinting\PowerShell\TypeLib\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll"
add-type -path "D:\QlikNprinting\PowerShell\TypeLib\QlikSense.NetSDK\lib\net452\Qlik.Engine.dll"
add-type -path "D:\QlikNprinting\PowerShell\TypeLib\QlikSense.NetSDK\lib\net452\Qlik.Sense.JsonRpc.dll"
add-type -path "D:\QlikNprinting\PowerShell\TypeLib\QlikSense.NetSDK\lib\net452\Qlik.Sense.Client.dll"


$uri = "wss://$($computerName):$($computerPort)/app/"

Write-host "uri: $uri"

$location = [Qlik.Engine.Location]::FromUri($uri)

$location

[Qlik.Engine.LocationExtensions]::AsDirectConnection($location,$userDirectory,$userName,$TrustAllCerts)

# get the app's appIdentifier
$AppIdentifiers = [Qlik.Engine.LocationExtensions]::GetAppIdentifiers($Location)

and got the following error message:

uri: wss://epreapp029sa.application.enet:4747/app/


VirtualProxyPath :
SessionCookie :
CustomUserCookies : {}
CustomUserHeaders : {}
CustomUserUrlParameters : {}
ServerUri : wss://epreapp029sa.application.enet:4747/app/

Exception calling "GetAppIdentifiers" with "1" argument(s): "Value cannot be
null.
Parameter name: certificates"
At D:\QlikNprinting\PowerShell\Script\TestConnect.ps1:29 char:1

+ $AppIdentifiers =
[Qlik.Engine.LocationExtensions]::GetAppIdentifiers($Location) ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~

+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException

+ FullyQualifiedErrorId : ArgumentNullException