ContractReference.Contract Property
.NET Framework (current version)
Gets a System.Web.Services.Description.ServiceDescription object representing the service description.
Assembly: System.Web.Services (in System.Web.Services.dll)
Property Value
Type: System.Web.Services.Description.ServiceDescriptionA System.Web.Services.Description.ServiceDescription object representing the service description.
| Exception | Condition |
|---|---|
| InvalidOperationException | ClientProtocol property is null. |
| Exception | The Documents property of ClientProtocol does not contain a discovery document with an URL of Url. |
Class MyClass1 Shared Sub Main() Try ' Create the file stream. Dim discoStream As _ New FileStream("Service1_vb.disco", FileMode.Open) ' Create the discovery document. Dim myDiscoveryDocument As _ DiscoveryDocument = DiscoveryDocument.Read(discoStream) ' Get the first ContractReference in the collection. Dim myContractReference As ContractReference = _ CType(myDiscoveryDocument.References(0), ContractReference) ' Set the client protocol. myContractReference.ClientProtocol = New DiscoveryClientProtocol() myContractReference.ClientProtocol.Credentials = _ CredentialCache.DefaultCredentials ' Get the service description. Dim myContract As ServiceDescription = myContractReference.Contract ' Create the service description file. myContract.Write("MyService1.wsdl") Console.WriteLine("The WSDL file created is MyService1.wsdl") discoStream.Close() Catch ex As Exception Console.WriteLine("Exception: " + ex.Message) End Try End Sub 'Main End Class 'MyClass1
.NET Framework
Available since 1.1
Available since 1.1
Show: