This documentation is archived and is not being maintained.

ServiceDescriptionImporter.AddServiceDescription Method

Adds the specified ServiceDescription to the collection of ServiceDescriptions values to be imported.

Namespace: System.Web.Services.Description
Assembly: System.Web.Services (in system.web.services.dll)

public void AddServiceDescription (
	ServiceDescription serviceDescription,
	string appSettingUrlKey,
	string appSettingBaseUrl
)
public void AddServiceDescription (
	ServiceDescription serviceDescription, 
	String appSettingUrlKey, 
	String appSettingBaseUrl
)
public function AddServiceDescription (
	serviceDescription : ServiceDescription, 
	appSettingUrlKey : String, 
	appSettingBaseUrl : String
)
Not applicable.

Parameters

serviceDescription

The ServiceDescription instance to add to the collection

appSettingUrlKey

Sets the initial value of the Url property of the proxy class to be generated from the instance represented by the serviceDescription parameter. Specifies that it should be generated from the web.config file's <appsetting> section.

appSettingBaseUrl

Sets the initial value of the Url property of the proxy class to be generated from the instance represented by the serviceDescription parameter. Specifies that it should be constructed from a combination of the value of this parameter and the URL specified by the location attribute in the WSDL document.

Use this method to add ServiceDescription instances to the collection that is to be imported when the Import method is called.

The two string parameters, appSettingUrlKey and appSettingBaseUrl, specify how to construct the Url property of the XML Web service proxy that is to be generated from the imported ServiceDescription value. The appSettingUrlKey parameter specifies that the Url property should be read out of the web.config file's <appsettings> section by using the parameter value as the configuration key. If the appSettingUrlKey parameter is a null reference (Nothing in Visual Basic) or an empty string, the initial value is determined by the location attribute in the Web Services Description Language (WSDL) document. If the value of Style is Server, an error is raised if you attempt to set the value of the appSettingUrlKey parameter.

The appSettingBaseUrl parameter specifies that the initial value for the Url property should be constructed from a combination of this parameter value and the URL specified by the location attribute in the WSDL document. The appSettingUrlKey parameter must also be specified. The Url property is constructed by combining a relative URL (constructed from the appSettingBaseUrl parameter and the WSDL-specified URL) with the URL loaded from the web.config file. If this parameter is a null reference (Nothing in Visual Basic) or an empty string, the URL is constructed entirely from the value in the web.config file.

The following example illustrates the use of the AddServiceDescription method when using the ServiceDescriptionImporter class.

// Initialize a service description importer.
ServiceDescriptionImporter importer = new ServiceDescriptionImporter();
importer.ProtocolName = "Soap12";  // Use SOAP 1.2.
importer.AddServiceDescription(description,null,null);

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Show: