SoapBinding Class
TOC
Collapse the table of content
Expand the table of content

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)


[XmlFormatExtensionAttribute("binding", "http://schemas.xmlsoap.org/wsdl/soap/", 
	typeof(Binding))]
[XmlFormatExtensionPrefixAttribute("soap", "http://schemas.xmlsoap.org/wsdl/soap/")]
[XmlFormatExtensionPrefixAttribute("soapenc", "http://schemas.xmlsoap.org/soap/encoding/")]
public class SoapBinding : ServiceDescriptionFormatExtension

NameDescription
System_CAPS_pubmethodSoapBinding()

Initializes an instance of the SoapBinding class.

NameDescription
System_CAPS_pubpropertyHandled

Gets or sets a value indicating whether the ServiceDescriptionFormatExtension is used by the import process when the extensibility element is imported.(Inherited from ServiceDescriptionFormatExtension.)

System_CAPS_pubpropertyParent
System_CAPS_pubpropertyRequired

Gets or sets a value indicating whether the ServiceDescriptionFormatExtension is necessary for the action to which it refers.(Inherited from ServiceDescriptionFormatExtension.)

System_CAPS_pubpropertySystem_CAPS_staticSchema

Gets the binding schema that is to be used to transmit data by using the SOAP protocol version 1.1.

System_CAPS_pubpropertyStyle

Specifies the type of SOAP binding used by the current SoapBinding.

System_CAPS_pubpropertyTransport

Gets or sets the URI with the specification for HTTP transmission of SOAP data.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticHttpTransport

Gets the URI for the standard protocol specifying HTTP transmission of SOAP data. This field is constant.

System_CAPS_pubfieldSystem_CAPS_staticNamespace

Gets 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 01DFC27C-C68E-4910-A0AA-5E4C2A766B0C. For more information about Web Services Description Language (WSDL), see the specification at http://www.w3.org/TR/wsdl/.


using System;
using System.Web.Services.Description;
using System.Collections;
using System.Xml;

   class MySoapClass
   {
      public static void Main()
      {
         ServiceDescription myDescription =
                     ServiceDescription.Read("AddNumbersInput_cs.wsdl");
         // Create a 'Binding' object for the 'SOAP' protocol.
         Binding myBinding = new Binding();
         myBinding.Name = "Service1Soap";
         XmlQualifiedName qualifiedName =
                     new XmlQualifiedName("s0:Service1Soap");
         myBinding.Type = qualifiedName;

         SoapBinding mySoapBinding = new SoapBinding();
         mySoapBinding.Transport = SoapBinding.HttpTransport;
         mySoapBinding.Style = SoapBindingStyle.Document;
         // Add the 'SoapBinding' object to the 'Binding' object.
         myBinding.Extensions.Add(mySoapBinding);

         // Create the 'OperationBinding' object for the 'SOAP' protocol.
         OperationBinding myOperationBinding = new OperationBinding();
         myOperationBinding.Name = "AddNumbers";

         // Create the 'SoapOperationBinding' object for the 'SOAP' protocol.
         SoapOperationBinding mySoapOperationBinding =
                                          new SoapOperationBinding();
         mySoapOperationBinding.SoapAction  = "http://tempuri.org/AddNumbers";
         mySoapOperationBinding.Style = SoapBindingStyle.Document;
         // Add the 'SoapOperationBinding' object to 'OperationBinding' object.
         myOperationBinding.Extensions.Add(mySoapOperationBinding);

         // Create the 'InputBinding' object for the 'SOAP' protocol.
         InputBinding myInput = new InputBinding();
         SoapBodyBinding mySoapBinding1 = new SoapBodyBinding();
         mySoapBinding1.Use= SoapBindingUse.Literal;
         myInput.Extensions.Add(mySoapBinding1);
         // Assign the 'InputBinding' to 'OperationBinding'.
         myOperationBinding.Input = myInput;
         // Create the 'OutputBinding' object' for the 'SOAP' protocol..
         OutputBinding myOutput = new OutputBinding();
         myOutput.Extensions.Add(mySoapBinding1);
          // Assign the 'OutPutBinding' to 'OperationBinding'.
         myOperationBinding.Output = myOutput; 

         // Add the 'OperationBinding' to 'Binding'.
         myBinding.Operations.Add(myOperationBinding);

          // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'.
         myDescription.Bindings.Add(myBinding);

         Port soapPort = new Port();
         soapPort.Name = "Service1Soap";
         soapPort.Binding = new XmlQualifiedName("s0:Service1Soap");

         // Create a 'SoapAddressBinding' object for the 'SOAP' protocol.
         SoapAddressBinding mySoapAddressBinding = 
                                       new SoapAddressBinding();
         mySoapAddressBinding.Location = "http://localhost/AddNumbers.cs.asmx";

         // Add the 'SoapAddressBinding' to the 'Port'.
         soapPort.Extensions.Add(mySoapAddressBinding);

         // Add the 'Port' to 'PortCollection' of 'ServiceDescription'.
         myDescription.Services[0].Ports.Add(soapPort);

         // Write the 'ServiceDescription' as a WSDL file.
         myDescription.Write("AddNumbersOut_cs.wsdl");
         Console.WriteLine(" 'AddNumbersOut_cs.Wsdl' file was generated");
    }
}

.NET Framework
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.

Return to top
Show:
© 2016 Microsoft