views:

360

answers:

1

I'm having some problems with one webservice that i'm working with. I generated a proxy class with wsdl.exe that comes with .net framework. But that webservice return a header that isnt not mapped by the wsdl. I must map the header sop because it contains some properties that i have to read and work with. how can i read the soap's header collection?

Ex.:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
   <soap:Header xmlns="http://xml.amadeus.com/ws/2009/01/WBS_Session-2.0.xsd"&gt;
      <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"&gt;
         <statusDoProcesso>
            <codigoDoStatus>P</codigoDoStatus>
         </statusDoProcesso>
      </TAM_Altea_Seguranca_AutenticarRS>
   </soap:Body>
</soap:Envelope>

I need to read the SOAP:HEADER -> Session.

A: 

See this page for detailed instructions on defining custom SOAP headers. There only seem to be VB.net code examples, but it should be easy enough to translate the principles in C#.

Simon Chadwick
This address tells you how to include a HEADER and not read the HEADER of a SOAP response.
Fabricio