[Soap-Python] How to change SOAP response headers

Mehmet Arikkan marikkan at gmail.com
Mon May 28 09:34:01 CEST 2012


Hi Burak,

"You could also do it in the user code as well, without messing with events
at all, in case you need to add method-specific headers."

Could you please give an example about this method? This is what I need. I
think I don't have a clear understanding on how I can use the "ctx"
variable in an @rpc or @srpc decorator function.

Suppose I have two methods A and B and I want to include an AHeader and a
BHeader in them respectively. How can I do that, could you please elaborate
with a simple example?

Regards,
Mehmet

On Fri, May 25, 2012 at 9:14 PM, Burak Arslan <burak.arslan at arskom.com.tr>wrote:

>  On 05/25/12 21:09, Mehmet Arikkan wrote:
>
> Actually what I meant to ask is that whether my way to add the header is a
> proper way:
>
>   def _on_method_call(ctx):
>     ctx.out_header = RespHeader()
>     ctx.out_header.Elem1 = 'Test1'
>     ctx.out_header.Elem2 = 'Test2'
>
>  HelloWorldService.event_manager.add_listener('method_call',
> _on_method_call)
>
>  Is this how you would properly add a SOAP Header to your outgoing
> message?
>
>
> Yes, you could do it like this with events if you want to add that header
> to every response regardless of the method name. You could also do it in
> the user code as well, without messing with events at all, in case you need
> to add method-specific headers.
>
> Does that help?
>
> Best,
> Burak
>
>
> _______________________________________________
> Soap mailing list
> Soap at python.org
> http://mail.python.org/mailman/listinfo/soap
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/soap/attachments/20120528/75f0141a/attachment.html>


More information about the Soap mailing list