H
Heiner Eichmann
Hi!
I am trying to create a PSI extension, which uses the clients login
credentials to make ordinary PSI calls. The example PSIExtension2 from the
Microsoft Office Project 2007 SDK (see
http://msdn2.microsoft.com/en-us/library/bb428837.aspx ) does exactly this.
Just: If I run the example, I get a:
System.Web.Services.Protocols.SoapException was unhandled
Message="System.Web.Services.Protocols.SoapException: Server was unable to
process request. ---> System.Net.WebException: The request failed with HTTP
status 401: Unauthorized.\n
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)\n
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)\n
at HelloWorldPSI.WSResource.Resource.ReadResource(Guid resourceUid)\n
at Service.HelloWorld()\n
--- End of inner exception stack trace ---"
Source="System.Web.Services"
Actor=""
Lang=""
Node=""
Role=""
StackTrace:
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at HelloWorldPSIClient.WSHelloWorldPSI.HelloWorldPSI.HelloWorld() in
C:\2007 Office System Developer Resources\Project 2007 SDK\Code
Samples\PSIExtensions\PSIExtension1\HelloWorldPSIClient\HelloWorldPSIClient\Web
References\WSHelloWorldPSI\Reference.cs:line 79
at HelloWorldPSIClient.HelloWorld.cmdHelloWorld_Click(Object sender,
EventArgs e) in C:\2007 Office System Developer Resources\Project 2007
SDK\Code
Samples\PSIExtensions\PSIExtension1\HelloWorldPSIClient\HelloWorldPSIClient\HelloWorld.cs:line
27
...
To get more details of the reason I replaced in Service.cs the lines
HelloWorldPSI.WSResource.ResourceDataSet resDS =
resWS.ReadResource(contextInfo.UserGuid);
message += "E-Mail Address: " +
resDS.Tables[resDS.Resources.TableName].Rows[0]
[resDS.Resources.WRES_EMAILColumn.ColumnName].ToString();
by
try
{
System.Security.Principal.WindowsIdentity identity =
System.Security.Principal.WindowsIdentity.GetCurrent();
message += "Current Account: " + identity.Name + "\r\n";
message += "Context identity name: " +
context.User.Identity.Name.ToString() + "\r\n";
message += "Context identity authentication type: " +
context.User.Identity.AuthenticationType + "\r\n";
message += "Context profile username: " +
context.Profile.UserName + "\r\n";
HelloWorldPSI.WSResource.ResourceDataSet resDS =
resWS.ReadResource(contextInfo.UserGuid);
message += "E-Mail Address: " +
resDS.Tables[resDS.Resources.TableName].Rows[0]
[resDS.Resources.WRES_EMAILColumn.ColumnName].ToString();
}
catch (Exception e)
{
message += "Error: " + e.ToString();
}
Now user account of the request and the account running the process are
printed out and the PSI call is surrounded by a try catch block. The
response is:
Hello World
The following user called the custom Project Server Web service:
UserName = A03TC065\heinriche, SiteGuid =
a3b3e226-5e36-40b2-ac74-649a08f65123, Lcid = 1033
Current Account: NT AUTHORITY\NETWORK SERVICE
Context identity name: NT AUTHORITY\NETWORK SERVICE
Context identity authentication type: NTLM
Context profile username:
Error: System.Net.WebException: The request failed with HTTP status 401:
Unauthorized.
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at HelloWorldPSI.WSResource.Resource.ReadResource(Guid resourceUid)
at Service.HelloWorld()
While the PSContextInfo knew the user making the call, the process itself
and the http context are the user running the Office Project Server service.
Therefore it is no surprise, that the PSI call failed. Just: Why did it work
on the machine of the developer, who wrote the SDK sample? Is there
somewhere a switch, to make this sample running?
I am using a basic project installation out of the box. Server and cliwnt
machine are in a domain. The domain user running the client is allowed to
make PSI calls.
Any pointer is appreciated. Regards,
Heiner
I am trying to create a PSI extension, which uses the clients login
credentials to make ordinary PSI calls. The example PSIExtension2 from the
Microsoft Office Project 2007 SDK (see
http://msdn2.microsoft.com/en-us/library/bb428837.aspx ) does exactly this.
Just: If I run the example, I get a:
System.Web.Services.Protocols.SoapException was unhandled
Message="System.Web.Services.Protocols.SoapException: Server was unable to
process request. ---> System.Net.WebException: The request failed with HTTP
status 401: Unauthorized.\n
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)\n
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)\n
at HelloWorldPSI.WSResource.Resource.ReadResource(Guid resourceUid)\n
at Service.HelloWorld()\n
--- End of inner exception stack trace ---"
Source="System.Web.Services"
Actor=""
Lang=""
Node=""
Role=""
StackTrace:
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at HelloWorldPSIClient.WSHelloWorldPSI.HelloWorldPSI.HelloWorld() in
C:\2007 Office System Developer Resources\Project 2007 SDK\Code
Samples\PSIExtensions\PSIExtension1\HelloWorldPSIClient\HelloWorldPSIClient\Web
References\WSHelloWorldPSI\Reference.cs:line 79
at HelloWorldPSIClient.HelloWorld.cmdHelloWorld_Click(Object sender,
EventArgs e) in C:\2007 Office System Developer Resources\Project 2007
SDK\Code
Samples\PSIExtensions\PSIExtension1\HelloWorldPSIClient\HelloWorldPSIClient\HelloWorld.cs:line
27
...
To get more details of the reason I replaced in Service.cs the lines
HelloWorldPSI.WSResource.ResourceDataSet resDS =
resWS.ReadResource(contextInfo.UserGuid);
message += "E-Mail Address: " +
resDS.Tables[resDS.Resources.TableName].Rows[0]
[resDS.Resources.WRES_EMAILColumn.ColumnName].ToString();
by
try
{
System.Security.Principal.WindowsIdentity identity =
System.Security.Principal.WindowsIdentity.GetCurrent();
message += "Current Account: " + identity.Name + "\r\n";
message += "Context identity name: " +
context.User.Identity.Name.ToString() + "\r\n";
message += "Context identity authentication type: " +
context.User.Identity.AuthenticationType + "\r\n";
message += "Context profile username: " +
context.Profile.UserName + "\r\n";
HelloWorldPSI.WSResource.ResourceDataSet resDS =
resWS.ReadResource(contextInfo.UserGuid);
message += "E-Mail Address: " +
resDS.Tables[resDS.Resources.TableName].Rows[0]
[resDS.Resources.WRES_EMAILColumn.ColumnName].ToString();
}
catch (Exception e)
{
message += "Error: " + e.ToString();
}
Now user account of the request and the account running the process are
printed out and the PSI call is surrounded by a try catch block. The
response is:
Hello World
The following user called the custom Project Server Web service:
UserName = A03TC065\heinriche, SiteGuid =
a3b3e226-5e36-40b2-ac74-649a08f65123, Lcid = 1033
Current Account: NT AUTHORITY\NETWORK SERVICE
Context identity name: NT AUTHORITY\NETWORK SERVICE
Context identity authentication type: NTLM
Context profile username:
Error: System.Net.WebException: The request failed with HTTP status 401:
Unauthorized.
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at HelloWorldPSI.WSResource.Resource.ReadResource(Guid resourceUid)
at Service.HelloWorld()
While the PSContextInfo knew the user making the call, the process itself
and the http context are the user running the Office Project Server service.
Therefore it is no surprise, that the PSI call failed. Just: Why did it work
on the machine of the developer, who wrote the SDK sample? Is there
somewhere a switch, to make this sample running?
I am using a basic project installation out of the box. Server and cliwnt
machine are in a domain. The domain user running the client is allowed to
make PSI calls.
Any pointer is appreciated. Regards,
Heiner