Tuesday 7 April 2009

Microsoft Project Server WebServices

We've just delivered a mini POC for a customer based around Microsoft Office Project Server where a number of the PSI methods were wrapped into new simple SOAP services.

Having not worked with MOPS before it was a bit of a learning curve for a one day project. Whilst the technical documentation from the Project SDK was pretty good there seemed to be a real lack of easy to find (and implement) steps on configuring the MOPS environment.

So, what did we learn.....

1) Not all web service Urls are the equal. There are two paths into the PSI web services, one through the SSP and the other through the Site. Grab the SSP version for your WSDL Web Reference and the Site (Litware in this case) for "Production" use.

http://epm2007demo:56737/ProjectServer_SSP/PSI/Project.asmx
http://epm2007demo/Litware/_vti_bin/psi/project.asmx

2) To get authorized access to the web service (and avoid 401's everywhere) you need to do a few things.

Setup the User or Service Account that will call the PSI Web Services:
(thanks to Stephen Sanderlin)

1) In SharePoint Central Admin, go to "Application Management" and click "Manage this Farm's Shared Services".
2) Hover over the SSP's name
3) Click the drop-down arrow that appears to the right of the SSP's name
4) Click "Edit Properties"
5) Scroll to the bottom of the "Edit Shared Services Provider" page
6) Enter the user's ID into the "Process Accounts with access to this SSP" box
7) Click the "OK" button

Setup your proxy to access the PSI Web Services using the correct credentials:

The credentials you use here should be the same ones you have setup in the previous step. Here (using the MOPS VPC) we used the farmadmin account.

Project p = new Project();

p.Url = " http://epm2007demo/Litware/_vti_bin/psi/project.asmx";
p.UseDefaultCredentials = false;
p.Credentials = new NetworkCredential(@"farmadmin", "pass@word1","epm2007demo");

3) Testing and debugging is pretty simple (much the same as any other MS development really). The real issue was making sure that the process of CheckOut, Edit, CheckIn and finally Publish was implemented to avoid having to go to the MOPS Queue and manually retrieve stuck jobs.

Also the "Publish" step was necessary to push the changes upto the Project centre and make them visible, one to check if your code looks right but you can't see any changes ;-)

Once we'd worked out the configuration and process steps the actual development was very simple and straight forward. Hopefully this will save a few of you searching the net for all these answers.

One to leave you with, download and use the Project 2007 SDK, it's got loads of really good technical development examples that should cover most eventualities.