1
我想在P6 Web服務使用基於Cookie的身份驗證寫通過P6 Web服務在P6DB數據,我採取了以下兩個鏈接如何閱讀和使用C#
- 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
現在我可以使用基於cookie的身份驗證進行登錄,但是當我嘗試着手進行下一步操作時,我被攻擊了。
例如,我想在P6 DB中創建一個新的活動,我遵循以下步驟。
登錄到系統(創建Cookie容器):我添加服務引用了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; }
創建活動:?我增加對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];
該問題即將出現在第二步,我無法創建ActivityPortBinding類秒。
錯誤:類型或命名空間名稱「ActivityPortBinding」找不到(是否缺少using指令或程序集引用?)
- 能否請你幫我找到我哪裏做錯了上面的代碼?
- 我打電話正確登錄()在第1步?
- 我應該使用哪一個參考到Step2中的ActivityPortBinding類?
在此先感謝!