none
How to consume project web services in project server 2010 RRS feed

  • Question

  • Hi all,

    How to consume project web services in project server-2010..and how to use projectdataset in visual studio-2010.Please describe step by step and which template is selected in visual studio-2010..after add web references .How to use web method...


    Neeraj

    Wednesday, March 21, 2012 5:22 AM

All replies

  • Please see below console app example which uses the Project web sevrice as web service reference & updates the Task[2] priority of first task to200. It uses the Projectdataset & project class methods.

    using System;
    using System.Diagnostics;
    using System.Net;
    using System.Data;
    using System.Text;
    using PSIReadProjectData.ProjectWebSvc;
    using System.Collections.Generic;
    using System.Web.Services.Protocols;
    namespace PSIReadProjectData
    {
        class Program
        {
            
            static void Main(string[] args)
            {
               
                Class1 obj = new Class1();
                try
                {
                    
                    //bool checkedout = false;
                    ProjectWebSvc.Project proj = new ProjectWebSvc.Project();
                    proj.UseDefaultCredentials = true;
                    Guid projectGuid = new Guid("bb0c6180-185f-4315-851d-f415a7952913"); //Project for which I want to update the Multiline text field
                    ProjectWebSvc.ProjectDataSet pds = proj.ReadProject(projectGuid, DataStoreEnum.WorkingStore);
                    
                   
                    Guid sessionId = Guid.NewGuid();
                    Guid jobId = Guid.NewGuid();
                    
                    sessionId = Guid.NewGuid();
                    jobId = Guid.NewGuid();
                    pds.Task[2].TASK_PRIORITY = 200;
                     proj.CheckOutProject(projectGuid, sessionId, "Test checkout");
                    bool validateOnly = false;
                    proj.QueueUpdateProject(jobId, sessionId, pds, validateOnly);
                    proj.QueuePublish(jobId, projectGuid, false, string.Empty);
                    proj.QueueCheckInProject(jobId, projectGuid,false, sessionId, "Update priority using PSI");
                    
                }
                
                catch (SoapException ex)
                {
                 }
    }
    Hope that helps.

    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82

    Wednesday, March 21, 2012 7:20 AM
  • That's really helpful for me to :)

    Thank you Amit.

    I have another question in relation of your source code: I have to call the project.svc from an info path.

    I have the impression that I need to develop a WCF service that will contact the PSI; (Kind of Proxy) Don't know if it's correct.

    Through the info path, I need to update the Actual for an existing task and create an additional task with ETC.

    I'm trying to add the Project.svc service as a Web Reference, but i have received all the time an error 503 as the web service is unavailable or too busy.

    Thanks you for your support.


    Math

    Wednesday, March 21, 2012 1:59 PM