Export (0) Print
Expand All

SoapBinding Class

Represents an extension added to a Binding within an XML Web service. This class cannot be inherited.

Namespace:  System.Web.Services.Description
Assembly:  System.Web.Services (in System.Web.Services.dll)

<XmlFormatExtensionPrefixAttribute("soap", "http://schemas.xmlsoap.org/wsdl/soap/")> _
<XmlFormatExtensionPrefixAttribute("soapenc", "http://schemas.xmlsoap.org/soap/encoding/")> _
<XmlFormatExtensionAttribute("binding", "http://schemas.xmlsoap.org/wsdl/soap/",  _
	GetType(Binding))> _
Public Class SoapBinding _
	Inherits ServiceDescriptionFormatExtension

The SoapBinding type exposes the following members.

Public methodSoapBindingInitializes an instance of the SoapBinding class.

Public propertyHandledGets or sets a value indicating whether the ServiceDescriptionFormatExtension is used by the import process when the extensibility element is imported. (Inherited from ServiceDescriptionFormatExtension.)
Public propertyParentGets the parent of the ServiceDescriptionFormatExtension. (Inherited from ServiceDescriptionFormatExtension.)
Public propertyRequiredGets or sets a value indicating whether the ServiceDescriptionFormatExtension is necessary for the action to which it refers. (Inherited from ServiceDescriptionFormatExtension.)
Public propertyStatic memberSchemaGets the binding schema that is to be used to transmit data by using the SOAP protocol version 1.1.
Public propertyStyleSpecifies the type of SOAP binding used by the current SoapBinding.
Public propertyTransportGets or sets the URI with the specification for HTTP transmission of SOAP data.

Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Public fieldStatic memberHttpTransportGets the URI for the standard protocol specifying HTTP transmission of SOAP data. This field is constant.
Public fieldStatic memberNamespaceGets the URI for the XML namespace of the SoapBinding class. This field is constant.

This class specifies that the data transmission will use the SOAP protocol version 1.1.

For more information about specifying protocols for XML Web services, see [<topic://cpconbuildingaspnetwebservices>]. For more information about Web Services Description Language (WSDL), see the specification at http://www.w3.org/TR/wsdl/.

Imports System
Imports System.Web.Services.Description
Imports System.Collections
Imports System.Xml

Class MySoapClass
   Public Shared Sub Main()
      Dim myDescription As ServiceDescription = _
      ' Create a 'Binding' object for the 'SOAP' protocol. 
      Dim myBinding As New Binding()
      myBinding.Name = "Service1Soap" 
      Dim qualifiedName As New XmlQualifiedName("s0:Service1Soap")
      myBinding.Type = qualifiedName

      Dim mySoapBinding As New SoapBinding()
      mySoapBinding.Transport = SoapBinding.HttpTransport
      mySoapBinding.Style = SoapBindingStyle.Document

      ' Add the 'SoapBinding' object to the 'Binding' object.

      ' Create the 'OperationBinding' object for the 'SOAP' protocol. 
      Dim myOperationBinding As New OperationBinding()
      myOperationBinding.Name = "AddNumbers" 

      ' Create the 'SoapOperationBinding' object for the 'SOAP' protocol. 
      Dim mySoapOperationBinding As New SoapOperationBinding()
      mySoapOperationBinding.SoapAction = "http://tempuri.org/AddNumbers"
      mySoapOperationBinding.Style = SoapBindingStyle.Document
      ' Add the 'SoapOperationBinding' object to 'OperationBinding' object.

      ' Create the 'InputBinding' object for the 'SOAP' protocol. 
      Dim myInput As New InputBinding()
      Dim mySoapBinding1 As New SoapBodyBinding()
      mySoapBinding1.Use = SoapBindingUse.Literal
      ' Assign the 'InputBinding' to 'OperationBinding'.
      myOperationBinding.Input = myInput
      ' Create the 'OutputBinding' object' for the 'SOAP' protocol. 
      Dim myOutput As New OutputBinding()
      ' Assign the 'OutPutBinding' to 'OperationBinding'.
      myOperationBinding.Output = myOutput

      ' Add the 'OperationBinding' to 'Binding'.

      ' Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'.

      Dim soapPort As New Port()
      soapPort.Name = "Service1Soap"
      soapPort.Binding = New XmlQualifiedName("s0:Service1Soap")

      ' Create a 'SoapAddressBinding' object for the 'SOAP' protocol. 
      Dim mySoapAddressBinding As New SoapAddressBinding()
      mySoapAddressBinding.Location = "http://localhost/AddNumbers.vb.asmx" 

      ' Add the 'SoapAddressBinding' to the 'Port'.

      ' Add the 'Port' to 'PortCollection' of 'ServiceDescription'.

      ' Write the 'ServiceDescription' as a WSDL file.
      Console.WriteLine(" 'AddNumbersOut_vb.Wsdl' file was generated")
   End Sub 'Main
End Class 'MySoapClass

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2014 Microsoft