SoapBodyBinding Clase
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Representa un elemento de extensibilidad agregado a un objeto InputBinding o a OutputBinding.
public ref class SoapBodyBinding : System::Web::Services::Description::ServiceDescriptionFormatExtension
[System.Web.Services.Configuration.XmlFormatExtension("body", "http://schemas.xmlsoap.org/wsdl/soap/", typeof(System.Web.Services.Description.InputBinding), typeof(System.Web.Services.Description.OutputBinding), typeof(System.Web.Services.Description.MimePart))]
public class SoapBodyBinding : System.Web.Services.Description.ServiceDescriptionFormatExtension
[<System.Web.Services.Configuration.XmlFormatExtension("body", "http://schemas.xmlsoap.org/wsdl/soap/", typeof(System.Web.Services.Description.InputBinding), typeof(System.Web.Services.Description.OutputBinding), typeof(System.Web.Services.Description.MimePart))>]
type SoapBodyBinding = class
inherit ServiceDescriptionFormatExtension
Public Class SoapBodyBinding
Inherits ServiceDescriptionFormatExtension
- Herencia
- Derivado
- Atributos
Ejemplos
#using <System.Xml.dll>
#using <System.Web.Services.dll>
#using <System.dll>
using namespace System;
using namespace System::Web::Services::Description;
using namespace System::Collections;
using namespace System::Xml;
int main()
{
ServiceDescription^ myDescription = ServiceDescription::Read( "AddNumbersInput_cs.wsdl" );
// Create a 'Binding' object for the 'SOAP' protocol.
Binding^ myBinding = gcnew Binding;
myBinding->Name = "Service1Soap";
XmlQualifiedName^ qualifiedName = gcnew XmlQualifiedName( "s0:Service1Soap" );
myBinding->Type = qualifiedName;
SoapBinding^ mySoapBinding = gcnew 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 = gcnew OperationBinding;
myOperationBinding->Name = "AddNumbers";
// Create the 'SoapOperationBinding' object for the 'SOAP' protocol.
SoapOperationBinding^ mySoapOperationBinding = gcnew 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 = gcnew InputBinding;
SoapBodyBinding^ mySoapBinding1 = gcnew 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 = gcnew 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 = gcnew Port;
soapPort->Name = "Service1Soap";
soapPort->Binding = gcnew XmlQualifiedName( "s0:Service1Soap" );
// Create a 'SoapAddressBinding' object for the 'SOAP' protocol.
SoapAddressBinding^ mySoapAddressBinding = gcnew 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" );
}
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");
}
}
Imports System.Web.Services.Description
Imports System.Collections
Imports System.Xml
Class MySoapClass
Public Shared Sub Main()
Dim myDescription As ServiceDescription = _
ServiceDescription.Read("AddNumbersInput_vb.wsdl")
' 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.
myBinding.Extensions.Add(mySoapBinding)
' 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.
myOperationBinding.Extensions.Add(mySoapOperationBinding)
' Create the 'InputBinding' object for the 'SOAP' protocol.
Dim myInput As New InputBinding()
Dim mySoapBinding1 As 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.
Dim myOutput As 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)
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'.
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_vb.wsdl")
Console.WriteLine(" 'AddNumbersOut_vb.Wsdl' file was generated")
End Sub
End Class
Comentarios
Esta clase especifica cómo aparecen los mensajes, ya sea definiciones de tipos abstractos o definiciones de esquema concretas, dentro del elemento de cuerpo SOAP de la transmisión.
Para obtener más información sobre cómo especificar protocolos para servicios web XML, vea Servicios web XML mediante ASP.NET. Para obtener más información sobre el lenguaje de descripción de servicios web (WSDL), consulte la especificación WSDL .
Constructores
SoapBodyBinding() |
Inicializa una nueva instancia de la clase SoapBodyBinding. |
Propiedades
Encoding |
Obtiene o establece una cadena que contiene una lista de identificadores URI delimitados por espacios. Los identificadores URI representan el estilo o estilos de codificación que se van a utilizar para codificar mensajes dentro del cuerpo SOAP. |
Handled |
Obtiene o establece un valor que indica si ServiceDescriptionFormatExtension se utiliza en el proceso de importación cuando se importa el elemento de extensibilidad. (Heredado de ServiceDescriptionFormatExtension) |
Namespace |
Obtiene o establece el identificador URI que representa la ubicación de las especificaciones correspondientes a la codificación del contenido no definido específicamente por la propiedad Encoding. |
Parent |
Obtiene el objeto principal de ServiceDescriptionFormatExtension. (Heredado de ServiceDescriptionFormatExtension) |
Parts |
Obtiene o establece un valor que indica las partes del mensaje transmitido que aparecen en el cuerpo SOAP de la transmisión. |
PartsString |
Obtiene o establece un valor que indica las partes del mensaje transmitido que aparecen en el cuerpo SOAP de la transmisión. |
Required |
Obtiene o establece un valor que indica si ServiceDescriptionFormatExtension es necesario para la acción a la que hace referencia. (Heredado de ServiceDescriptionFormatExtension) |
Use |
Indica si las partes del mensaje se codifican mediante las reglas de codificación especificadas o definen el esquema concreto del mensaje. |
Métodos
Equals(Object) |
Determina si el objeto especificado es igual que el objeto actual. (Heredado de Object) |
GetHashCode() |
Sirve como la función hash predeterminada. (Heredado de Object) |
GetType() |
Obtiene el Type de la instancia actual. (Heredado de Object) |
MemberwiseClone() |
Crea una copia superficial del Object actual. (Heredado de Object) |
ToString() |
Devuelve una cadena que representa el objeto actual. (Heredado de Object) |