ContractReference.Contract Propriedade
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Obtém um objeto ServiceDescription que representa a descrição do serviço.
public:
property System::Web::Services::Description::ServiceDescription ^ Contract { System::Web::Services::Description::ServiceDescription ^ get(); };
public System.Web.Services.Description.ServiceDescription Contract { get; }
member this.Contract : System.Web.Services.Description.ServiceDescription
Public ReadOnly Property Contract As ServiceDescription
Valor da propriedade
Um ServiceDescription objeto que representa a descrição do serviço.
Exceções
A propriedade ClientProtocol é null
.
A propriedade Documents do ClientProtocol não contém um documento de descoberta com uma URL do Url.
Exemplos
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 );
}
}
class MyClass1
{
static void Main()
{
try
{
// Create the file stream.
FileStream discoStream =
new FileStream("Service1_CS.disco",FileMode.Open);
// Create the discovery document.
DiscoveryDocument myDiscoveryDocument =
DiscoveryDocument.Read(discoStream);
// Get the first ContractReference in the collection.
ContractReference myContractReference =
(ContractReference)myDiscoveryDocument.References[0];
// Set the client protocol.
myContractReference.ClientProtocol = new 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: " + ex.Message);
}
}
}
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
End Class
Aplica-se a
Confira também
Colabore connosco no GitHub
A origem deste conteúdo pode ser encontrada no GitHub, onde também pode criar e rever problemas e pedidos Pull. Para mais informações, consulte o nosso guia do contribuidor.