I want to use Cookie based authentication in P6 web service and I followed below two links
- http://docs.oracle.com/cd/E16281_01/Technical_Documentation/Web_Services/ProgrammersGuide/Logging_into_Primavera_Web_Services.htm#dotnetexample
- http://docs.oracle.com/cd/E16281_01/Technical_Documentation/Web_Services/ProgrammersGuide/whnjs.htm
Now I am able to Login with cookie based authentication but when I tries to proceed the next step I am strucked.
For eg. I want to create a new activity in P6 DB, I followed the below steps.
Login to system (create a Cookie Container) : I added service reference for AuthenticationService.wsdl
System.Net.CookieContainer cookieContainer; public void Login(String userName, String password) { AuthenticationServiceWebRef.AuthenticationService authService = new AuthenticationServiceWebRef.AuthenticationService(); authService.CookieContainer = new System.Net.CookieContainer(); authService.Url = ConfigurationManager.AppSettings["WSAuthenticationService"]; AuthenticationServiceWebRef.Login loginObj = new AuthenticationServiceWebRef.Login(); loginObj.UserName = userName; loginObj.Password = password; loginObj.DatabaseInstanceId = 1; loginObj.DatabaseInstanceIdSpecified = true; AuthenticationServiceWebRef.LoginResponse loginReturn = authService.Login(loginObj); cookieContainer = authService.CookieContainer; }
Create the Activity : I add service reference for ActivityService?wsdl
Login(WSUsername, WSPassword); ActivityPortBinding apb = new ActivityPortBinding(); apb.CookieContainer = cookieContainer; apb.Url = ConfigurationManager.AppSettings["WSGetDataByID"]; Activity[] acts; acts = new Activity[1]; Activity activity = null; for (int i = 0; i < 1; i++) { activity = new Activity(); activity.ProjectObjectId = iProjectObjectID; activity.ProjectObjectIdSpecified = true; activity.Id = "P6 Test" + (i + 1); activity.Name = "P6 Test" + (i + 1); acts[i] = activity; } int [] arrayObjectIDs= apb.CreateActivities(acts); iRetActivityObjectID = arrayObjectIDs[0];
The issue is coming in second step, I am not able to create ActivityPortBinding class.
Error : The type or namespace name 'ActivityPortBinding' could not be found (are you missing a using directive or an assembly reference?)
- Can you please help me to find where I went wrong in the above code?
- Am I calling right Login() in step 1?
- Which Reference I should use to ActivityPortBinding class in Step2?
Thanks in Advance!