This documentation is archived and is not being maintained.
ContractReference::Contract Property
Visual Studio 2010
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 nullptr. |
| 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 ); } }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: