Downloaded the latest build VMware-vSphere-SDK-5.5.0-1284541.zip from here
Made sure vCenter server version is 5.5 and local vSphere Client 5.5 is connecting to host with no issues.
Followed the instructions to create the following using Visual Studio 2008 command prompt
a. STSService.cs and dll
b. Vim25Service and VimService
The samples does not compile with the following error in the SSO Connect method in SvcConnection.cs in AppUtil project.
Error message:
'Vim25Api.VimService' does not contain a definition for 'SetPolicy' and no extension method 'SetPolicy' accepting a first argument of type 'Vim25Api.VimService' could be found (are you missing a using directive or an assembly reference?)
File C:\Temp\VMware-vSphere-SDK-5.5.0-1284541\SDK\vsphere-ws\dotnet\cs\samples\AppUtil\SvcConnection.cs
Line 263 Column 22 Project AppUtil
Here is method that
public void SSOConnect(XmlElement token, string url)
{
if (_service != null)
{
Disconnect();
}
_service = new VimService();
_service.Url = url;
_service.Timeout = 600000; //The value can be set to some higher value also.
_service.CookieContainer = new System.Net.CookieContainer();
.
.
.
//Setting up the security policy for the request
Policy policySAML = new Policy();
policySAML.Assertions.Add(customSecurityAssertion);
// Setting policy of the service
_service.SetPolicy(policySAML);
_sic = _service.RetrieveServiceContent(_svcRef);
.
.
.
}
Appreciate any help in resolving this issue.
After spending quite a bit of time, I finally figured this bit out. Basically you've generated the client based off standard soapClient while the samples expect a MSE 3 webClient.
Assuming you've used WSE3Wsdl to generate proxy, you should append "/type:webClient" to the command prompt when generating proxy.
That worked. Thanks. Will soon post the list of cmd lines used to create the dll for others to use..
_service.SetPolicy(policySAML);这句注释掉。与他相关的代码也可以注释。这个函数可能已经过时被抛弃掉了。
取替的方法是添加下面这行代码。虽然我也不知到为什么。如果不添加下面这行,会因为SSL证书问题一直报错。
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
!请原谅我不会英语。
Were you able to successfully "Issue" the SAML token? I was having a problem with the server not sending me a holder-of-key token. For example, in line 2 the response token from the server was a "Bearer" key type and not a "Public Key" type. I am not sure why that is happening.
1: RequestSecurityTokenResponseCollectionType responseToken;
2: responseToken = vService.Issue(tokenType);
3: RequestSecurityTokenResponseType rstResponse = new RequestSecurityTokenResponseType();
4: rstResponse = responseToken.RequestSecurityTokenResponse;