OperationBinding Klas
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Bevat specificaties voor protocollen en gegevensindelingen voor de berichten die worden gebruikt in de actie die wordt ondersteund door de XML-webservice. Deze klasse kan niet worden overgenomen.
public ref class OperationBinding sealed : System::Web::Services::Description::DocumentableItem
public ref class OperationBinding sealed : System::Web::Services::Description::NamedItem
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class OperationBinding : System.Web.Services.Description.DocumentableItem
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class OperationBinding : System.Web.Services.Description.NamedItem
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type OperationBinding = class
inherit DocumentableItem
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type OperationBinding = class
inherit NamedItem
Public NotInheritable Class OperationBinding
Inherits DocumentableItem
Public NotInheritable Class OperationBinding
Inherits NamedItem
- Overname
- Overname
- Kenmerken
Voorbeelden
In het volgende voorbeeld ziet u het gebruik van de eigenschappen en methoden die door de OperationBinding klasse worden weergegeven. Er wordt een bestaande ServiceDescription ondersteuning toegevoegd voor het SOAP-protocol.
#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_cs.wsdl" );
String^ myTargetNamespace = myServiceDescription->TargetNamespace;
// Create an OperationBinding for the Add operation.
OperationBinding^ addOperationBinding = gcnew OperationBinding;
String^ addOperation = "Add";
addOperationBinding->Name = addOperation;
// Create an InputBinding for the Add operation.
InputBinding^ myInputBinding = gcnew InputBinding;
SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding;
mySoapBodyBinding->Use = SoapBindingUse::Literal;
myInputBinding->Extensions->Add( mySoapBodyBinding );
// Add the InputBinding to the OperationBinding.
addOperationBinding->Input = myInputBinding;
// Create an OutputBinding for the Add operation.
OutputBinding^ myOutputBinding = gcnew OutputBinding;
myOutputBinding->Extensions->Add( mySoapBodyBinding );
// Add the OutputBinding to the OperationBinding.
addOperationBinding->Output = myOutputBinding;
// Create an extensibility element for a SoapOperationBinding.
SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding;
mySoapOperationBinding->Style = SoapBindingStyle::Document;
mySoapOperationBinding->SoapAction = String::Concat( myTargetNamespace, addOperation );
// Add the extensibility element SoapOperationBinding to
// the OperationBinding.
addOperationBinding->Extensions->Add( mySoapOperationBinding );
ServiceDescriptionFormatExtensionCollection^ myExtensions;
// Get the FaultBindingCollection from the OperationBinding.
FaultBindingCollection^ myFaultBindingCollection = addOperationBinding->Faults;
FaultBinding^ myFaultBinding = gcnew FaultBinding;
myFaultBinding->Name = "ErrorFloat";
// Associate SOAP fault binding to the fault binding of the operation.
myExtensions = myFaultBinding->Extensions;
SoapFaultBinding^ mySoapFaultBinding = gcnew SoapFaultBinding;
mySoapFaultBinding->Use = SoapBindingUse::Literal;
mySoapFaultBinding->Namespace = myTargetNamespace;
myExtensions->Add( mySoapFaultBinding );
myFaultBindingCollection->Add( myFaultBinding );
// Get the BindingCollection from the ServiceDescription.
BindingCollection^ myBindingCollection = myServiceDescription->Bindings;
// Get the OperationBindingCollection of SOAP binding
// from the BindingCollection.
OperationBindingCollection^ myOperationBindingCollection = myBindingCollection[ 0 ]->Operations;
myOperationBindingCollection->Add( addOperationBinding );
Console::WriteLine( "The operations supported by this service are:" );
System::Collections::IEnumerator^ myEnum = myOperationBindingCollection->GetEnumerator();
while ( myEnum->MoveNext() )
{
OperationBinding^ myOperationBinding = safe_cast<OperationBinding^>(myEnum->Current);
Binding^ myBinding = myOperationBinding->Binding;
Console::WriteLine( " Binding : {0} :: Name of operation : {1}", myBinding->Name, myOperationBinding->Name );
FaultBindingCollection^ myFaultBindingCollection1 = myOperationBinding->Faults;
System::Collections::IEnumerator^ myEnum1 = myFaultBindingCollection1->GetEnumerator();
while ( myEnum1->MoveNext() )
{
FaultBinding^ myFaultBinding1 = safe_cast<FaultBinding^>(myEnum1->Current);
Console::WriteLine( " Fault : {0}", myFaultBinding1->Name );
}
}
myServiceDescription->Write( "MathService_new_cs.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 MyOperationBindingSample
{
static void Main()
{
try
{
ServiceDescription myServiceDescription =
ServiceDescription.Read("MathService_input_cs.wsdl");
string myTargetNamespace = myServiceDescription.TargetNamespace;
// Create an OperationBinding for the Add operation.
OperationBinding addOperationBinding = new OperationBinding();
string addOperation = "Add";
addOperationBinding.Name = addOperation;
// Create an InputBinding for the Add operation.
InputBinding myInputBinding = new InputBinding();
SoapBodyBinding mySoapBodyBinding = new SoapBodyBinding();
mySoapBodyBinding.Use = SoapBindingUse.Literal;
myInputBinding.Extensions.Add(mySoapBodyBinding);
// Add the InputBinding to the OperationBinding.
addOperationBinding.Input = myInputBinding;
// Create an OutputBinding for the Add operation.
OutputBinding myOutputBinding = new OutputBinding();
myOutputBinding.Extensions.Add(mySoapBodyBinding);
// Add the OutputBinding to the OperationBinding.
addOperationBinding.Output = myOutputBinding;
// Create an extensibility element for a SoapOperationBinding.
SoapOperationBinding mySoapOperationBinding =
new SoapOperationBinding();
mySoapOperationBinding.Style = SoapBindingStyle.Document;
mySoapOperationBinding.SoapAction = myTargetNamespace + addOperation;
// Add the extensibility element SoapOperationBinding to
// the OperationBinding.
addOperationBinding.Extensions.Add(mySoapOperationBinding);
ServiceDescriptionFormatExtensionCollection myExtensions;
// Get the FaultBindingCollection from the OperationBinding.
FaultBindingCollection myFaultBindingCollection =
addOperationBinding.Faults;
FaultBinding myFaultBinding = new FaultBinding();
myFaultBinding.Name = "ErrorFloat";
// Associate SOAP fault binding to the fault binding of the operation.
myExtensions = myFaultBinding.Extensions;
SoapFaultBinding mySoapFaultBinding = new SoapFaultBinding();
mySoapFaultBinding.Use = SoapBindingUse.Literal;
mySoapFaultBinding.Namespace = myTargetNamespace;
myExtensions.Add(mySoapFaultBinding);
myFaultBindingCollection.Add(myFaultBinding);
// Get the BindingCollection from the ServiceDescription.
BindingCollection myBindingCollection =
myServiceDescription.Bindings;
// Get the OperationBindingCollection of SOAP binding
// from the BindingCollection.
OperationBindingCollection myOperationBindingCollection =
myBindingCollection[0].Operations;
myOperationBindingCollection.Add(addOperationBinding);
Console.WriteLine(
"The operations supported by this service are:");
foreach(OperationBinding myOperationBinding in
myOperationBindingCollection)
{
Binding myBinding = myOperationBinding.Binding;
Console.WriteLine(" Binding : " + myBinding.Name +
" :: Name of operation : " + myOperationBinding.Name);
FaultBindingCollection myFaultBindingCollection1 =
myOperationBinding.Faults;
foreach(FaultBinding myFaultBinding1 in
myFaultBindingCollection1)
{
Console.WriteLine(" Fault : " + myFaultBinding1.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 MyOperationBindingSample
Shared Sub Main()
Try
Dim myServiceDescription As ServiceDescription = _
ServiceDescription.Read("MathService_input_vb.wsdl")
Dim myTargetNamespace As String = _
myServiceDescription.TargetNamespace
' Create an OperationBinding for the Add operation.
Dim addOperationBinding As New OperationBinding()
Dim addOperation As String = "Add"
addOperationBinding.Name = addOperation
' Create an InputBinding for the Add operation.
Dim myInputBinding As New InputBinding()
Dim mySoapBodyBinding As New SoapBodyBinding()
mySoapBodyBinding.Use = SoapBindingUse.Literal
myInputBinding.Extensions.Add(mySoapBodyBinding)
' Add the InputBinding to the OperationBinding.
addOperationBinding.Input = myInputBinding
' Create an OutputBinding for the Add operation.
Dim myOutputBinding As New OutputBinding()
myOutputBinding.Extensions.Add(mySoapBodyBinding)
' Add the OutputBinding to the OperationBinding.
addOperationBinding.Output = myOutputBinding
' Create an extensibility element for a SoapOperationBinding.
Dim mySoapOperationBinding As New SoapOperationBinding()
mySoapOperationBinding.Style = SoapBindingStyle.Document
mySoapOperationBinding.SoapAction = myTargetNamespace & addOperation
' Add the extensibility element SoapOperationBinding to
' the OperationBinding.
addOperationBinding.Extensions.Add(mySoapOperationBinding)
Dim myExtensions As ServiceDescriptionFormatExtensionCollection
' Get the FaultBindingCollection from the OperationBinding.
Dim myFaultBindingCollection As FaultBindingCollection = _
addOperationBinding.Faults
Dim myFaultBinding As New FaultBinding()
myFaultBinding.Name = "ErrorFloat"
' Associate SOAP fault binding to the fault binding of the operation.
myExtensions = myFaultBinding.Extensions
Dim mySoapFaultBinding As New SoapFaultBinding()
mySoapFaultBinding.Use = SoapBindingUse.Literal
mySoapFaultBinding.Namespace = myTargetNamespace
myExtensions.Add(mySoapFaultBinding)
myFaultBindingCollection.Add(myFaultBinding)
' 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
myOperationBindingCollection.Add(addOperationBinding)
Console.WriteLine( _
"The operations supported by this service are:")
Dim myOperationBinding As OperationBinding
For Each myOperationBinding In myOperationBindingCollection
Dim myBinding As Binding = myOperationBinding.Binding
Console.WriteLine(" Binding : " & myBinding.Name & _
" :: Name of operation : " & myOperationBinding.Name)
Dim myFaultBindingCollection1 As FaultBindingCollection = _
myOperationBinding.Faults
Dim myFaultBinding1 As FaultBinding
For Each myFaultBinding1 In myFaultBindingCollection1
Console.WriteLine(" Fault : " & myFaultBinding1.Name)
Next myFaultBinding1
Next myOperationBinding
' Save the ServiceDescripition 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
Opmerkingen
De OperationBinding klasse komt overeen met het WSDL-element (Web Services Description Language), <operation> dat <binding> op zijn beurt overeenkomt met de Binding klasse. Zie de WSDL-specificatie voor meer informatie over WSDL.
Constructors
| Name | Description |
|---|---|
| OperationBinding() |
Initialiseert een nieuw exemplaar van de OperationBinding klasse. |
Eigenschappen
| Name | Description |
|---|---|
| Binding |
Hiermee haalt u op Binding waarvan de huidige OperationBinding lid is. |
| Documentation |
Haalt de tekstdocumentatie op of stelt deze in voor het exemplaar van de DocumentableItem. (Overgenomen van DocumentableItem) |
| DocumentationElement |
Hiermee haalt of stelt u het documentatie-element voor de DocumentableItem. (Overgenomen van DocumentableItem) |
| ExtensibleAttributes |
Hiermee wordt een matrix van het type XmlAttribute opgehaald of ingesteld dat kenmerkextensies van WSDL vertegenwoordigt om te voldoen aan webservices-interoperabiliteit (WS-I) Basisprofiel 1.1. (Overgenomen van DocumentableItem) |
| Extensions |
Hiermee haalt u de verzameling uitbreidbaarheidselementen op die specifiek zijn voor de huidige OperationBinding. |
| Faults |
Hiermee haalt u de FaultBindingCollection gekoppelde instantie OperationBinding op. |
| Input |
Hiermee haalt u de gekoppelde op of stelt u deze InputBinding in OperationBinding. |
| Name |
Hiermee haalt u de naam van de OperationBinding. |
| Name |
Hiermee haalt u de naam van het item op of stelt u deze in. (Overgenomen van NamedItem) |
| Namespaces |
Hiermee haalt u de woordenlijst van naamruimtevoorvoegsels en naamruimten op die worden gebruikt om naamruimtevoorvoegsels en naamruimten te behouden wanneer een ServiceDescription object wordt samengesteld. (Overgenomen van DocumentableItem) |
| Output |
Hiermee haalt u de gekoppelde op of stelt u deze OutputBinding in OperationBinding. |
Methoden
| Name | Description |
|---|---|
| Equals(Object) |
Bepaalt of het opgegeven object gelijk is aan het huidige object. (Overgenomen van Object) |
| GetHashCode() |
Fungeert als de standaardhashfunctie. (Overgenomen van Object) |
| GetType() |
Hiermee haalt u de Type huidige instantie op. (Overgenomen van Object) |
| MemberwiseClone() |
Hiermee maakt u een ondiepe kopie van de huidige Object. (Overgenomen van Object) |
| ToString() |
Retourneert een tekenreeks die het huidige object vertegenwoordigt. (Overgenomen van Object) |