Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to write a PowerShell script that will call the QMS API and give me a list of all user documents on the Qlikview server.
My current script is giving me the following error:
System.NullReferenceException: Object reference not set to an instance of an object.
What am I missing in the body of the requset?
$url = "http://server-name:4799/QMS/Service"
#Obtain serice key
$service = New-WebServiceProxy -Uri $url -Namespace QlikViewServer -UseDefaultCredential
$serviceKey = $service.GetTimeLimitedServiceKey()
#GetUserDocuments
$hdrs = @{}
$hdrs.Add("SOAPACTION","http://ws.qliktech.com/QMS/12/2/IQMS2/GetUserDocuments")
$hdrs.Add("Content-Type", "text/xml;charset=utf-8")
$hdrs.Add('X-Service-Key',$serviceKey)
$body = @{}
$body = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetUserDocuments xmlns="http://ws.qliktech.com/QMS/12/2/">
<guid>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</guid>
</GetUserDocuments>
</s:Body>
</s:Envelope>'
$res = Invoke-WebRequest -Uri $url -Method Post -Body $body -UseDefaultCredential -Headers $hdrs
[xml]$myXml = $res.Content
I found the issue with my script.
In the body where I am passing the GUID I was not using the proper name.
Instead of <guid> it should be <qvsID>.
With that change the script works correctly.
I found the issue with my script.
In the body where I am passing the GUID I was not using the proper name.
Instead of <guid> it should be <qvsID>.
With that change the script works correctly.