ElementSOAP and <soap:Header>

Fredrik Lundh fredrik at pythonware.com
Mon Nov 20 02:42:35 EST 2006


mirandacascade at yahoo.com wrote:

> 2) If one wanted to make use of ElementSOAP, and one wanted it to
> produce a SOAP message that includes a <soap:Header> would the general
> outline be:
>   a) use ElementTree to create and populate the <soap:Header> element
>   b) insert the <soap:Header> element as a subelement of envelope in
> the SoapService class

make sure you have the 0.5 release, call SoapHeader to create a header 
element, populate it with whatever you want, and pass it to "call" using 
the header= keyword argument

     header = SoapHeader()
     ... populate header ...
     service.call(action, request, header=header)

> I think much of my confusion stems from my lack of understanding of
> SOAP.  As I understand it, <soap:Header> is an optional part of a SOAP
> message.  I'm pretty sure that 'optional' at a minimum means that not
> all SOAP messages must contatin a <soap:Header>.  But does 'optional'
> mean more than that?  Does it mean that one could get by without ever
> having to produce a SOAP message that includes a <soap:Header>?  Or,
> are there some webservices where if one didn't include a <soap:Header>
> in the SOAP message, the webservice would not work?

optional means "it's up to the server to decide if it wants one".

</F>




More information about the Python-list mailing list