OperationBindingCollection Classe
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.
Representa uma coleção de instâncias da classe OperationBinding. Essa classe não pode ser herdada.
public ref class OperationBindingCollection sealed : System::Web::Services::Description::ServiceDescriptionBaseCollection
public sealed class OperationBindingCollection : System.Web.Services.Description.ServiceDescriptionBaseCollection
type OperationBindingCollection = class
inherit ServiceDescriptionBaseCollection
Public NotInheritable Class OperationBindingCollection
Inherits ServiceDescriptionBaseCollection
- Herança
Exemplos
#using <System.Xml.dll>
#using <System.Web.Services.dll>
#using <System.dll>
using namespace System;
using namespace System::Web::Services::Description;
int main()
{
try
{
ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_input_cpp.wsdl" );
// Add the OperationBinding for the Add operation.
OperationBinding^ addOperationBinding = gcnew OperationBinding;
String^ addOperation = "Add";
String^ myTargetNamespace = myServiceDescription->TargetNamespace;
addOperationBinding->Name = addOperation;
// Add the InputBinding for the operation.
InputBinding^ myInputBinding = gcnew InputBinding;
SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding;
mySoapBodyBinding->Use = SoapBindingUse::Literal;
myInputBinding->Extensions->Add( mySoapBodyBinding );
addOperationBinding->Input = myInputBinding;
// Add the OutputBinding for the operation.
OutputBinding^ myOutputBinding = gcnew OutputBinding;
myOutputBinding->Extensions->Add( mySoapBodyBinding );
addOperationBinding->Output = myOutputBinding;
// Add the extensibility element for the SoapOperationBinding.
SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding;
mySoapOperationBinding->Style = SoapBindingStyle::Document;
mySoapOperationBinding->SoapAction = String::Concat( myTargetNamespace, addOperation );
addOperationBinding->Extensions->Add( mySoapOperationBinding );
// Get the BindingCollection from the ServiceDescription.
BindingCollection^ myBindingCollection = myServiceDescription->Bindings;
// Get the OperationBindingCollection of SOAP binding from
// the BindingCollection.
OperationBindingCollection^ myOperationBindingCollection = myBindingCollection[ 0 ]->Operations;
// Check for the Add OperationBinding in the collection.
bool contains = myOperationBindingCollection->Contains( addOperationBinding );
Console::WriteLine( "\nWhether the collection contains the Add OperationBinding : {0}", contains );
// Add the Add OperationBinding to the collection.
myOperationBindingCollection->Add( addOperationBinding );
Console::WriteLine( "\nAdded the OperationBinding of the Add"
" operation to the collection." );
// Get the OperationBinding of the Add operation from the collection.
OperationBinding^ myOperationBinding = myOperationBindingCollection[ 3 ];
// Remove the OperationBinding of the Add operation from
// the collection.
myOperationBindingCollection->Remove( myOperationBinding );
Console::WriteLine( "\nRemoved the OperationBinding of the "
"Add operation from the collection." );
// Insert the OperationBinding of the Add operation at index 0.
myOperationBindingCollection->Insert( 0, addOperationBinding );
Console::WriteLine( "\nInserted the OperationBinding of the "
"Add operation in the collection." );
// Get the index of the OperationBinding of the Add
// operation from the collection.
int index = myOperationBindingCollection->IndexOf( addOperationBinding );
Console::WriteLine( "\nThe index of the OperationBinding of the Add operation : {0}", index );
Console::WriteLine( "" );
array<OperationBinding^>^operationBindingArray =
gcnew array<OperationBinding^>(myOperationBindingCollection->Count);
// Copy this collection to the OperationBinding array.
myOperationBindingCollection->CopyTo( operationBindingArray, 0 );
Console::WriteLine( "The operations supported by this service "
"are :" );
for each(OperationBinding^ myOperationBinding1 in operationBindingArray)
{
Binding^ myBinding = myOperationBinding1->Binding;
Console::WriteLine(" Binding : "+ myBinding->Name + " Name of " +
"operation : " + myOperationBinding1->Name);
}
// Save the ServiceDescription to an external file.
myServiceDescription->Write( "MathService_new_cpp.wsdl" );
}
catch ( Exception^ e )
{
Console::WriteLine( "Exception caught!!!" );
Console::WriteLine( "Source : {0}", e->Source );
Console::WriteLine( "Message : {0}", e->Message );
}
}
using System;
using System.Web.Services.Description;
class MyOperationBindingCollectionSample
{
static void Main()
{
try
{
ServiceDescription myServiceDescription =
ServiceDescription.Read("MathService_input_cs.wsdl");
// Add the OperationBinding for the Add operation.
OperationBinding addOperationBinding = new OperationBinding();
string addOperation = "Add";
string myTargetNamespace = myServiceDescription.TargetNamespace;
addOperationBinding.Name = addOperation;
// Add the InputBinding for the operation.
InputBinding myInputBinding = new InputBinding();
SoapBodyBinding mySoapBodyBinding = new SoapBodyBinding();
mySoapBodyBinding.Use = SoapBindingUse.Literal;
myInputBinding.Extensions.Add(mySoapBodyBinding);
addOperationBinding.Input = myInputBinding;
// Add the OutputBinding for the operation.
OutputBinding myOutputBinding = new OutputBinding();
myOutputBinding.Extensions.Add(mySoapBodyBinding);
addOperationBinding.Output = myOutputBinding;
// Add the extensibility element for the SoapOperationBinding.
SoapOperationBinding mySoapOperationBinding =
new SoapOperationBinding();
mySoapOperationBinding.Style = SoapBindingStyle.Document;
mySoapOperationBinding.SoapAction = myTargetNamespace + addOperation;
addOperationBinding.Extensions.Add(mySoapOperationBinding);
// Get the BindingCollection from the ServiceDescription.
BindingCollection myBindingCollection =
myServiceDescription.Bindings;
// Get the OperationBindingCollection of SOAP binding from
// the BindingCollection.
OperationBindingCollection myOperationBindingCollection =
myBindingCollection[0].Operations;
// Check for the Add OperationBinding in the collection.
bool contains = myOperationBindingCollection.Contains
(addOperationBinding);
Console.WriteLine("\nWhether the collection contains the Add " +
"OperationBinding : " + contains);
// Add the Add OperationBinding to the collection.
myOperationBindingCollection.Add(addOperationBinding);
Console.WriteLine("\nAdded the OperationBinding of the Add" +
" operation to the collection.");
// Get the OperationBinding of the Add operation from the collection.
OperationBinding myOperationBinding =
myOperationBindingCollection[3];
// Remove the OperationBinding of the Add operation from
// the collection.
myOperationBindingCollection.Remove(myOperationBinding);
Console.WriteLine("\nRemoved the OperationBinding of the " +
"Add operation from the collection.");
// Insert the OperationBinding of the Add operation at index 0.
myOperationBindingCollection.Insert(0, addOperationBinding);
Console.WriteLine("\nInserted the OperationBinding of the " +
"Add operation in the collection.");
// Get the index of the OperationBinding of the Add
// operation from the collection.
int index = myOperationBindingCollection.IndexOf(addOperationBinding);
Console.WriteLine("\nThe index of the OperationBinding of the " +
"Add operation : " + index);
Console.WriteLine("");
OperationBinding[] operationBindingArray = new
OperationBinding[myOperationBindingCollection.Count];
// Copy this collection to the OperationBinding array.
myOperationBindingCollection.CopyTo(operationBindingArray, 0);
Console.WriteLine("The operations supported by this service " +
"are :");
foreach(OperationBinding myOperationBinding1 in
operationBindingArray)
{
Binding myBinding = myOperationBinding1.Binding;
Console.WriteLine(" Binding : "+ myBinding.Name + " Name of " +
"operation : " + myOperationBinding1.Name);
}
// Save the ServiceDescription to an external file.
myServiceDescription.Write("MathService_new_cs.wsdl");
}
catch(Exception e)
{
Console.WriteLine("Exception caught!!!");
Console.WriteLine("Source : " + e.Source);
Console.WriteLine("Message : " + e.Message);
}
}
}
Imports System.Web.Services.Description
Class MyOperationBindingCollectionSample
Shared Sub Main()
Try
Dim myServiceDescription As ServiceDescription = _
ServiceDescription.Read("MathService_input_vb.wsdl")
' Add the OperationBinding for the Add operation.
Dim addOperationBinding As New OperationBinding()
Dim addOperation As String = "Add"
Dim myTargetNamespace As String = myServiceDescription.TargetNamespace
addOperationBinding.Name = addOperation
' Add the InputBinding for the operation.
Dim myInputBinding As New InputBinding()
Dim mySoapBodyBinding As New SoapBodyBinding()
mySoapBodyBinding.Use = SoapBindingUse.Literal
myInputBinding.Extensions.Add(mySoapBodyBinding)
addOperationBinding.Input = myInputBinding
' Add the OutputBinding for the operation.
Dim myOutputBinding As New OutputBinding()
myOutputBinding.Extensions.Add(mySoapBodyBinding)
addOperationBinding.Output = myOutputBinding
' Add the extensibility element for the SoapOperationBinding.
Dim mySoapOperationBinding As New SoapOperationBinding()
mySoapOperationBinding.Style = SoapBindingStyle.Document
mySoapOperationBinding.SoapAction = myTargetNamespace & addOperation
addOperationBinding.Extensions.Add(mySoapOperationBinding)
' Get the BindingCollection from the ServiceDescription.
Dim myBindingCollection As BindingCollection = _
myServiceDescription.Bindings
' Get the OperationBindingCollection of SOAP binding from
' the BindingCollection.
Dim myOperationBindingCollection As OperationBindingCollection = _
myBindingCollection(0).Operations
' Check for the Add OperationBinding in the collection.
Dim contains As Boolean = _
myOperationBindingCollection.Contains(addOperationBinding)
Console.WriteLine(ControlChars.NewLine & _
"Whether the collection contains the Add " & _
"OperationBinding : " & contains.ToString())
' Add the Add OperationBinding to the collection.
myOperationBindingCollection.Add(addOperationBinding)
Console.WriteLine(ControlChars.NewLine & _
"Added the OperationBinding of the Add " & _
"operation to the collection.")
' Get the OperationBinding of the Add operation from the collection.
Dim myOperationBinding As OperationBinding = _
myOperationBindingCollection(3)
' Remove the OperationBinding of the 'Add' operation from
' the collection.
myOperationBindingCollection.Remove(myOperationBinding)
Console.WriteLine(ControlChars.NewLine & _
"Removed the OperationBinding of the " & _
"Add operation from the collection.")
' Insert the OperationBinding of the Add operation at index 0.
myOperationBindingCollection.Insert(0, addOperationBinding)
Console.WriteLine(ControlChars.NewLine & _
"Inserted the OperationBinding of the " & _
"Add operation in the collection.")
' Get the index of the OperationBinding of the Add
' operation from the collection.
Dim index As Integer = myOperationBindingCollection.IndexOf( _
addOperationBinding)
Console.WriteLine(ControlChars.NewLine & _
"The index of the OperationBinding of the " & _
"Add operation : " & index.ToString())
Console.WriteLine("")
Dim operationBindingArray(myOperationBindingCollection.Count -1 ) _
As OperationBinding
' Copy this collection to the OperationBinding array.
myOperationBindingCollection.CopyTo(operationBindingArray, 0)
Console.WriteLine("The operations supported by this service " & _
"are :")
Dim myOperationBinding1 As OperationBinding
For Each myOperationBinding1 In operationBindingArray
Dim myBinding As Binding = myOperationBinding1.Binding
Console.WriteLine(" Binding : " & myBinding.Name & " Name of " & _
"operation : " & myOperationBinding1.Name)
Next myOperationBinding1
' Save the ServiceDescription to an external file.
myServiceDescription.Write("MathService_new_vb.wsdl")
Catch e As Exception
Console.WriteLine("Exception caught!!!")
Console.WriteLine("Source : " & e.Source.ToString())
Console.WriteLine("Message : " & e.Message.ToString())
End Try
End Sub
End Class
Comentários
A OperationBinding classe corresponde ao elemento WSDL (Linguagem de Descrição dos Serviços Web) <operation>
colocado pelo <binding>
elemento, que, por sua vez, corresponde à Binding classe. Para obter mais informações sobre WSDL, confira a especificação WSDL.
Propriedades
Capacity |
Obtém ou define o número de elementos que o CollectionBase pode conter. (Herdado de CollectionBase) |
Count |
Obtém o número de elementos contidos na instância de CollectionBase. Essa propriedade não pode ser substituída. (Herdado de CollectionBase) |
InnerList |
Obtém uma ArrayList que contém a lista de elementos na instância de CollectionBase. (Herdado de CollectionBase) |
Item[Int32] |
Obtém ou define o valor de um OperationBinding no índice de base zero especificado. |
List |
Obtém uma IList que contém a lista de elementos na instância de CollectionBase. (Herdado de CollectionBase) |
Table |
Obtém uma interface que implementa a associação das chaves e valores no ServiceDescriptionBaseCollection. (Herdado de ServiceDescriptionBaseCollection) |
Métodos
Add(OperationBinding) |
Adiciona o OperationBinding especificado ao final do OperationBindingCollection. |
Clear() |
Remove todos os objetos da instância CollectionBase. Esse método não pode ser substituído. (Herdado de CollectionBase) |
Contains(OperationBinding) |
Retorna um valor que indica se o OperationBinding especificado é um membro do OperationBindingCollection. |
CopyTo(OperationBinding[], Int32) |
Copia todo o |
Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual. (Herdado de Object) |
GetEnumerator() |
Retorna um enumerador que itera pela instância CollectionBase. (Herdado de CollectionBase) |
GetHashCode() |
Serve como a função de hash padrão. (Herdado de Object) |
GetKey(Object) |
Retorna o nome da chave associada com o valor passado por referência. (Herdado de ServiceDescriptionBaseCollection) |
GetType() |
Obtém o Type da instância atual. (Herdado de Object) |
IndexOf(OperationBinding) |
Pesquisa o OperationBinding especificado e retorna o índice de base zero da primeira ocorrência dentro de toda a coleção. |
Insert(Int32, OperationBinding) |
Adiciona a instância de OperationBinding especificada ao OperationBindingCollection no índice de base zero especificado. |
MemberwiseClone() |
Cria uma cópia superficial do Object atual. (Herdado de Object) |
OnClear() |
Limpa o conteúdo da instância ServiceDescriptionBaseCollection. (Herdado de ServiceDescriptionBaseCollection) |
OnClearComplete() |
Executa processos adicionais personalizados após limpar o conteúdo da instância CollectionBase. (Herdado de CollectionBase) |
OnInsert(Int32, Object) |
Executa os processos personalizados adicionais antes de inserir um novo elemento na instância CollectionBase. (Herdado de CollectionBase) |
OnInsertComplete(Int32, Object) |
Realiza processos personalizados adicionais após inserir um novo elemento no ServiceDescriptionBaseCollection. (Herdado de ServiceDescriptionBaseCollection) |
OnRemove(Int32, Object) |
Remove um elemento do ServiceDescriptionBaseCollection. (Herdado de ServiceDescriptionBaseCollection) |
OnRemoveComplete(Int32, Object) |
Executa processos personalizados adicionais após remover um elemento da instância de CollectionBase. (Herdado de CollectionBase) |
OnSet(Int32, Object, Object) |
Substitui um valor por outro dentro do ServiceDescriptionBaseCollection. (Herdado de ServiceDescriptionBaseCollection) |
OnSetComplete(Int32, Object, Object) |
Executa processos personalizados adicionais após configurar um valor na instância de CollectionBase. (Herdado de CollectionBase) |
OnValidate(Object) |
Executa processos personalizados adicionais ao validar um valor. (Herdado de CollectionBase) |
Remove(OperationBinding) |
Remove a primeira ocorrência do OperationBinding especificado do OperationBindingCollection. |
RemoveAt(Int32) |
Remove o elemento no índice especificado da instância CollectionBase. Este método não é substituível. (Herdado de CollectionBase) |
SetParent(Object, Object) |
Define o objeto pai da instância de ServiceDescriptionBaseCollection. (Herdado de ServiceDescriptionBaseCollection) |
ToString() |
Retorna uma cadeia de caracteres que representa o objeto atual. (Herdado de Object) |
Implantações explícitas de interface
ICollection.CopyTo(Array, Int32) |
Copia todo o CollectionBase em um Array unidimensional compatível, começando no índice especificado da matriz de destino. (Herdado de CollectionBase) |
ICollection.IsSynchronized |
Obtém um valor que indica se o acesso à CollectionBase é sincronizado (thread-safe). (Herdado de CollectionBase) |
ICollection.SyncRoot |
Obtém um objeto que pode ser usado para sincronizar o acesso ao CollectionBase. (Herdado de CollectionBase) |
IList.Add(Object) |
Adiciona um objeto ao final do CollectionBase. (Herdado de CollectionBase) |
IList.Contains(Object) |
Determina se o CollectionBase contém um elemento específico. (Herdado de CollectionBase) |
IList.IndexOf(Object) |
Pesquisa o Object especificado e retorna o índice de base zero da primeira ocorrência dentro de todo o CollectionBase. (Herdado de CollectionBase) |
IList.Insert(Int32, Object) |
Insere um elemento no CollectionBase, no índice especificado. (Herdado de CollectionBase) |
IList.IsFixedSize |
Obtém um valor que indica se o CollectionBase tem um tamanho fixo. (Herdado de CollectionBase) |
IList.IsReadOnly |
Obtém um valor que indica se o CollectionBase é somente leitura. (Herdado de CollectionBase) |
IList.Item[Int32] |
Obtém ou define o elemento no índice especificado. (Herdado de CollectionBase) |
IList.Remove(Object) |
Remove a primeira ocorrência de um objeto específico do CollectionBase. (Herdado de CollectionBase) |
Métodos de Extensão
Cast<TResult>(IEnumerable) |
Converte os elementos de um IEnumerable para o tipo especificado. |
OfType<TResult>(IEnumerable) |
Filtra os elementos de um IEnumerable com base em um tipo especificado. |
AsParallel(IEnumerable) |
Habilita a paralelização de uma consulta. |
AsQueryable(IEnumerable) |
Converte um IEnumerable em um IQueryable. |