PSI 2010 Development Some Things to know

The underlying technology for network communications is based on WCF in Project Server 2010, to enable the use of service references (.svc files) and a broad range of improvements. ASMX Web service references are also based on the WCF architecture, and do not use .asmx files. Setting a reference to a PSI Web service in Project Server 2010 requires appending the ?wsdl URL option to the path, for example, http://ServerName/ProjectServerName/_vti_bin/PSI/Resource.asmx?wsdl

By default, WCF services in Project Server 2010 use SOAP over HTTP (or HTTPS), and are hosted in Microsoft Internet Information Services (IIS).

WCF can be configured programmatically or by using the app.config or web.config XML files.

Using WCF with the PSI in Project Server 2010 is similar to using ASMX for typical applications, although there are more configuration settings to make for the WCF endpoints. A WCF endpoint includes a URI and a binding that specifies the security, protocol, message encoding, and timeouts.

The Compatibility Mode setting in Project Web App refers only to making Project Server 2010 compatible with Project Professional 2007. The setting has no effect on third-party solutions.

External applications use the WCF interface through the front-end ProjectServer.svc service in Project Web App, which acts as a router to the back-end Project Server services. Applications and components that are designed to run on the server should use the WCF interface. The WCF interface can be used for both local and remote applications through a proxy assembly or proxy source files.

The ASMX interface URL can be used only through a front-end (Project Web App) URL. The URL for the public ASMX interface of the Resource Web service, for example, is http://ServerName/ProjectServerName/_vti_bin/PSI/Resource.asmx?wsdl. The ASMX interface files are contained in the [ProgramFiles]\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\PSI directory. ASMX interface in Project Server 2010 uses the underlying WCF infrastructure and is not accessed through .asmx files. Instead, the ASMX interface for each PSI service includes two .aspx files: the discovery file (Servicedisco.aspx) sets the SOAP binding for the service request and response, and the WSDL file (Servicewsdl.aspx) provides the schema for the service. You cannot use the back end URL to set an ASMX reference. Existing applications that use the ASMX interface must use the URL through Project Web App, which checks Project Server permissions.

WCF Interface URL (Backend):

Consists of .svc files in the [Program Files]\Microsoft Office Servers\14.0\WebServices\Shared\ProjectServer\PSI directory. Each .svc file includes a reference to the WCF implementation for Project Server. The URL for the WCF interface of the Project service of the PSI, for example, is http://ServerName:32843/%5BGUID%5D/PSI/Project.svc. The GUID is the name of the Project Server Service virtual directory in the SharePoint Web Services application as per this graphic of IIS

clip_image002

To quickly find the Virtual Directory GUID of the Project Server service application, use a Windows PowerShell command: PS > get-SPServiceApplication The Project Server Service application virtual directory name is the returned GUID (without the dashes), so the back-end URL of the Project service is http://ServerName:32843/c476f85e5c614de991e345e5127e20dc/PSI/Project.svc. (Or You can find the virtual directory name of the Project Server Service application by using SharePoint Central Administration. On the Manage Service Applications page, click the Project Server Service Application instance you want. The URL option of the Manage Project Web App Sites page contains the GUID of the directory name)

However, the back-end URL of a Project Server service is not directly usable because of claims-based authentication and custom WCF bindings in the SharePoint Web Services application. For that reason, access to WCF services must be through the front-end ProjectServer.svc router in Project Web App, can be done by using a proxy assembly or a proxy source code file. The Project 2010 SDK download includes the PSI proxy assembly and source for WCF services in the released version of Project Server 2010. See How to: Create a Proxy Assembly for WCF Services article for how to create a PSI proxy assembly for Project Server service packs or updates.

ProjectServer.svc router:   The Project Web App includes one WCF service, ProjectServer.svc, which serves as router for all of the Project Server services that are available in the SharePoint Web Services application. External applications do not call ProjectServer.svc directly, but set it as an endpoint for the proxy PSI services. Note: the Project Server service for Project Web App ([Program Files]\Common Files\Microsoft Shared\Web Server Extensions\14\isapi\PSI\ProjectServer.svc) acts only as a router for external access to PSI services on the computer running Project Server. Accordingly, ProjectServer.svc is disabled for publishing metadata. If you try to view http://ServerName/ProjectServerName/_vti_bin/psi/ProjectServer.svc in Internet Explorer, you get an error: The webpage cannot be found. This is normal behavior, and you should not try to enable metadata publishing for ProjectServer.svc.

To use the front-end ProjectServer.svc for routing Calls:

1. Add references for the PSI services that you need. As described in Prerequisites for WCF-Based Code Samples, there are three ways to add a service reference. We

· Set a reference to the ProjectServerServices.dll PSI proxy assembly (**recommended)

· Add the SvcUtil.exe output file of the WCF reference to the Visual Studio solution.

· Add a service reference using Visual Studio.

**we recommend that you set a reference to the ProjectServerServices.dll proxy assembly or add a proxy source file to your Visual Studio solution. The proxy assembly and source files are in the Project 2010 SDK download.

2. Create endpoints for the services that point to ProjectServer.svc on the Project Web App front end. For more information about creating WCF endpoints for Project Server services, see Walkthrough: Developing PSI Applications Using WCF, which shows how to programmatically create WCF bindings and endpoints without using an app.config file, and also how to modify an app.config file by using the WCF Service Configuration Editor in Visual Studio.

Migrating Existing Apps Minimum Steps

If you choose to migrate a Project Server 2007 solution to use the WCF interface, or if the solution does not work as expected on Project Server 2010, you should at a minimum do the following:

· Make a list of the Web references and namespace names, and then delete the ASMX Web references.

· Add the ProjectServerServices.dll WCF proxy assembly or source files for the required services, or add the front-end ASMX references again, by using the same namespace names. There are several new methods and datasets in the PSI services in Project Server 2010.

· Change assembly references to use the Project Server 2010 assemblies, such as Microsoft.Office.Project.Server.Library.dll and Microsoft.Office.Project.Server.Events.Receivers.dll.

· Compile and test the solution.

Most of the reference topics you will use for development are in the following groups:

· Primary class methods:   Each service in the PSI includes a primary class that has the name of the service. For example, the Resource service contains the Resource class. To see a list of the methods available in the Resource class, expand the class node in the SDK content pane, and then click the Resource Methods topic.

· DataRow properties:   Many of the primary class methods use or return a DataSet. Each DataTable object in a DataSet contains data in one or more DataRow objects. In most cases, you need to see only the row properties, not all of other members of the DataSet, DataTable, or DataRow classes. For example, the ResourceAssignmentDataSet class includes subclasses for the ResourceAssignmentDataTable and the ResourceAssignmentDataSet.ResourceAssignmentRow class.

Where to Develop

You do not need to develop most applications on a Project Server computer, or set references to Project Server assemblies in the global assembly cache. You can copy the necessary Project Server assemblies to your development computer. Project Server 2010 installs the following assemblies in [Program Files]\Microsoft Office Servers\14.0\Bin. Many assemblies are installed when you install Project Server; only three of the Project Server assemblies are documented.

· Microsoft.Office.Project.Server.Events.Receivers.dll

· Microsoft.Office.Project.Server.Library.dll

· Microsoft.Office.Project.Server.Workflow.dll

To Use a Service

You set a reference to the URL of the .asmx file or the .svc file by using an arbitrary name for the NameService in Microsoft Visual Studio 2008 (or later). The wsdl.exe or svcutil.exe utility then generates proxy source code for that namespace, and the compiler creates a proxy service assembly to include in your application.

Some of the PSI services contain duplicate DataSet classes. For example, the Project and Statusing services both include the ProjectDataSet class. That is because both the Project.asmx and Statusing.asmx Web descriptions include references to the ProjectDataSet, and the proxy assemblies that you create when you set Web references and compile an application include the related datasets. The Project and Statusing services may require values for different fields in the ProjectDataSet.ProjectRow class.

The List of 27 Web Services (Classes that contain the PSI Web methods)

Of the 27 total PSI services, Authentication, ExchangeSync, PWA, View, and WinProj are for internal use by Project Web App and Project Professional.

1. Admin    Includes methods that are used in the Project Server Administration pages in Project Web App Defines fiscal years. Manages statusing and currency settings, reporting periods, the audit log, and settings for the Active Directory directory service.

2. Archive    Includes methods for managing backup and restoration of projects, security categories, custom fields, resources, system settings, views, and the enterprise global project. Reads and updates the archive schedule. Archives all projects or deletes specified archived projects. Back up to the Archive database and restore to the Published database.

3. Authentication    Includes methods for internal use only by Project Professional and Project Web App. Access to the Authentication service is available only through the ProjectServiceApplication URL.

4. Calendar    Manages enterprise calendar exceptions. Checks out and checks in resource calendars. Creates, deletes, lists all, updates, or returns calendar exceptions.

5. CubeAdmin    Manages OLAP cube settings. Gets Analysis Server, database status, and list of cubes. Puts a Cube Build Service request on the queue. Reads and updates calculated member definitions and field settings for dimensions and measures in the cube.

6. CustomFields    Manages enterprise custom fields. Checks out, checks in, reads, creates, deletes, and updates.

7. Driver    Manages portfolio analysis drivers and driver prioritization for project creation and demand management. Includes the create, read, update, and delete (CRUD) methods for project drivers.

8. Events    Manages Project Server event handler associations. Includes the CRUD methods for Project Server event handler associations for a specific event, or for all event handler associations.

9. ExchangeSync    This is an internal Project Server service that handles Microsoft Exchange Server events. Project Web App uses ExchangeSync to synchronize assignments between Project Server and Exchange Server, rather than directly with the Microsoft Office Outlook client as in Microsoft Office Project Server 2007.

10. LoginForms    Provides the Login and Logoff methods with Forms-based authentication. Access to the LoginForms service is available only through a Project Web App site.

11. LoginWindows    Provides the Login and Logoff methods, used for Windows authentication in multi-authentication (claims and Forms-based) Project Server 2010 installations. The LoginWindows service is not used in WCF applications, or for applications that run on Project Server installations that use only claims authentication; in those cases, the Login method always returns false. Claims authentication handles integrated Windows authentication.

12. LookupTable    Manages lookup tables, multilanguage lookup tables, and their corresponding code masks. Checks out, checks in, reads, creates, deletes, and updates.

13. Notifications    Manages alerts and reminders. Includes methods that get, set, register, and unregister notifications.

14. ObjectLinkProvider    Manages Web objects and links for documents and list items on SharePoint sites. Creates, deletes, or reads project, project-linked, task, or task-linked Web objects.

15. PortfolioAnalyses    Includes the CRUD methods for project dependencies, and for Optimizer, Planner, and Analysis solutions.

16. Project    Manages projects. Checks out, checks in, creates, deletes, reads, or updates projects in the Draft or Published database. Puts a message on the queue for publishing. Creates or deletes entities within projects (tasks, resources, assignments, and so forth). Gets information about or updates the project team or project site address. Gets project status, a list of projects in the Draft database, all summary tasks, tasks available for assignment to a specified resource, or all projects where a resource has assignments. Creates and manages commitments, creates lightweight projects from SharePoint task lists, or finds project/master project relationships.

17. PWA    Contains many methods that are optimized for Project Web App, including the methods for task update approval rules and for managing status reports. The Project Web Appmethods are often specialized and somewhat redundant compared to equivalent methods in other PSI services. Project Web App methods use or return many of the same datasets as the other PSI methods.

18. QueueSystem    Manages the Project Server queue. Gets job count, job and job group wait time, status of all jobs, specified jobs, jobs owned by the caller, or jobs for specified projects. Manages job correlation and configures the queue.

19. Resource    Manages enterprise resources. Checks out, checks in, updates, or creates resources or Project Server users and their authorization settings; finds resources by name or GUID; reads resource or user data, the resource breakdown structure (RBS) and related security information; gets all assignments for a resource; and resets user passwords. The Resource class includes new CRUD methods for user delegations.

20. ResourcePlan    Manages resource plans. Checks out, checks in, creates, deletes, publishes, reads, and updates resource plans.

21. Security    Includes the CRUD methods for security templates security categories, organizational and global permissions, and group permissions. The Security class includes new methods for project categories.

22. Statusing    Manages status updates and assignments. Applies status updates or approvals, submits status updates, sets summary information for submitted updates, deletes approved status updates or approval history for a specified user, or deletes all status information for a set of projects. Creates, gets, or delegates assignments; sets assignment work duration. Gets new assignments for the current user; gets assignment or task transaction history, the timephased actuals, or the summary task hierarchy.Previews or imports timesheet data, or reads a user’s working and nonworking schedule. Finds pending status updates, information for submitted updates, or a transaction record of changes in a submitted update. Reads team status.

23. TimeSheet    Manages timesheets. Creates, deletes, submits, updates, reads, or recalls timesheets. Finds timesheets that are late or pending approval; finds timesheets by date or period. Gets list of timesheet approvers. Preloads actuals and validates a timesheet line. The TimeSheet class includes the new ReadProjectTimesheetLines and SubmitTimesheetLines methods.

24. View   The View service is designed for use only within Project Web App. Methods in the View class manage views and view reports and read fields in views. Access to the View service is available only through the ProjectServiceApplication URL. The View methods are not supported for third-party development.

25. WinProj    The WinProj service is designed for use only by Project Professional. Third-party developers should not use WinProj methods for programming with Project Server. Some WinProj methods use datasets such as ProjectRelationsDataSet and ResourceDataSet that the Project and Resource services also use, but require specific properties and functions in Project Professional.

26. Workflow    Includes the CRUD methods for enterprise project types and for managing workflow phases and stages. Run workflows, set status information, and manage project detail page (PDP) stages in demand management workflows.

27. WssInterop    Manages project sites. Creates and deletes project sites. Gets information about and updates the SharePoint settings and administration sites. Synchronizes and updates the project site memberships and groups.

asdf

Advertisements