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: 
TdZinkOptum
Contributor
Contributor

Call QMS API with PowerShell to obtain list of user documents

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

 

Labels (2)
1 Solution

Accepted Solutions
TdZinkOptum
Contributor
Contributor
Author

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.

View solution in original post

1 Reply
TdZinkOptum
Contributor
Contributor
Author

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.