Motivation:
As we can read in Project Server Architecture
The SOAP-based ASMX interface for web services in the PSI is still available in Project Server 2013, but is deprecated.
As-Is
I have some PowerShell client snippets that I use to interact with Project Server. The standard way to communicate with the server are PSI ASMX web services.
To-Be
I would like to refactor the snippets to the standard of using PSI WCF web services.
Result
For example the following simple code works fine:
$Passwd = Get-Content $home\Documents\Password.txt | ConvertTo-SecureString
$Credential = New-Object -typename System.Management.Automation.PsCredential -argumentlist "user_name",$Passwd
$PWAUrl = "http://project_server_name/PWA"
$ProjSvcURL = $PWAUrl + "/_vti_bin/PSI/Project.asmx?wsdl"
$ProjSvcProxy = New-WebServiceProxy -uri $ProjSvcURL -credential $Credential
$projDataSet = $ProjSvcProxy.ReadProjectList()
$projDataSet.Tables[0].Rows.Count
but the simple conversion:
$Passwd = Get-Content $home\Documents\Password.txt | ConvertTo-SecureString
$Credential = New-Object -typename System.Management.Automation.PsCredential -argumentlist "user_name",$Passwd
$PWAUrl = "http://project_server_name/PWA"
$ProjSvcURL = $PWAUrl + "/_vti_bin/PSI/ProjectServer.svc"
...
fails with the message:
New-WebServiceProxy : The request failed with HTTP status 400: Bad Request.
Here is IIS log excerpt:
2014-01-05 13:50:41 10.15.43.7 GET /PWA/_vti_bin/PSI/ProjectServer.svc - 80 - XXX.XXX.XXX.XXX Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+2.0.50727.5472) 401 1 2148074254 125
2014-01-05 13:50:41 10.15.43.7 GET /PWA/_vti_bin/PSI/ProjectServer.svc - 80 - XXX.XXX.XXX.XXX Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+2.0.50727.5472) 401 2 5 328
2014-01-05 13:50:41 10.15.43.7 GET /_vti_bin/PSI/ProjectServer.svc/ntlm - 80 user_name XXX.XXX.XXX.XXX Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+2.0.50727.5472) 400 0 0 140
2014-01-05 17:58:33 10.15.43.7 GET /PWA/_vti_bin/PSI/ProjectServer.svc - 80 - XXX.XXX.XXX.XXX Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+2.0.50727.5472) 401 2 5 312
2014-01-05 17:58:33 10.15.43.7 GET /PWA/_vti_bin/PSI/ProjectServer.svc - 80 - XXX.XXX.XXX.XXX Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+2.0.50727.5472) 401 1 2148074254 156
2014-01-05 17:58:33 10.15.43.7 GET /_vti_bin/PSI/ProjectServer.svc/ntlm - 80 user_name XXX.XXX.XXX.XXX Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+2.0.50727.5472) 400 0 0 109
It is interesting that I cannot find any examples of using WCF PSI with PowerShell. Have anyone tried to do this? Have anyone succeed? Can anyone publish any snippet?