Original address: http://www.cnblogs.com/yuefei/p/3600441.html
The original writing is very good, I have added some details here. To help small white like me, clearly follow the instructions, but still wrong
Get ready:
VSphere Management SDK
Microsoft Visual Studio 2008
Web Services Enhancements (WSE) 3.0 for Microsoft. NET
The. NET Framework v2.0 SDK
Microsoftsqlserversstring
Attention:
The . NET Framework v2.0 SDK is not a. NET Framework v2.0
The. NET Framework v2.0 SDK is not available to install its own version, such as a 64-bit system, to install the 32. NET Framework v2.0 SDKInstall Web Services Enhancements (WSE) 3.0 for Microsoft. NET Select Custom
Management SDK Description:
VSphere Management SDK code samples for. NET and Java for related features such as VMware Management.
In its 5.5 unpacking package,
Eam:esx Agent Management represents a proxy for the ESX virtual machine production environment
Sms:storage Monitoring Management Storage monitoring
Spbm:storage policy based management storage policies
Ssoclient: Client Single Sign-on authentication
Vsphere-ws:web Service API
When you open the sample solution, you find that some DLL files are missing.
For Microsoft.Web.Services3.dll is a DLL file in Microsoft wse3.0 that can be used to produce secure WEB services.
Install Web Services Enhancements (WSE) 3.0 for Microsoft. NET post-exclamation mark disappears
Workaround:
Vim25Service.dll
Vim25Service.XmlSerializers.dll
Of course, a Web-based service interface is also available in the Vsphere Management SDK Development Package ... SDK\VSPHERE-WS\WSDL\VIM25 directory, you can generate DLL files from the WSE tool.
For the WSE Tools installation configuration, the three options for installing the runtime, toolset, and VS tools.
There are two ways to compile, one is through WseWsdl3.exe in the Tools tool, and the other is the VS extension tool.
After the installation is complete, open the DOS window for VS and perform the following steps in turn.
Generate Vim25Service.dll and Vim25Service.XmlSerializers.dll
1. Generate CS file.
Wsdl.exe/n:vim25api/o:d:\sdk\dll\vimservice.cs d:\sdk\dll\vimService.wsdl d:\sdk\dll\vim.wsdl
2. Compile the CS file (Generate Vim25Service.dll).
Csc/t:library/out:d:\sdk\dll\vim25service.dll D:\sdk\dll\VimService.cs
3. Generate a serialization file (Vim25Service.XmlSerializers.dll). This process takes a relatively long time.
sgen/p D:\sdk\dll\Vim25Service.dll
4. It's not over yet.
We open the WSDL compiled file VimService.cs:
[System.CodeDom.Compiler.GeneratedCodeAttribute ("WSDL", "4.0.30319.1")] [System.Diagnostics.DebuggerStepThroughAttribute ()] [System.ComponentModel.DesignerCategoryAttribute ("code")] [System.Web.Services.WebServiceBindingAttribute (Name= "vimbinding", namespace= "URN:VIM25")] [System.Xml.Serialization.XmlIncludeAttribute (typeof (Readenvironmentvariableinguestrequesttype))] [System.Xml.Serialization.XmlIncludeAttribute (typeof (Terminateprocessinguestrequesttype))]
......
public partial class vimservice:system.web.services.protocols.soaphttpclientprotocol{
So we commented out all [System.Xml.Serialization.XmlIncludeAttribute (typeof ...,
This step can be done using the Replace all function of VS, there are about 6478 items, be sure to use the tool
And then we're in
public partial class VimService:System.Web.Services.Protocols.SoapHttpClientProtocol
Add a line to the front with the following
[System.Xml.Serialization.XmlSerializerAssembly (AssemblyName = "Vimservice25.xmlserializers")].
Generate STSService.dll
1.cd to the WSE tool.
CD C:\Program Files (x86) \microsoft Wse\v3.0\tools
2. Generate CS file. Here, add all the WSDL files at the end.
Wsewsdl3.exe/o:c:\stsservice.cs/type:webclient c:\test\STSService.wsdl c:\test\ Profiled-saml-schema-assertion-2.0.xsd c:\test\profiled-saml-schema-assertion-2.0-extensions.xsd c:\test\ Profiled-saml-schema-assertion-2.0-types.xsd c:\test\profiled-sstc-saml-delegation.xsd c:\test\ Profiled-wsse-header.xsd c:\test\profiled-wss-wssecurity-utility-1.0.xsd c:\test\profiled-ws-trust.xsd c:\test\ Ws-addr.xsd c:\test\ws-trust-1.4-extensions.xsd c:\test\xmldsig-core-schema.xsd
3. Compile the CS file. You need to refer to Microsoft.Web.Services3.dll here.
Csc/t:library/out:c:\stsservice.dll c:\stsservice.cs/reference: "C:\Program Files (x86) \microsoft Wse\v3.0\ Microsoft.Web.Services3.dll "
A warning may appear during compilation of the STSService.dll. This represents the need to install the. NET Framework v2.0 SDK. This is something that is not. NET Framework 2.0.
When the installation is done to re-reference the production DLL file, it is a bit to note that the project in sample uses the. NET Framework 3.5, depending on the version of the DLL that you compiled, you can change the project version or use the corresponding compilation environment.
In addition, there are two methods of client login in sample. One is called obsolete, actually VMA proxy instances, and the other is SSO.
However, SSO does not provide an interface for SSO in the API provided by the sample WSDL. Missing part classification method. So comment out the authentication code for SSO.
Vsphere Management SDK for the VMware Development Kit