SoapHeaderBinding Classe
Definição
Representa um elemento de extensibilidade adicionado a um InputBinding ou um OutputBinding em um serviço Web XML.Represents an extensibility element added to an InputBinding or an OutputBinding within an XML Web service.
public ref class SoapHeaderBinding : System::Web::Services::Description::ServiceDescriptionFormatExtension
[System.Web.Services.Configuration.XmlFormatExtension("header", "http://schemas.xmlsoap.org/wsdl/soap/", typeof(System.Web.Services.Description.InputBinding), typeof(System.Web.Services.Description.OutputBinding))]
public class SoapHeaderBinding : System.Web.Services.Description.ServiceDescriptionFormatExtension
[<System.Web.Services.Configuration.XmlFormatExtension("header", "http://schemas.xmlsoap.org/wsdl/soap/", typeof(System.Web.Services.Description.InputBinding), typeof(System.Web.Services.Description.OutputBinding))>]
type SoapHeaderBinding = class
inherit ServiceDescriptionFormatExtension
Public Class SoapHeaderBinding
Inherits ServiceDescriptionFormatExtension
- Herança
- Derivado
- Atributos
Exemplos
#using <System.dll>
#using <System.Web.Services.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::Web::Services::Description;
using namespace System::Collections;
using namespace System::Xml;
int main()
{
ServiceDescription^ myServiceDescription = ServiceDescription::Read( "SoapHeaderBindingInput_cpp.wsdl" );
Binding^ myBinding = gcnew Binding;
myBinding->Name = "MyWebServiceSoap";
myBinding->Type = gcnew XmlQualifiedName( "s0:MyWebServiceSoap" );
SoapBinding^ mySoapBinding = gcnew SoapBinding;
mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http";
mySoapBinding->Style = SoapBindingStyle::Document;
myBinding->Extensions->Add( mySoapBinding );
OperationBinding^ myOperationBinding = gcnew OperationBinding;
myOperationBinding->Name = "Hello";
SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding;
mySoapOperationBinding->SoapAction = "http://tempuri.org/Hello";
mySoapOperationBinding->Style = SoapBindingStyle::Document;
myOperationBinding->Extensions->Add( mySoapOperationBinding );
// Create InputBinding for operation for the 'SOAP' protocol.
InputBinding^ myInputBinding = gcnew InputBinding;
SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding;
mySoapBodyBinding->Use = SoapBindingUse::Literal;
myInputBinding->Extensions->Add( mySoapBodyBinding );
SoapHeaderBinding^ mySoapHeaderBinding = gcnew SoapHeaderBinding;
mySoapHeaderBinding->Message = gcnew XmlQualifiedName( "s0:HelloMyHeader" );
mySoapHeaderBinding->Part = "MyHeader";
mySoapHeaderBinding->Use = SoapBindingUse::Literal;
// Add mySoapHeaderBinding to 'myInputBinding' object.
myInputBinding->Extensions->Add( mySoapHeaderBinding );
// Create OutputBinding for operation for the 'SOAP' protocol.
OutputBinding^ myOutputBinding = gcnew OutputBinding;
myOutputBinding->Extensions->Add( mySoapBodyBinding );
// Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'.
myOperationBinding->Input = myInputBinding;
myOperationBinding->Output = myOutputBinding;
myBinding->Operations->Add( myOperationBinding );
myServiceDescription->Bindings->Add( myBinding );
myServiceDescription->Write( "SoapHeaderBindingOut_cpp.wsdl" );
Console::WriteLine( "'SoapHeaderBindingOut_cpp.wsdl' file is generated." );
Console::WriteLine( "Proxy could be created using 'wsdl SoapHeaderBindingOut_cpp.wsdl'." );
}
using System;
using System.Web.Services.Description;
using System.Collections;
using System.Xml;
public class MySampleClass
{
public static void Main()
{
ServiceDescription myServiceDescription =
ServiceDescription.Read("SoapHeaderBindingInput_cs.wsdl");
Binding myBinding = new Binding();
myBinding.Name = "MyWebServiceSoap";
myBinding.Type =new XmlQualifiedName("s0:MyWebServiceSoap");
SoapBinding mySoapBinding =new SoapBinding();
mySoapBinding.Transport="http://schemas.xmlsoap.org/soap/http";
mySoapBinding.Style=SoapBindingStyle.Document;
myBinding.Extensions.Add(mySoapBinding);
OperationBinding myOperationBinding = new OperationBinding();
myOperationBinding.Name = "Hello";
SoapOperationBinding mySoapOperationBinding =
new SoapOperationBinding();
mySoapOperationBinding.SoapAction = "http://tempuri.org/Hello";
mySoapOperationBinding.Style=SoapBindingStyle.Document;
myOperationBinding.Extensions.Add(mySoapOperationBinding);
// Create InputBinding for operation for the 'SOAP' protocol.
InputBinding myInputBinding = new InputBinding();
SoapBodyBinding mySoapBodyBinding = new SoapBodyBinding();
mySoapBodyBinding.Use = SoapBindingUse.Literal;
myInputBinding.Extensions.Add(mySoapBodyBinding);
SoapHeaderBinding mySoapHeaderBinding=new SoapHeaderBinding();
mySoapHeaderBinding.Message=new XmlQualifiedName("s0:HelloMyHeader");
mySoapHeaderBinding.Part="MyHeader";
mySoapHeaderBinding.Use=SoapBindingUse.Literal;
// Add mySoapHeaderBinding to 'myInputBinding' object.
myInputBinding.Extensions.Add(mySoapHeaderBinding);
// Create OutputBinding for operation for the 'SOAP' protocol.
OutputBinding myOutputBinding = new OutputBinding();
myOutputBinding.Extensions.Add(mySoapBodyBinding);
// Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'.
myOperationBinding.Input = myInputBinding;
myOperationBinding.Output = myOutputBinding;
myBinding.Operations.Add(myOperationBinding);
myServiceDescription.Bindings.Add(myBinding);
myServiceDescription.Write("SoapHeaderBindingOut_cs.wsdl");
Console.WriteLine("'SoapHeaderBindingOut_cs.wsdl' file is generated.");
Console.WriteLine("Proxy could be created using "
+"'wsdl SoapHeaderBindingOut_cs.wsdl'.");
}
}
Imports System.Web.Services.Description
Imports System.Collections
Imports System.Xml
Public Class MySampleClass
Public Shared Sub Main()
Dim myServiceDescription As ServiceDescription = _
ServiceDescription.Read("SoapHeaderBindingInput_vb.wsdl")
Dim myBinding As New Binding()
myBinding.Name = "MyWebServiceSoap"
myBinding.Type = New XmlQualifiedName("s0:MyWebServiceSoap")
Dim mySoapBinding As New SoapBinding()
mySoapBinding.Transport = "http://schemas.xmlsoap.org/soap/http"
mySoapBinding.Style = SoapBindingStyle.Document
myBinding.Extensions.Add(mySoapBinding)
Dim myOperationBinding As New OperationBinding()
myOperationBinding.Name = "Hello"
Dim mySoapOperationBinding As New SoapOperationBinding()
mySoapOperationBinding.SoapAction = "http://tempuri.org/Hello"
mySoapOperationBinding.Style = SoapBindingStyle.Document
myOperationBinding.Extensions.Add(mySoapOperationBinding)
' Create InputBinding for operation for the 'SOAP' protocol.
Dim myInputBinding As New InputBinding()
Dim mySoapBodyBinding As New SoapBodyBinding()
mySoapBodyBinding.Use = SoapBindingUse.Literal
myInputBinding.Extensions.Add(mySoapBodyBinding)
Dim mySoapHeaderBinding As New SoapHeaderBinding()
mySoapHeaderBinding.Message = New XmlQualifiedName("s0:HelloMyHeader")
mySoapHeaderBinding.Part = "MyHeader"
mySoapHeaderBinding.Use = SoapBindingUse.Literal
' Add mySoapHeaderBinding to 'myInputBinding' object.
myInputBinding.Extensions.Add(mySoapHeaderBinding)
' Create OutputBinding for operation for the 'SOAP' protocol.
Dim myOutputBinding As New OutputBinding()
myOutputBinding.Extensions.Add(mySoapBodyBinding)
' Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'.
myOperationBinding.Input = myInputBinding
myOperationBinding.Output = myOutputBinding
myBinding.Operations.Add(myOperationBinding)
myServiceDescription.Bindings.Add(myBinding)
myServiceDescription.Write("SoapHeaderBindingOut_vb.wsdl")
Console.WriteLine("'SoapHeaderBindingOut_vb.wsdl' file is generated.")
Console.WriteLine("Proxy could be created using " + _
"'wsdl /language:VB SoapHeaderBindingOut_vb.wsdl'.")
End Sub
End Class
Comentários
Para obter mais informações sobre como especificar protocolos para serviços Web XML, consulte Serviços Web XML usando ASP.net.For more information about specifying protocols for XML Web services, see XML Web Services Using ASP.NET. Para obter mais informações sobre WSDL (Web Services Description Language), consulte a especificação WSDL .For more information about Web Services Description Language (WSDL), see the WSDL specification.
Construtores
| SoapHeaderBinding() |
Inicializa uma nova instância da classe SoapHeaderBinding.Initializes a new instance of the SoapHeaderBinding class. |
Propriedades
| Encoding |
Obtém ou define um URI que representa o estilo de codificação usado para codificar a mensagem de cabeçalho SOAP.Gets or sets a URI representing the encoding style used to encode the SOAP header. |
| Fault |
Obtém ou define o tipo de extensão que controla a saída em um documento WSDL para o elemento XML |
| Handled |
Obtém ou define um valor que indica se o ServiceDescriptionFormatExtension é usado pelo processo de importação quando o elemento de extensibilidade é importado.Gets or sets a value indicating whether the ServiceDescriptionFormatExtension is used by the import process when the extensibility element is imported. (Herdado de ServiceDescriptionFormatExtension) |
| MapToProperty |
Obtém ou define um valor que indica se a instância de SoapHeaderBinding é mapeada para uma propriedade específica em classes de proxy geradas.Gets or sets a value indicating whether the SoapHeaderBinding instance is mapped to a specific property in generated proxy classes. |
| Message |
Obtém ou define um valor que especifica o nome do Message dentro do serviço Web XML ao qual o SoapHeaderBinding se aplica.Gets or sets a value specifying the name of the Message within the XML Web service to which the SoapHeaderBinding applies. |
| Namespace |
Obtém ou define o URI que representa o local da especificação para codificar o conteúdo não especificamente definido pela propriedade Encoding.Get or sets the URI representing the location of the specification for encoding of content not specifically defined by the Encoding property. |
| Parent |
Obtém o pai do ServiceDescriptionFormatExtension.Gets the parent of the ServiceDescriptionFormatExtension. (Herdado de ServiceDescriptionFormatExtension) |
| Part |
Obtém ou define um valor que indica a qual MessagePart dentro do serviço Web XML o SoapHeaderBinding se aplica.Gets or sets a value indicating to which MessagePart within the XML Web service the SoapHeaderBinding applies. |
| Required |
Obtém ou define um valor que indica se o ServiceDescriptionFormatExtension é necessário para a ação à qual ele se refere.Gets or sets a value indicating whether the ServiceDescriptionFormatExtension is necessary for the action to which it refers. (Herdado de ServiceDescriptionFormatExtension) |
| Use |
Especifica se o cabeçalho é codificado usando as regras especificadas pela propriedade Encoding ou se é encapsulado em um esquema XML concreto.Specifies whether the header is encoded using rules specified by the Encoding property, or is encapsulated within a concrete XML schema. |
Métodos
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object. (Herdado de Object) |
| GetHashCode() |
Serve como a função de hash padrão.Serves as the default hash function. (Herdado de Object) |
| GetType() |
Obtém o Type da instância atual.Gets the Type of the current instance. (Herdado de Object) |
| MemberwiseClone() |
Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object. (Herdado de Object) |
| ToString() |
Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object. (Herdado de Object) |