SoapHeaderBinding Classe
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Rappresenta un elemento di estensibilità aggiunto a un InputBinding o a un OutputBinding all'interno di un servizio Web XML.
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
- Ereditarietà
- Derivato
- Attributi
Esempio
#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
Commenti
Per altre informazioni sulla specifica dei protocolli per i servizi Web XML, vedere Servizi Web XML tramite ASP.NET. Per altre informazioni sul linguaggio WSDL (Web Services Description Language), vedere la specifica WSDL .
Costruttori
SoapHeaderBinding() |
Inizializza una nuova istanza della classe SoapHeaderBinding. |
Proprietà
Encoding |
Ottiene o imposta un URI che rappresenta lo stile di codifica utilizzato per codificare l'intestazione SOAP. |
Fault |
Ottiene o imposta il tipo di estensione che controlla l'output in un documento WSDL per l'elemento XML |
Handled |
Ottiene o imposta un valore che indica se l'oggetto ServiceDescriptionFormatExtension viene utilizzato dal processo di importazione quando vengono importati gli elementi di estensibilità. (Ereditato da ServiceDescriptionFormatExtension) |
MapToProperty |
Ottiene o imposta un valore che indica se l'istanza di SoapHeaderBinding è mappata a una proprietà specifica nelle classi proxy generate. |
Message |
Ottiene o imposta un valore che specifica il nome di Message all'interno del servizio Web XML a cui viene applicato SoapHeaderBinding. |
Namespace |
Ottiene o imposta l'URI che rappresenta il percorso della specifica per la codifica del contenuto non definito in modo specifico dalla proprietà Encoding. |
Parent |
Ottiene l'elemento padre dell'oggetto ServiceDescriptionFormatExtension. (Ereditato da ServiceDescriptionFormatExtension) |
Part |
Ottiene o imposta un valore che indica a quale oggetto MessagePart all'interno del servizio Web XML viene applicato l'oggetto SoapHeaderBinding. |
Required |
Ottiene o imposta un valore che indica se l'oggetto ServiceDescriptionFormatExtension è necessario per l'azione a cui fa riferimento. (Ereditato da ServiceDescriptionFormatExtension) |
Use |
Specifica se l'intestazione viene codificata utilizzando regole specificate dalla proprietà Encoding o se è incapsulata all'interno di uno schema XML concreto. |
Metodi
Equals(Object) |
Determina se l'oggetto specificato è uguale all'oggetto corrente. (Ereditato da Object) |
GetHashCode() |
Funge da funzione hash predefinita. (Ereditato da Object) |
GetType() |
Ottiene l'oggetto Type dell'istanza corrente. (Ereditato da Object) |
MemberwiseClone() |
Crea una copia superficiale dell'oggetto Object corrente. (Ereditato da Object) |
ToString() |
Restituisce una stringa che rappresenta l'oggetto corrente. (Ereditato da Object) |