SoapHeaderBinding Class
Represents an extensibility element added to an InputBinding or an OutputBinding within an XML Web service.
For a list of all members of this type, see SoapHeaderBinding Members.
System.Object
System.Web.Services.Description.ServiceDescriptionFormatExtension
System.Web.Services.Description.SoapHeaderBinding
[Visual Basic] Public Class SoapHeaderBinding Inherits ServiceDescriptionFormatExtension [C#] public class SoapHeaderBinding : ServiceDescriptionFormatExtension [C++] public __gc class SoapHeaderBinding : public ServiceDescriptionFormatExtension [JScript] public class SoapHeaderBinding extends ServiceDescriptionFormatExtension
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
For more information about specifying protocols for XML Web services, see Building XML Web Services Using ASP.NET. For more information about Web Services Description Language (WSDL), see the specification at http://www.w3.org/TR/wsdl/.
Example
[Visual Basic] Imports System 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 'Main End Class 'MySampleClass [C#] 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'."); } } [C++] #using <mscorlib.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(S"SoapHeaderBindingInput_cpp.wsdl"); Binding* myBinding = new Binding(); myBinding->Name = S"MyWebServiceSoap"; myBinding->Type = new XmlQualifiedName(S"s0:MyWebServiceSoap"); SoapBinding* mySoapBinding = new SoapBinding(); mySoapBinding->Transport=S"http://schemas.xmlsoap.org/soap/http"; mySoapBinding->Style=SoapBindingStyle::Document; myBinding->Extensions->Add(mySoapBinding); OperationBinding* myOperationBinding = new OperationBinding(); myOperationBinding->Name = S"Hello"; SoapOperationBinding* mySoapOperationBinding = new SoapOperationBinding(); mySoapOperationBinding->SoapAction = S"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(S"s0:HelloMyHeader"); mySoapHeaderBinding->Part=S"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(S"SoapHeaderBindingOut_cpp.wsdl"); Console::WriteLine(S"'SoapHeaderBindingOut_cpp.wsdl' file is generated."); Console::WriteLine(S"Proxy could be created using 'wsdl SoapHeaderBindingOut_cpp.wsdl'."); }
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.Web.Services.Description
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System.Web.Services (in System.Web.Services.dll)
See Also
SoapHeaderBinding Members | System.Web.Services.Description Namespace