1 Reply Latest reply on Apr 14, 2014 8:14 PM by gCubed

    P6 R8.3 Web Services and .Net programming


      I am currently implementing Primavera P6 EPPM v8.3, and trying to write a proof-of-concept interface using Web Services.

      The application I have written is developed in Visual Studio 2010 using VB.Net, as I have no java skills and very rusty C#


      I have managed to extract all the WSDL endpoints and use WSDL.exe to create a .vb file that I have added to my project.


      My .Net application can login to the PMDB ie  LoginResponse is true if the correct password is used and false if incorrect, however the CookieContainer does not appear to return any value, and even if it did I don’t appear to be able to instantiate an ActivityPortBindingWse apb = new ActivityPortBindingWse() as this method doesn’t appear to exist. From what I can see I need to use a cookie to authenticate any other functions I want to use.

      V7 appears to be the last version to provide some basic .Net examples so I am trying to figure out what might be different in v8.3.

      What I really need is a sample of code (C or VB) that adds to what I already have below, that would let me get a list of Projects in the database for example.


      Imports System.Net
      Imports System.Web.Services


      Public Class Form1
          Public cookie As CookieContainer


          Public Sub Login(Username As String, Password As String, DatabaseInstance As Integer)

              Dim authService As AuthenticationService = New AuthenticationService()
              authService.CookieContainer = cookie

              Dim loginObj As Login = New Login()
              loginObj.UserName = Username
              loginObj.Password = Password
              loginObj.DatabaseInstanceId = DatabaseInstance
              loginObj.DatabaseInstanceIdSpecified = True
              Dim loginReturn As LoginResponse = authService.Login(loginObj)
      ' This works up to here ie loginReturn returns true
      ' But cookie below contains ‘Nothing’
              cookie = authService.CookieContainer

          End Sub

        • 1. Re: P6 R8.3 Web Services and .Net programming

          You need to set the cookieContainer before login to an object.


          authService.CookieContainer = new CookieContainer()

          after login

          cookie = authService.CookieContainer

          Once you have the cookieContainer, you can then use it on other objects.  I wrap all the P6 methods to return typed List<T>

          public P6ProjectService(P6AuthenticationService authenticationService)
          Filter = String.Empty;
          _projectService = new ProjectService
          CookieContainer = authenticationService.CookieContainer,
          Url = authenticationService.AuthService.Url.Replace("AuthenticationService", "ProjectService")


          public List<Project> GetProjects(String filterString)
          var readProjects = DefaultFields();
          if (filterString.IsNotNullOrEmpty()) readProjects.Filter = filterString;
          return GetProjects(readProjects);


              public List<Project> GetProjects(ReadProjects readProjects)
                  var retVal = new List<Project>(_projectService.ReadProjects(readProjects));
                  return retVal;

          public ReadProjects DefaultFields()
          var fields = new List<ProjectFieldType>
          var defaultFields = new ReadProjects {Field = fields.ToArray()};
          return defaultFields;