{"id":1380,"date":"2013-07-26T07:14:06","date_gmt":"2013-07-26T07:14:06","guid":{"rendered":"http:\/\/fanzung.com\/?p=1380"},"modified":"2013-08-01T15:11:47","modified_gmt":"2013-08-01T15:11:47","slug":"using-soap-headers","status":"publish","type":"post","link":"https:\/\/dongson.info\/?p=1380","title":{"rendered":"Using SOAP Headers"},"content":{"rendered":"<div>\n<h1>Using SOAP Headers<\/h1>\n<div>\n<div id=\"curversion\"><strong> .NET Framework 1.1 <\/strong><\/div>\n<div id=\"versionclick\"><\/div>\n<\/div>\n<div id=\"nstext\">\n<p>Communicating with an XML Web service method using SOAP follows a standard format. Part of this format is the data that is encoded in an XML document. The XML document consists of a root <strong>Envelope<\/strong> tag, which in turn consists of a required <strong>Body<\/strong> element and an optional <strong>Header<\/strong> element. The <strong>Body<\/strong> element comprises the data specific to the message. The optional <strong>Header<\/strong> element can contain additional information not directly related to the particular message. Each child element of the <strong>Header<\/strong> element is called a SOAP header.<\/p>\n<p>Although the SOAP headers can contain data related to the message, as the SOAP specification doesn&#8217;t strictly define the contents of a SOAP header, they typically contain information processed by infrastructure within a Web server. An example of how a SOAP header can be used is to supply routing information for the SOAP message within the SOAP header.<\/p>\n<h2>Defining and Processing SOAP Headers<\/h2>\n<p>XML Web services created using ASP.NET can define and manipulate SOAP headers. Defining a SOAP header is accomplished by defining a class representing the data in a particular SOAP header and deriving it from the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.web.services.protocols.soapheader%28v=vs.71%29.aspx\">SoapHeader<\/a> class.<\/p>\n<p><strong>To define a class representing a SOAP header<\/strong><\/p>\n<ol type=\"1\">\n<li>Create a class deriving from the <strong>SoapHeader<\/strong>class with a name matching the root element for the SOAP header.\n<div id=\"code-snippet-1\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_153e4ad5-8dd6-41fa-9204-a12e5a247813\" dir=\"ltr\">\n<div>\n<pre>public class MyHeader : SoapHeader\r\n[Visual\u00a0Basic]\r\nPublic Class MyHeader : Inherits SoapHeader<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<li>Add public fields or properties, matching the names and their respective data types for each element in the SOAP header.For instance, given the following SOAP header, the class following it defines a class representing the SOAP header.\n<div id=\"code-snippet-2\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_44edeb11-36c7-434a-b308-08e45fd521c1\" dir=\"ltr\">\n<div>\n<pre>public class MyHeader : SoapHeader\r\n{\r\n   public DateTime Created;\r\n   public long Expires;\r\n}\r\n[Visual\u00a0Basic]\r\nPublic Class MyHeader\r\n  Inherits SoapHeader\r\n    Public Created As DateTime\r\n    Public Expires As Long\r\nEnd Class<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<\/ol>\n<p><strong>To process SOAP headers within an XML Web service<\/strong><\/p>\n<ol type=\"1\">\n<li>Add a public member to the class implementing the XML Web service of the type representing the SOAP header.\n<div id=\"code-snippet-3\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_3fbd65fb-b23e-4521-a026-30e9c1efdb0f\" dir=\"ltr\">\n<div>\n<pre>[WebService(Namespace=\"http:\/\/www.contoso.com\")]\r\npublic class MyWebService\r\n{\r\n    \/\/ Add a member variable of the type deriving from SoapHeader.\r\n    public MyHeader timeStamp;\r\n[Visual\u00a0Basic]\r\n&lt;WebService(Namespace:=\"http:\/\/www.contoso.com\")&gt; _\r\nPublic Class MyWebService\r\n    ' Add a member variable of the type deriving from SoapHeader.\r\n    Public TimeStamp As MyHeader<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<li>Apply a <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.web.services.protocols.soapheaderattribute%28v=vs.71%29.aspx\">SoapHeader<\/a> attribute to each XML Web service method that intends to process the SOAP header. Set the <strong>MemberName<\/strong> property of the <strong>SoapHeader<\/strong>attribute to the name of the member variable created in the first step.\n<div id=\"code-snippet-4\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_e8aa0cdb-b2b7-477e-a99c-6679d7d90c48\" dir=\"ltr\">\n<div>\n<pre>[WebMethod]\r\n[SoapHeader(\"timeStamp\")]\r\npublic void MyWebMethod()\r\n[Visual\u00a0Basic]\r\n&lt;WebMethod, SoapHeader(\"TimeStamp\")&gt; _\r\nPublic Sub MyWebMethod()<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<li>Within each XML Web service method that the <strong>SoapHeader<\/strong>attribute is applied to, access the member variable created in the first step to process the data sent in the SOAP header.\n<div id=\"code-snippet-5\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_29c52dbf-592c-4065-b24a-f47ab1f5cde4\" dir=\"ltr\">\n<div>\n<pre>[WebMethod]\r\n[SoapHeader(\"timeStamp\",\r\n            Direction=SoapHeaderDirection.InOut)]\r\npublic string MyWebMethod()\r\n{\r\n  \/\/ Verify that the client sent the SOAP Header.\r\n  if (timeStamp == null)\r\n  {\r\n     timeStamp = new MyHeader();\r\n  }\r\n  \/\/ Set the value of the SoapHeader returned\r\n  \/\/ to the client.\r\n  timeStamp.Expires = 60000;\r\n  timeStamp.Created = DateTime.UtcNow;\r\n\r\n  return \"Hello World\";\r\n}\r\n[Visual\u00a0Basic]\r\n&lt;WebMethod,SoapHeader(\"TimeStamp\", _\r\n                      Direction:=SoapHeaderDirection.InOut)&gt; _\r\nPublic Function MyWebMethod() As String\r\n   ' Verify that the client sent the SOAP Header.\r\n   If (TimeStamp Is Nothing) Then\r\n      TimeStamp = New MyHeader\r\n   End If\r\n\r\n   ' Set the value of the SoapHeader returned\r\n   ' to the client.\r\n   TimeStamp.Expires = 60000\r\n   TimeStamp.Created = DateTime.UtcNow\r\n\r\n   Return \"Hello World\"\r\nEnd Function<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<\/ol>\n<p>The following code example demonstrates how to define and process a SOAP header in an XML Web service created using ASP.NET. The <code>MyWebService<\/code> XML Web service has a member variable named <code>timeStamp<\/code>, which is of a type deriving from <strong>SoapHeader<\/strong> (<code>MyHeader<\/code>) and set to the <strong>MemberName<\/strong> property of the <strong>SoapHeader<\/strong> attribute. In addition, a <strong>SoapHeader<\/strong> attribute is applied to the <code>MyWebMethod<\/code> XML Web service method specifying <code>myHeaderMemberVariable<\/code>. Within the <code>MyWebMethod<\/code> XML Web service method, <code>myHeaderMemberVariable<\/code> is accessed to set the value of the <code>Created<\/code> and <code>Expires<\/code> XML elements of the SOAP header.<\/p>\n<div id=\"code-snippet-6\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_b523f27f-82ca-4a70-a53c-86409e95304a\" dir=\"ltr\">\n<div>\n<pre>&lt;%@ WebService Language=\"C#\" Class=\"MyWebService\" %&gt;\r\nusing System;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\n\r\n\/\/ Define a SOAP header by deriving from the SoapHeader class.\r\npublic class MyHeader : SoapHeader\r\n{\r\n   public DateTime Created;\r\n   public long Expires;\r\n}\r\n\r\n[WebService(Namespace=\"http:\/\/www.contoso.com\")]\r\npublic class MyWebService : System.Web.Services.WebService\r\n{\r\n   \/\/ Add a member variable of the type deriving from SoapHeader.\r\n   public MyHeader timeStamp;\r\n\r\n   \/\/ Apply a SoapHeader attribute.\r\n   [WebMethod]\r\n   [SoapHeader(\"timeStamp\", Direction=SoapHeaderDirection.InOut)]\r\n   public string HelloWorld()\r\n   {\r\n      if (timeStamp == null)\r\n         timeStamp = new MyHeader();\r\n\r\n      timeStamp.Expires = 60000;\r\n      timeStamp.Created = DateTime.UtcNow;\r\n\r\n      return \"Hello World\";\r\n   }\r\n}\r\n[Visual\u00a0Basic]\r\n&lt;%@ WebService Language=\"VB\" Class=\"MyWebService\" %&gt;\r\nImports System\r\nImports System.Web.Services\r\nImports System.Web.Services.Protocols\r\n\r\n' Define a SOAP header by deriving from the SoapHeader class.\r\nPublic Class MyHeader\r\n    Inherits SoapHeader\r\n    Public Created As DateTime\r\n    Public Expires As Long\r\nEnd Class\r\n\r\n&lt;WebService(Namespace:=\"http:\/\/www.contoso.com\")&gt; _\r\nPublic Class MyWebService\r\n    Inherits System.Web.Services.WebService\r\n\r\n    ' Add a member variable of the type deriving from SoapHeader.\r\n    Public timeStamp As MyHeader\r\n\r\n    ' Apply a SoapHeader attribute.\r\n    &lt;WebMethod(), _\r\n     SoapHeader(\"timeStamp\", Direction:=SoapHeaderDirection.InOut)&gt; _\r\n    Public Function HelloWorld() As String\r\n\r\n        If (timeStamp Is Nothing) Then\r\n            timeStamp = New MyHeader\r\n        End If\r\n\r\n        timeStamp.Expires = 60000\r\n        timeStamp.Created = DateTime.UtcNow\r\n\r\n        Return \"Hello World\"\r\n    End Function\r\nEnd Class<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>In the previous example, a SOAP response is returned to the client with the <code>Expires<\/code> element set to 60000 (number of milliseconds, so 1 minute) and the <code>Created<\/code> element to the current time in coordinated universal time. That is, the following SOAP response is sent to the client.<\/p>\n<div id=\"code-snippet-7\">\n<div><\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_cec953f9-743e-4936-8adb-c440ad78fa97\" dir=\"ltr\">\n<div>\n<pre>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;soap:Envelope xmlns:soap=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\"&gt;\r\n  &lt;soap:Header&gt;\r\n    &lt;MyHeader xmlns=\"http:\/\/www.contoso.com\"&gt;\r\n      &lt;Created&gt;dateTime&lt;\/Created&gt;\r\n      &lt;Expires&gt;long&lt;\/Expires&gt;\r\n    &lt;\/MyHeader&gt;\r\n  &lt;\/soap:Header&gt;\r\n  &lt;soap:Body&gt;\r\n    &lt;MyWebMethod xmlns=\"http:\/\/www.contoso.com\" \/&gt;\r\n  &lt;\/soap:Body&gt;\r\n&lt;\/soap:Envelope&gt;<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3>Building a Client that Processes SOAP Headers<\/h3>\n<p>An XML Web services client can send and receive SOAP headers when communicating with an XML Web service. When a proxy class is generated for an XML Web service expecting or returning SOAP headers using the Wsdl.exe utility, the proxy class includes information about the SOAP headers. Specifically, the proxy class has member variables representing the SOAP headers that correlate to those found in the XML Web service. The proxy class also has definitions for the corresponding classes representing the SOAP header. For example, proxy classes generated for the previous XML Web service will have a member variable of type <code>MyHeader<\/code> and a definition for the <code>MyHeader<\/code> class. For details on creating a proxy class, see <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/d2s8y7bs%28v=vs.71%29.aspx\">Creating an XML Web Service Proxy<\/a>.<\/p>\n<p>Note: If the XML Web service defines the member variables representing the SOAP headers of type <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.web.services.protocols.soapheader%28v=vs.71%29.aspx\">SoapHeader<\/a> or <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.web.services.protocols.soapunknownheader%28v=vs.71%29.aspx\">SoapUnknownHeader<\/a> instead of a class deriving from <strong>SoapHeader<\/strong>, a proxy class will not have any information about that SOAP header.<\/p>\n<p><strong>To process SOAP headers within an XML Web service client<\/strong><\/p>\n<ol type=\"1\">\n<li>Create a new instance of the class representing the SOAP header.\n<div id=\"code-snippet-8\">\n<div>\n<div dir=\"ltr\"><a>VB<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_5c06c364-2a5e-489c-8e88-1e8b2b2f1c76\" dir=\"ltr\">\n<div>\n<pre>Dim mySoapHeader As MyHeader = New MyHeader()\r\n[C#]\r\nMyHeader mySoapHeader = new MyHeader();<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<li>Populate the values for the SOAP header.\n<div id=\"code-snippet-9\">\n<div>\n<div dir=\"ltr\"><a>VB<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_7bbc7945-f38d-4711-bb37-7aa19991182f\" dir=\"ltr\">\n<div>\n<pre>header.Expires = 60000\r\nheader.Created = DateTime.UtcNow\r\n[C#]\r\nheader.Expires = 60000;\r\nheader.Created = DateTime.UtcNow;<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<li>Create a new instance of the proxy class.\n<div id=\"code-snippet-10\">\n<div>\n<div dir=\"ltr\"><a>VB<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_4d7c600a-786a-46f3-88f6-3212ace36354\" dir=\"ltr\">\n<div>\n<pre>Dim proxy As MyWebService = New MyWebService()\r\n[C#]\r\nMyWebService proxy = new MyWebService();<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<li>Assign the SOAP header object to the member variable of the proxy class representing the SOAP header.\n<div id=\"code-snippet-11\">\n<div>\n<div dir=\"ltr\"><a>VB<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_92691905-23d1-47e5-b3d4-2f804336ed58\" dir=\"ltr\">\n<div>\n<pre>proxy.MyHeaderValue = mySoapHeader\r\n[C#]\r\nproxy.MyHeaderValue = mySoapHeader<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<li>Call the method on the proxy class that communicates with the XML Web service method.The SOAP header portion of the SOAP request sent to the XML Web service will include the contents of the data stored in the SOAP header object.\n<div id=\"code-snippet-12\">\n<div>\n<div dir=\"ltr\"><a>VB<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_8942eb85-44a1-45ac-aafc-ce0f347cc1cc\" dir=\"ltr\">\n<div>\n<pre>Dim results as String = proxy.MyWebMethod()\r\n[C#]\r\nstring results = proxy.MyWebMethod();<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<\/ol>\n<p>The following code example demonstrates how to pass a SOAP header from a client to an XML Web service.<\/p>\n<div id=\"code-snippet-13\">\n<div>\n<div dir=\"ltr\"><a>VB<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_5d0142d8-90a7-489d-aa1c-66ea60407c91\" dir=\"ltr\">\n<div>\n<pre>&lt;%@ Page Language=\"VB\" %&gt;\r\n\r\n&lt;asp:Label id=\"ReturnValue\" runat=\"server\" \/&gt;\r\n&lt;script runat=server language=VB&gt;\r\n\r\n Sub Page_Load(o As Object, e As EventArgs)\r\n\r\n  Dim header As MyHeader = New MyHeader()\r\n\r\n  ' Populate the values of the SOAP header.\r\n   header.Expires = 60000\r\n   header.Created = DateTime.UtcNow\r\n\r\n  ' Create a new instance of the proxy class.\r\n  Dim proxy As MyWebService = New MyWebService()\r\n\r\n  ' Add the MyHeader SOAP header to the SOAP request.\r\n  proxy.MyHeaderValue = header\r\n\r\n  ' Call the method on the proxy class that communicates\r\n  ' with your XML Web service method.\r\n  Dim results as String = proxy.MyWebMethod()\r\n\r\n  ' Display the results of the method in a label.\r\n  ReturnValue.Text = results\r\n\r\n End Sub\r\n&lt;\/script&gt;\r\n[C#]\r\n&lt;%@ Page Language=\"C#\" %&gt;\r\n\r\n&lt;asp:Label id=\"ReturnValue\" runat=\"server\" \/&gt;\r\n&lt;script runat=server language=c#&gt;\r\n\r\n void Page_Load(Object o, EventArgs e)\r\n {\r\n\r\n  MyHeader header = new MyHeader();\r\n\r\n  \/\/ Populate the values of the SOAP header.\r\n  header.Expires = 60000;\r\n  header.Created = DateTime.UtcNow;\r\n\r\n  \/\/ Create a new instance of the proxy class.\r\n  MyWebService proxy = new MyWebService();\r\n\r\n  \/\/ Add the MyHeader SOAP header to the SOAP request.\r\n  proxy.MyHeaderValue = header;\r\n\r\n  \/\/ Call the method on the proxy class that communicates\r\n  \/\/ with your XML Web service method.\r\n  string results = proxy.MyWebMethod();\r\n\r\n  \/\/ Display the results of the method in a label.\r\n  ReturnValue.Text = results;\r\n }\r\n&lt;\/script&gt;<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3>Changing the SOAP Headers Recipients<\/h3>\n<p>By default, SOAP headers are sent by an XML Web service client to an XML Web service method when a <strong>SoapHeader<\/strong> attribute is applied to an XML Web service method. However, a SOAP header can also be sent by the XML Web service method back to the XML Web service client. It can also be sent both ways. Setting the <strong>Direction<\/strong> property of a <strong>SoapHeader<\/strong> attribute applied to an XML Web service method controls the recipient of the SOAP header. The <strong>Direction <\/strong>property is of type <strong>SoapHeaderDirection<\/strong>, which has four values: <strong>In<\/strong>, <strong>Out<\/strong>, <strong>InOut<\/strong>, and <strong>Fault<\/strong>. These refer to the recipient (whether it is the XML Web service server), to the client, or both the XML Web service server and client, and whether the SOAP header is sent to the client when an exception is thrown by the XML Web service, respectively.<\/p>\n<p>Note: Version 1.0 of the .NET Framework SDK does not support the <strong>Fault<\/strong> value.<\/p>\n<p><strong>To change the SOAP header recipient<\/strong><\/p>\n<ol type=\"1\">\n<li>Define the SOAP header.\n<div id=\"code-snippet-14\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_c83570a2-81d6-4896-a023-414446f7671a\" dir=\"ltr\">\n<div>\n<pre>public class MyHeader : SoapHeader\r\n{\r\n   public DateTime Created;\r\n   public long Expires;\r\n}\r\n[Visual\u00a0Basic]\r\nPublic Class MyHeader\r\n  Inherits SoapHeader\r\n    Public Created As DateTime\r\n    Public Expires As Long\r\nEnd Class<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<li>Add a member variable to the class implementing the XML Web service.\n<div id=\"code-snippet-15\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_aafb7ab8-e518-41e4-8e9e-19e1b6bd93c0\" dir=\"ltr\">\n<div>\n<pre>[WebService(Namespace=\"http:\/\/www.contoso.com\")]\r\npublic class MyWebService : WebService\r\n{\r\n    public MyHeader myOutHeader;\r\n[Visual\u00a0Basic]\r\n&lt;WebService(Namespace:=\"http:\/\/www.contoso.com\")&gt; _\r\nPublic Class MyWebService\r\n  Inherits WebService\r\n    Public myOutHeader As MyHeader<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<li>Apply a <strong>SoapHeader <\/strong>attribute to each XML Web service method that processes the SOAP header. Set the <strong>Direction<\/strong> property to each intended recipient, using the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.web.services.protocols.soapheaderdirection%28v=vs.71%29.aspx\">SoapHeaderDirection<\/a> enumeration. The following example sets the XML Web service client as the recipient by setting <strong>Direction<\/strong> to <strong>SoapHeaderDirection.Out<\/strong>.\n<div id=\"code-snippet-16\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_399782e2-4f54-4a8a-884e-7e077e6bf21a\" dir=\"ltr\">\n<div>\n<pre>    [WebMethod]\r\n    [SoapHeader(\"myOutHeader\",Direction=SoapHeaderDirection.Out)]\r\n[Visual\u00a0Basic]\r\n    &lt;WebMethod, _\r\n     SoapHeader(\"myOutHeader\",Direction:=SoapHeaderDirection.Out)&gt;<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<li>Process or set the SOAP header, depending on the recipient. The following code example sets the values of the SOAP header, as the recipient is the XML Web service client.\n<div id=\"code-snippet-17\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_43086f85-f071-4a6b-b998-9eae9a84b96b\" dir=\"ltr\">\n<div>\n<pre>\/\/ Set the Time the SOAP message expires.\r\nmyOutHeader.Expires = 60000;\r\nmyOutHeader.Created = DateTime.UtcNow;\r\n[Visual\u00a0Basic]\r\n' Set the Time the SOAP message expires.\r\nmyOutHeader.Expires = 60000\r\nmyOutHeader.Created = DateTime.UtcNow<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<\/ol>\n<p>The following code example defines a <code>MyHeader<\/code> SOAP header that is sent from the XML Web service method to the client.<\/p>\n<div id=\"code-snippet-18\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_f5b20e95-0860-4622-9673-f44fc5bcd97d\" dir=\"ltr\">\n<div>\n<pre>&lt;%@ WebService Language=\"C#\" Class=\"MyWebService\" %&gt;\r\nusing System;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\n\r\n\/\/ Define a SOAP header by deriving from the SoapHeader class.\r\npublic class MyHeader : SoapHeader\r\n{\r\n   public DateTime Created;\r\n   public long Expires;\r\n} \r\n\r\n[WebService(Namespace=\"http:\/\/www.contoso.com\")]\r\npublic class MyWebService : WebService\r\n{\r\n    public MyHeader myOutHeader;\r\n\r\n    [WebMethod]\r\n    [SoapHeader(\"myOutHeader\",Direction=SoapHeaderDirection.Out)]\r\n    public void MyOutHeaderMethod()\r\n    {\r\n      \/\/ Set the time the SOAP message expires.\r\n      myOutHeader.Expires = 60000;\r\n      myOutHeader.Created = DateTime.UtcNow;\r\n    }\r\n}\r\n[Visual\u00a0Basic]\r\n&lt;%@ WebService Language=\"VB\" Class=\"MyWebService\" %&gt;\r\nImports System\r\nImports System.Web.Services\r\nImports System.Web.Services.Protocols\r\n\r\n' Define a SOAP header by deriving from the SoapHeader class.\r\nPublic Class MyHeader\r\n  Inherits SoapHeader\r\n    Public Created As DateTime\r\n    Public Expires As Long\r\nEnd Class\r\n\r\n&lt;WebService(Namespace:=\"http:\/\/www.contoso.com\")&gt; _\r\nPublic Class MyWebService\r\n  Inherits WebService\r\n    Public myOutHeader As MyHeader \r\n\r\n    &lt;WebMethod, _\r\n     SoapHeader(\"myOutHeader\",Direction:=SoapHeaderDirection.Out)&gt; _\r\n    Public Sub MyOutHeaderMethod()\r\n         ' Set the time the SOAP message expires.\r\n         myOutHeader.Expires = 60000\r\n         myOutHeader.Created = DateTime.UtcNow\r\n    End Sub\r\nEnd Class<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3>Handling Unknown SOAP Headers<\/h3>\n<p>An XML Web service client can send a SOAP request with a SOAP header to an XML Web service method that the XML Web service might not have explicitly defined that it was expecting. In this case, it is important to determine whether the semantics of the SOAP header are understood and processed, as the SOAP specification states that an exception is thrown when SOAP headers have a <strong>mustUnderstand<\/strong> attribute set to <strong>true<\/strong>. For details on handling SOAP headers required by a client, see <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/77hkfhh8%28v=vs.71%29.aspx#cpconusingsoapheadersanchor2\">Handling SOAP Headers Required by an XML Web Service Client<\/a>.<\/p>\n<p><strong>To handle unknown SOAP headers from an XML Web service client<\/strong><\/p>\n<ol type=\"1\">\n<li>Add a member variable to the class implementing the XML Web service with a type of <strong>SoapUnknownHeader<\/strong> or <strong>SoapHeader<\/strong>, or an array of either, to handle multiple unknown SOAP headers.Declaring the type as either an array or a single instance of <strong>SoapUnknownHeader<\/strong> has the added benefit that <strong>SoapUnknownHeader<\/strong> has an <strong>Element<\/strong> property. The <strong>Element<\/strong> property is of type <strong>XmlElement<\/strong> and represents the XML document for the <strong>Header<\/strong> element of the SOAP request or SOAP response. Thus, an XML Web service method can determine the name of the SOAP header, along with the data passed by the SOAP header, by interrogating the <strong>Element<\/strong>property.\n<div id=\"code-snippet-19\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_de6d0c29-6cea-45f5-bfdf-2cb52b695f15\" dir=\"ltr\">\n<div>\n<pre>public class MyWebService {\r\n    public SoapUnknownHeader[] unknownHeaders;\r\n[Visual\u00a0Basic]\r\nPublic Class MyWebService\r\n    Public unknownHeaders() As SoapUnknownHeader<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<li>Apply a <strong>SoapHeader <\/strong>attribute to each XML Web service method that intends to process each unknown SOAP header.\n<div id=\"code-snippet-20\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_91fb9831-f76f-4fd8-9bb1-93eaad14f663\" dir=\"ltr\">\n<div>\n<pre>    [WebMethod]\r\n    [SoapHeader(\"unknownHeaders\")]\r\n    public string MyWebMethod()\r\n[Visual\u00a0Basic]\r\n    &lt;WebMethod, _\r\n     SoapHeader(\"unknownHeaders\") &gt; _\r\n    Public Function MyWebMethod() As String<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<li>Add code to determine whether you can process any unknown SOAP headers.If the member variable is of type <strong>SoapUnknownHeader<\/strong>, an XML Web service method can determine the name of the SOAP header, along with the data passed by the SOAP header, by interrogating the <strong>Element<\/strong> property. The <strong>Name<\/strong> property of <strong>Element<\/strong>property identifies the name of the SOAP header.\n<div id=\"code-snippet-21\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_6e1636b0-c30d-4887-9da1-d2b93db71bee\" dir=\"ltr\">\n<div>\n<pre>       foreach (SoapUnknownHeader header in unknownHeaders)\r\n       {\r\n         \/\/ Check to see if this a known header.\r\n         if (header.Element.Name == \"MyKnownHeader\")\r\n[Visual\u00a0Basic]\r\n       Dim header As SoapUnknownHeader\r\n       For Each header In unknownHeaders\r\n         ' Check to see if this is a known header.\r\n         If (header.Element.Name = \"MyKnownHeader\") Then<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/li>\n<li>Set the <strong>DidUnderstand<\/strong> property of the member variable representing the unknown SOAP header to <strong>true<\/strong>if it is known how to process a particular SOAP header.If an XML Web service method does process an unknown SOAP header and does not set the <strong>DidUnderstand<\/strong> property to <strong>true<\/strong>, a <strong>SoapHeaderException<\/strong> can be thrown. For more details, see <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/77hkfhh8%28v=vs.71%29.aspx#cpconusingsoapheadersanchor2\">Handling SOAP Headers Required by an XML Web Service Client<\/a>\n<div id=\"code-snippet-22\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_073dc2b7-1a37-4f8a-93bd-adf86df049cb\" dir=\"ltr\">\n<div>\n<pre>         \/\/ Check to see if this is a known header.\r\n         if (header.Element.Name == \"MyKnownHeader\")\r\n               header.DidUnderstand = true;\r\n         else\r\n             \/\/ For those headers that cannot be\r\n             \/\/ processed, set DidUnderstand to false.\r\n             header.DidUnderstand = false;\r\n         }\r\n[Visual\u00a0Basic]\r\n         ' Check to see if this a known header.\r\n         If (header.Element.Name = \"MyKnownHeader\") Then\r\n               header.DidUnderstand = True\r\n         Else\r\n             ' For those headers that cannot be\r\n             ' processed, set DidUnderstand to false.\r\n             header.DidUnderstand = False\r\n         End If<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<blockquote><p><strong>Note<\/strong>\u00a0\u00a0\u00a0The <strong>DidUnderstand<\/strong> property is used by XML Web services created using ASP.NET to communicate with the XML Web service method. It is not part of the SOAP specification. Its value does not appear in any part of the SOAP request or SOAP response.<\/p><\/blockquote>\n<blockquote><p><strong>Note<\/strong>\u00a0\u00a0\u00a0When an XML Web service client builds a proxy class using the Web Services Description Language Tool (Wsdl.exe) and an XML Web service defines the member variable representing a SOAP header using the <strong>SoapUnknownHeader<\/strong> type, no reference to that SOAP header is added to the proxy class. If an XML Web service client decides to add that SOAP header to the SOAP request, they must modify the proxy class by adding a member variable and applying a <strong>SoapHeader<\/strong> attribute to the method making the call to the pertinent XML Web service method.<\/p><\/blockquote>\n<\/li>\n<\/ol>\n<h3><a name=\"cpconusingsoapheadersanchor2\"><\/a>Handling SOAP Headers Required by an XML Web Service Client<\/h3>\n<p>A client can require an XML Web service method to interpret the semantics of the SOAP header correctly and process it accordingly for the SOAP request to succeed. To do so, clients set the <strong>mustUnderstand<\/strong> attribute of the SOAP header to <strong>1<\/strong>. For instance, the following SOAP request requires the SOAP request recipient to process the <code>MyCustomSoapHeader<\/code> SOAP header.<\/p>\n<div id=\"code-snippet-23\">\n<div><\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_fe53a60e-0ee6-4787-b845-d228cb16172f\" dir=\"ltr\">\n<div>\n<pre>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;soap:Envelope xmlns:soap=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\" &gt;\r\n  &lt;soap:Header&gt;\r\n    &lt;MyCustomSoapHeader soap:mustUnderstand=\"1\" xmlns=\"http:\/\/www.contoso.com\"&gt;\r\n      &lt;custom&gt;Keith&lt;\/custom&gt;\r\n    &lt;\/MyCustomSoapHeader&gt;\r\n  &lt;\/soap:Header&gt;\r\n  &lt;soap:Body&gt;\r\n    &lt;MyUnknownHeaders xmlns=\"http:\/\/www.contoso.com\" \/&gt;\r\n  &lt;\/soap:Body&gt;\r\n&lt;\/soap:Envelope&gt;<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Whether the XML Web service defines the SOAP header or not determines how the XML Web service should handle SOAP headers required by the client. ASP.NET handles a lot of the work in the case where the XML Web service defines the SOAP header. In the procedure that follows, you can learn how to handle the two cases.<\/p>\n<p><strong>To handle SOAP headers not defined by the XML Web service, but required by an XML Web service client<\/strong><\/p>\n<ul type=\"disc\">\n<li>Follow the steps for handling unknown SOAP headers from an XML Web service client, paying particular attention to the <strong>DidUnderstand<\/strong>property of the SOAP header.For SOAP headers not defined by the XML Web service, the initial value of <strong>DidUnderstand<\/strong> is <strong>false<\/strong>. If ASP.NET detects SOAP headers with their <strong>DidUnderstand<\/strong> property set to <strong>false<\/strong> after the XML Web service method returns, a <strong>SoapHeaderException<\/strong> is automatically thrown.<\/li>\n<\/ul>\n<p><strong>To handle SOAP headers required by an XML Web service client and defined by the XML Web service<\/strong><\/p>\n<ul type=\"disc\">\n<li>Follow the steps for processing SOAP headers within an XML Web service created using ASP.NET within each XML Web service method.For SOAP headers defined by the XML Web service and processed in the XML Web service method receiving the SOAP header, ASP.NET assumes the XML Web service understands the SOAP header and sets the initial value of <strong>DidUnderstand<\/strong> to <strong>true<\/strong>.<\/li>\n<\/ul>\n<p>The following <code>MyWebService<\/code> XML Web service defines the <code>MyHeader<\/code> SOAP header and requires it to be sent with any calls to the <code>MyWebMethod<\/code> XML Web service method. Additionally, the <code>MyWebMethod<\/code> processes any unknown SOAP headers. For the SOAP headers <code>MyWebMethod<\/code> can process, <strong>DidUnderstand<\/strong> is set to <strong>true<\/strong>.<\/p>\n<div id=\"code-snippet-24\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_04ee9410-9a19-475a-91c6-b54ade87ac1c\" dir=\"ltr\">\n<div>\n<pre>&lt;%@ WebService Language=\"C#\" Class=\"MyWebService\" %&gt;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\n\r\n\/\/ Define a SOAP header by deriving from the SoapHeader base class.\r\npublic class MyHeader : SoapHeader {\r\n    public string MyValue;\r\n}\r\npublic class MyWebService {\r\n    public MyHeader myHeader;\r\n\r\n    \/\/ Receive all SOAP headers other than the MyHeader SOAP header.\r\n    public SoapUnknownHeader[] unknownHeaders;\r\n\r\n    [WebMethod]\r\n    [SoapHeader(\"myHeader\")]\r\n    \/\/Receive any SOAP headers other than MyHeader.\r\n    [SoapHeader(\"unknownHeaders\")]\r\n    public string MyWebMethod()\r\n    {\r\n       foreach (SoapUnknownHeader header in unknownHeaders)\r\n       {\r\n         \/\/ Perform some processing on the header.\r\n         if (header.Element.Name == \"MyKnownHeader\")\r\n               header.DidUnderstand = true;\r\n         else\r\n                \/\/ For those headers that cannot be\r\n                \/\/ processed, set DidUnderstand to false.\r\n                header.DidUnderstand = false;\r\n       }\r\n       return \"Hello\";\r\n    }\r\n}\r\n[Visual\u00a0Basic]\r\n&lt;%@ WebService Language=\"VB\" Class=\"MyWebService\" %&gt;\r\nImports System.Web.Services\r\nImports System.Web.Services.Protocols\r\n\r\n' Define a SOAP header by deriving from the SoapHeader base class.\r\nPublic Class MyHeader : Inherits SoapHeader\r\n    Public MyValue As String\r\nEnd Class\r\n\r\nPublic Class MyWebService\r\n    Public myHeader As MyHeader\r\n\r\n    ' Receive all SOAP headers other than the MyHeader SOAP header.\r\n    Public unknownHeaders() As SoapUnknownHeader    \r\n\r\n    &lt;WebMethod, _\r\n     SoapHeader(\"myHeader\"), _\r\n     SoapHeader(\"unknownHeaders\")&gt; _\r\n    Public Function MyWebMethod() As String\r\n        'Receive any SOAP headers other than MyHeader.\r\n        Dim header As SoapUnknownHeader\r\n        For Each header In unknownHeaders\r\n            ' Perform some processing on the header.\r\n            If header.Element.Name = \"MyKnownHeader\" Then\r\n                header.DidUnderstand = True\r\n            ' For those headers that cannot be\r\n            ' processed, set DidUnderstand to false.\r\n            Else\r\n                header.DidUnderstand = False\r\n            End If\r\n        Next header\r\n        Return \"Hello\"\r\n    End Function\r\nEnd Class<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<blockquote><p><strong>Note<\/strong>\u00a0\u00a0\u00a0The <strong>DidUnderstand<\/strong> property is used by ASP.NET to communicate with the XML Web service method. It is not part of the SOAP specification; its value does not appear in any part of the SOAP request or SOAP response.<\/p><\/blockquote>\n<blockquote><p>If an XML Web service forwards a SOAP header, it is very important to follow the rules in the SOAP specification, especially those pertaining to the value of the <strong>Actor<\/strong>. For details, see the W3C Web site (http:\/\/www.w3.org\/TR\/SOAP\/).<\/p><\/blockquote>\n<h3>Handling Errors That Occur While Processing a SOAP Header<\/h3>\n<p>When an XML Web service detects an error specific to the processing of a header, a <strong>SoapHeaderException<\/strong> should be thrown. Using this exception class allows XML Web services to correctly format the response. If the client is created using the .NET Framework, it will receive the <strong>SoapHeaderException<\/strong> with its contents, including the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.exception.innerexception%28v=vs.71%29.aspx\">InnerException<\/a> property, placed in the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.exception.message%28v=vs.71%29.aspx\">Message<\/a> property. The <strong>InnerException<\/strong> property of the <strong>SoapHeaderException<\/strong> caught by the client will be <strong>null<\/strong>. This is a programming model supported by the .NET Framework, as the exception is sent over the network in a SOAP <strong>&lt;Fault&gt;<\/strong> XML element, as prescribed by the SOAP specification. For more details on exceptions, see <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ds492xtk%28v=vs.71%29.aspx\">Handling and Throwing Exceptions in XML Web Services<\/a>.<\/p>\n<p>The following code example throws a <strong>SoapHeaderException<\/strong> if a client makes a SOAP request to the <code>MyWebMethod<\/code> XML Web service method setting the <code>Expires<\/code> property to a date and time that occurs in the past by the time the SOAP request reaches the XML Web service.<\/p>\n<div id=\"code-snippet-25\">\n<div>\n<div dir=\"ltr\"><a>C#<\/a><\/div>\n<\/div>\n<div>\n<div><\/div>\n<div id=\"CodeSnippetContainerCode_32eaa0cf-2337-401f-a97b-a89fc271a0cd\" dir=\"ltr\">\n<div>\n<pre>&lt;%@ WebService Language=\"C#\" Class=\"MyWebService\" %&gt;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\n\r\n\/\/ Define a SOAP header by deriving from the SoapHeader class.\r\npublic class MyHeader : SoapHeader\r\n{\r\n  public DateTime Created;\r\n  public DateTime Expires;\r\n  public DateTime Received;\r\n} \r\n\r\n[WebService(Namespace=\"http:\/\/www.contoso.com\")]\r\npublic class MyWebService\r\n{\r\n    \/\/ Add a member variable of the type deriving from SoapHeader.\r\n    public MyHeader myHeaderMemberVariable;\r\n\r\n    \/\/ Apply a SoapHeader attribute.\r\n    [WebMethod]\r\n    [SoapHeader(\"myHeaderMemberVariable\")]\r\n    public void MyWebMethod()\r\n    {\r\n       if (timeStamp == null)\r\n          timeStamp = new MyHeader();\r\n       else\r\n       {\r\n          \/\/ Check whether the SOAP message is expired.\r\n          if ((timeStamp.Expires.CompareTo(DateTime.UtcNow)) &lt;= 0)\r\n          {\r\n             \/\/ The SOAP message is expired, so throw a SOAP header\r\n             \/\/ exception indicating that.\r\n             SoapHeaderException se = new SoapHeaderException(\r\n               \"SOAP message expired before reaching this node.\",\r\n               SoapException.ClientFaultCode,\r\n               this.Context.Request.Url.ToString());\r\n             throw se;\r\n          }\r\n       }\r\n    }\r\n}\r\n[Visual\u00a0Basic]\r\n&lt;%@ WebService Language=\"VB\" Class=\"MyWebService\" %&gt;\r\nImports System.Web.Services\r\nImports System.Web.Services.Protocols\r\n\r\n' Define a SOAP header by deriving from the SoapHeader class.\r\nPublic Class MyHeader\r\n  Inherits SoapHeader\r\n    Public Created As DateTime\r\n    Public Expires As DateTime\r\n    Public Received As DateTime\r\nEnd Class\r\n\r\n&lt;WebService(Namespace:=\"http:\/\/www.contoso.com\")&gt; _\r\nPublic Class MyWebService\r\n    ' Add a member variable of the type deriving from SoapHeader.\r\n    Public myHeaderMemberVariable As MyHeader    \r\n\r\n    ' Apply a SoapHeader attribute.\r\n    &lt;WebMethod, _\r\n     SoapHeader(\"myHeaderMemberVariable\")&gt; _\r\n    Public Sub MyWebMethod()\r\n       If (TimeStamp Is Nothing) Then\r\n          TimeStamp = New MyHeader\r\n       Else\r\n           ' Check whether the SOAP message is expired.\r\n           If ((TimeStamp.Expires.CompareTo(DateTime.UtcNow)) &lt;= 0) Then\r\n             ' The SOAP message is expired, so throw a SOAP header\r\n             ' exception indicating that.\r\n             Dim se As New SoapHeaderException( _\r\n                \"SOAP message expired before reaching this node.\", _\r\n                SoapException.ClientFaultCode, _\r\n                Me.Context.Request.Url.ToString())\r\n             Throw se\r\n           End If\r\n       End If\r\n    End Sub\r\nEnd Class<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><strong>Note: <\/strong>The .NET Framework version 1.0 includes the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.web.services.protocols.soapheaderattribute.required%28v=vs.71%29.aspx\">SoapHeaderAttribute.Required<\/a> property which enables an XML Web service to require that a client send a specific SOAP header when the property is set to <strong>true<\/strong>. ASP.NET indicates that the SOAP header is required in a generated WSDL document by setting the <strong>wsdl:required<\/strong> attribute to <strong>&#8220;true&#8221;<\/strong> on the <strong>soap:header<\/strong> element. .NET Framework clients of the XML Web service built from the WSDL document receive a <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.web.services.protocols.soapheaderexception%28v=vs.71%29.aspx\">SoapHeaderException<\/a> if they do not send the required SOAP header and other clients receive a SOAP Fault. To interoperate with other SOAP implementations this functionality is removed in later versions.<\/p>\n<p>The <strong>Required<\/strong> property is obsolete in version 1.1, and the <strong>wsdl:required<\/strong> attribute of a <strong>soap:header<\/strong> element in a WSDL document is ignored by the Web Services Description Language tool (Wsdl.exe). Because a SOAP header can no longer be required, an XML Web service should verify that the field or property representing the SOAP header is not <strong>null<\/strong> before accessing it.<\/p>\n<h4>See Also<\/h4>\n<p><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.web.services.protocols.soapheader%28v=vs.71%29.aspx\">SoapHeader<\/a> | <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.web.services.protocols.soapheaderattribute%28v=vs.71%29.aspx\">SoapHeaderAttribute<\/a> | <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.web.services.protocols.soapheaderexception%28v=vs.71%29.aspx\">SoapHeaderException<\/a> | <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.web.services.protocols.soapunknownheader%28v=vs.71%29.aspx\">SoapUnknownHeader<\/a> | <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ba0z6a33%28v=vs.71%29.aspx\">Building XML Web Services Using ASP.NET<\/a> | <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/w3h45ebk%28v=vs.71%29.aspx\">Building XML Web Service Clients<\/a><\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Using SOAP Headers .NET Framework 1.1 Communicating with an XML Web service method using SOAP follows a standard format. Part of this format is the data that is encoded in an XML document. The XML document consists of a root Envelope tag, which in turn consists of a required Body element and an optional Header [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-1380","post","type-post","status-publish","format-standard","hentry","category-k-thut"],"_links":{"self":[{"href":"https:\/\/dongson.info\/index.php?rest_route=\/wp\/v2\/posts\/1380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dongson.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dongson.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dongson.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dongson.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1380"}],"version-history":[{"count":3,"href":"https:\/\/dongson.info\/index.php?rest_route=\/wp\/v2\/posts\/1380\/revisions"}],"predecessor-version":[{"id":1423,"href":"https:\/\/dongson.info\/index.php?rest_route=\/wp\/v2\/posts\/1380\/revisions\/1423"}],"wp:attachment":[{"href":"https:\/\/dongson.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dongson.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dongson.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}