Επεξεργασία

Κοινή χρήση μέσω


WebClientProtocol.Url Property

Definition

Gets or sets the base URL of the XML Web service the client is requesting.

public:
 property System::String ^ Url { System::String ^ get(); void set(System::String ^ value); };
public string Url { get; set; }
[System.ComponentModel.SettingsBindable(true)]
public string Url { get; set; }
member this.Url : string with get, set
[<System.ComponentModel.SettingsBindable(true)>]
member this.Url : string with get, set
Public Property Url As String

Property Value

The base URL of the XML Web service the client is requesting. The default is Empty.

Attributes

Examples

The following example changes the Url property for the math XML Web service to the Web server named http:// www.contoso.com.

// Set the URL property to a different Web server than that described in the
// service description.
math->Url = "http://www.contoso.com/math.asmx";
int total = math->Add( Convert::ToInt32( Num1.Text ), Convert::ToInt32( Num2.Text ) );
// Set the URL property to a different Web server than that described in the
// service description.
math.Url = "http://www.contoso.com/math.asmx";
int total = math.Add(Convert.ToInt32(Num1.Text), Convert.ToInt32(Num2.Text));
' Set the URL property to a different Web server than that described in the
' service description.
math.Url = "http://www.contoso.com/math.asmx"
Dim total As Integer = math.Add(Convert.ToInt32(Num1.Text), _
                                 Convert.ToInt32(Num2.Text))

Remarks

Proxy classes generated using Wsdl.exe will set a default Url property for the client to use. The default Url is determined by the location attribute found in the service description from which the proxy class was generated.

Derived classes supporting specific protocols, such as HttpGetClientProtocol and HttpPostClientProtocol might add extra information to Url to make the XML Web service request.

The Url property can be changed to refer to any XML Web service that implements the same service description that the proxy class was generated from.

Applies to

See also