How to read HTTP response header headers from web service response in proxy class

I am having problems with one web service that I am working with. I created a proxy class with wsdl.exe which comes with the .net framework. But this webservice returns a title which is not displayed by wsdl. I have to display the sop header because it contains some properties that I have to read and work with. how can i read the collection of soap headers?

Example:.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header xmlns="http://xml.amadeus.com/ws/2009/01/WBS_Session-2.0.xsd">
      <Session>
         <SessionId>545784545</SessionId>
         <SequenceNumber>1</SequenceNumber>
         <SecurityToken>asd7a87sda89sd45as4d5a4</SecurityToken>
      </Session>
   </soap:Header>
   <soap:Body>
      <TAM_Altea_Seguranca_AutenticarRS xmlns="http://xml.amadeus.com/2009/04/TAM/TAM_Altea_Seguranca_AutenticarRS_2.0">
         <statusDoProcesso>
            <codigoDoStatus>P</codigoDoStatus>
         </statusDoProcesso>
      </TAM_Altea_Seguranca_AutenticarRS>
   </soap:Body>
</soap:Envelope>

      

I need to read SOAP: HEADER -> Session.

+2


a source to share


2 answers


Have you tried this?

source: Process the SOAP headers required by the XML web service client



public class MyWebService
{
    public SoapUnknownHeader[] unknownHeaders;

    [WebMethod]
    [SoapHeader("unknownHeaders")]
    public string MyWebMethod() 
    {
        foreach (SoapUnknownHeader header in unknownHeaders) 
        {
            // process headers
        }

        // handle request
    }
}

      

0


a source


For detailed instructions on how to define custom SOAP headers, see this page . There will likely be VB.net code examples out there, but it should be easy enough to translate the principles into C #.



-1


a source







All Articles