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::ServiceDescription^A 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. |
int main() { try { // Create the file stream. FileStream^ discoStream = gcnew FileStream( "Service1_CS.disco",FileMode::Open ); // Create the discovery document. DiscoveryDocument^ myDiscoveryDocument = DiscoveryDocument::Read( discoStream ); // Get the first ContractReference in the collection. ContractReference^ myContractReference = dynamic_cast<ContractReference^>(myDiscoveryDocument->References[ 0 ]); // Set the client protocol. myContractReference->ClientProtocol = gcnew DiscoveryClientProtocol; myContractReference->ClientProtocol->Credentials = CredentialCache::DefaultCredentials; // Get the service description. ServiceDescription^ myContract = myContractReference->Contract; // Create the service description file. myContract->Write( "MyService1.wsdl" ); Console::WriteLine( "The WSDL file created is MyService1.wsdl" ); discoStream->Close(); } catch ( Exception^ ex ) { Console::WriteLine( "Exception: {0}", ex->Message ); } }
.NET Framework
Available since 1.1
Available since 1.1
Show: