Editar

Compartir a través de


ServiceDescriptionImporter.AddServiceDescription Method

Definition

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

public:
 void AddServiceDescription(System::Web::Services::Description::ServiceDescription ^ serviceDescription, System::String ^ appSettingUrlKey, System::String ^ appSettingBaseUrl);
public void AddServiceDescription (System.Web.Services.Description.ServiceDescription serviceDescription, string appSettingUrlKey, string appSettingBaseUrl);
member this.AddServiceDescription : System.Web.Services.Description.ServiceDescription * string * string -> unit
Public Sub AddServiceDescription (serviceDescription As ServiceDescription, appSettingUrlKey As String, appSettingBaseUrl As String)

Parameters

serviceDescription
ServiceDescription

The ServiceDescription instance to add to the collection.

appSettingUrlKey
String

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
String

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.

Examples

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

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

Remarks

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 null 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 null or an empty string, the URL is constructed entirely from the value in the web.config file.

Applies to