Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
SoapBodyBinding Class
Collapse the table of content
Expand the table of content

SoapBodyBinding Class

Represents an extensibility element added to an InputBinding or an OutputBinding.

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

[XmlFormatExtensionAttribute("body", "http://schemas.xmlsoap.org/wsdl/soap/", 
	typeof(InputBinding), typeof(OutputBinding), typeof(MimePart))]
public class SoapBodyBinding : ServiceDescriptionFormatExtension

The SoapBodyBinding type exposes the following members.

Public methodSoapBodyBindingInitializes a new instance of the SoapBodyBinding class.

Public propertyEncodingGets or sets a string containing a list of space-delimited URIs. The URIs represent the encoding style (or styles) to be used to encode messages within the SOAP body.
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 propertyNamespaceGet or sets the URI representing the location of the specifications for encoding of content not specifically defined by the Encoding property.
Public propertyParentGets the parent of the ServiceDescriptionFormatExtension. (Inherited from ServiceDescriptionFormatExtension.)
Public propertyPartsGets or sets a value indicating which parts of the transmitted message appear within the SOAP body portion of the transmission.
Public propertyPartsStringGets or sets a value indicating which parts of the transmitted message appear within the SOAP body portion of the transmission.
Public propertyRequiredGets or sets a value indicating whether the ServiceDescriptionFormatExtension is necessary for the action to which it refers. (Inherited from ServiceDescriptionFormatExtension.)
Public propertyUseIndicates whether the message parts are encoded using specified encoding rules, or define the concrete schema of the message.

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.)

This class specifies how messages, either abstract type definitions or concrete schema definitions, appear within the SOAP body element of the transmission.

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/.

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

   class MySoapClass
      public static void Main()
         ServiceDescription myDescription =
         // 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.

         // 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.

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

         // Add the 'OperationBinding' to 'Binding'.

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

         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'.

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

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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