共用方式為


How to: Add Web Services to Project Systems

XML Web services are, in general, URL-addressable resources that return programmatic information to the project system using the SOAP (Simple Object Access Protocol) protocol. You can integrate Web services to your VSPackage project system by using the IVsAddProjectItemDlg2 interface.

To add a Web service to your project system

  1. Call QueryService for IVsAddProjectItemDlg2 interface through SVsAddWebReferenceDlg service.

  2. Call the AddWebReferenceDlg method. If you pass in pDiscoverySession parameter as NULL, a discovery session is created for you, and the session is cached so that it is available for subsequent use by the IVsAddWebReferenceDlg2 interface. AddWebReferenceDlg method returns a pointer to IDiscoveryResult2.

  3. Call the AddWebReference method. Pass in the automation object for the Web service references folder as the pUnkWebReferenceFolder parameter. The Visual Studio environment then checks if the Web service is already present. If the Web service is not present, the environment downloads and adds the Web service to a folder and any additional files (such as .wsdl files) to the child nodes of the folder.

See Also

Reference

IVsAddWebReferenceDlg2

IDiscoveryResult

IDiscoverySession

IVsDiscoveryService