OperationBinding Class
Provides specifications for protocols and data formats for the messages used in the action supported by the XML Web service. This class cannot be inherited.
Assembly: System.Web.Services (in System.Web.Services.dll)
System.Web.Services.Description.DocumentableItem
System.Web.Services.Description.NamedItem
System.Web.Services.Description.OperationBinding
| Name | Description | |
|---|---|---|
![]() | OperationBinding() | Initializes a new instance of the OperationBinding class. |
| Name | Description | |
|---|---|---|
![]() | Binding | Gets the Binding of which the current OperationBinding is a member. |
![]() | Documentation | Gets or sets the text documentation for the instance of the DocumentableItem.(Inherited from DocumentableItem.) |
![]() | DocumentationElement | Gets or sets the documentation element for the DocumentableItem.(Inherited from DocumentableItem.) |
![]() | ExtensibleAttributes | Gets or sets an array of type XmlAttribute that represents attribute extensions of WSDL to comply with Web Services Interoperability (WS-I) Basic Profile 1.1.(Inherited from DocumentableItem.) |
![]() | Extensions | Gets the collection of extensibility elements specific to the current OperationBinding.(Overrides DocumentableItem.Extensions.) |
![]() | Faults | Gets the FaultBindingCollection associated with the OperationBinding instance. |
![]() | Input | Gets or sets the InputBinding associated with the OperationBinding. |
![]() | Name | Gets or sets the name of the item.(Inherited from NamedItem.) |
![]() | Namespaces | Gets or sets the dictionary of namespace prefixes and namespaces used to preserve namespace prefixes and namespaces when a ServiceDescription object is constructed.(Inherited from DocumentableItem.) |
![]() | Output | Gets or sets the OutputBinding associated with the OperationBinding. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType() | |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
The OperationBinding class corresponds to the Web Services Description Language (WSDL) <operation> element enclosed by the <binding> element, which in turn corresponds to the Binding class. For more information about WSDL, see the specification at http://www.w3.org/TR/wsdl/.
The following example demonstrates the use of the properties and methods exposed by the OperationBinding class. It takes an existing ServiceDescription and adds support for the SOAP protocol.
Imports System 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 'Main End Class 'MyOperationBindingSample
Available since 1.1
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
.jpeg?cs-save-lang=1&cs-lang=vb)
.jpeg?cs-save-lang=1&cs-lang=vb)