.Net"请求中缺少WSS标头。无法进行用户名令牌身份验证。"错误

时间:2015-05-06 12:18:35

标签: oracle web-services soap primavera

我尝试通过Oracle的Web API连接Oracle Primavera。不幸的是,没有太多关于它的文档。我已将Primavera Web Service添加到我的项目中。

到目前为止,我有以下代码:

    Dim authService As New AuthenticationService.AuthenticationService

    Dim loginObj As New AuthenticationService.Login()
    Dim loginResponse As AuthenticationService.LoginResponse

    authService.CookieContainer = New System.Net.CookieContainer()
    authService.Url = "http://" + hostName + ":" + port + "/p6ws/services/AuthenticationService"

    loginObj.UserName = userName
    loginObj.Password = passwd
    loginObj.DatabaseInstanceId = 1
    loginObj.DatabaseInstanceIdSpecified = True


    cookieContainer = authService.CookieContainer

    loginResponse = authService.Login(loginObj)
    Return loginResponse.Return

在authService.Login中我收到"请求中缺少WSS头。无法进行用户名令牌身份验证。"

在Primavera中,我已将身份验证模型设置为cookie,但没有结果。缺少什么?

2 个答案:

答案 0 :(得分:0)

  

在Primavera中,我已将身份验证模型设置为cookie,但没有结果。   缺少什么?

重新启动Primavera Web服务。

答案 1 :(得分:0)

我遇到了同样的错误:“请求中缺少WSS标头。无法进行用户名令牌认证。” 我做了:Primavera P6管理员 - Primavera P6配置 - Web服务 - 安全 - 身份验证 - 模式 - Cookies。

我在Delphi上的代码开始运行。

var
  i: integer;
  projLoad: CreateProjects;
  projList: ProjectPortType;
  projFieldLoad: Array_Of_ProjectFieldType;
  _login: Login;
  loginReturn: LoginResponse;
  servicePort: AuthenticationServicePortType;
  projectServicePort: ProjectPortType;
  _status: Status;
begin
  SetLength(projFieldLoad, 6);
  projFieldLoad[0] := ProjectFieldType.ObjectId;
  projFieldLoad[1] := ProjectFieldType.Id;
  projFieldLoad[2] := ProjectFieldType.Name_;
  projFieldLoad[3] := ProjectFieldType.StartDate;
  projFieldLoad[4] := ProjectFieldType.FinishDate;
  projFieldLoad[5] := ProjectFieldType.Status;

  servicePort := GetAuthenticationServicePortType();
  _login := Login.Create;
  _login.UserName := 'admin';
  _login.Password := 'admin';
  loginReturn := servicePort.Login(_login);
  projectServicePort := GetProjectPortType();
  projLoad := projectServicePort.ReadProjects(projFieldLoad, '', '');
  for i := 0 to Length(projLoad) - 1 do
  begin
    ShowMessage(IntToStr(projLoad[i].ObjectId));
    ShowMessage(projLoad[i].Id);
    ShowMessage(projLoad[i].Name_);
    if Assigned(projLoad[i].StartDate) then
      ShowMessage(DateToStr(projLoad[i].StartDate.AsDateTime));
    if Assigned(projLoad[i].FinishDate) then
      ShowMessage(DateToStr(projLoad[i].FinishDate.AsDateTime));
    _status := projLoad[i].Status;
    if _status = Status.Planned then
      ShowMessage('Planned');
    if _status = Status.Active then
      ShowMessage('Active');
  end;

P.S。我的笔记本电脑上安装的Web服务和软件