Sorry, it seems I was a quite hasty: __out_header__ = RespHeader
This fixed the problem when added inside HelloWorldService class. But I am really still curious about whether or not this is the correct way to go. I would appreciate your comments. On Fri, May 25, 2012 at 7:45 PM, Mehmet Arikkan <[email protected]> wrote: > I tried to add a simple header to the helloworld application: > > class RespHeader(ComplexModel): > __namespace__ = 'rpclib.examples.hello.soap' > > Elem1 = Mandatory.String > Elem2 = Mandatory.String > > 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) > > So now when I run the server and make a request with the Suds client, I > get a response but no header and along with the following message: > > WARNING:rpclib.protocol.soap.soap11:Skipping soap response header as > 'say_hello' method is not declared to have one. > > When I searched in the code, it seems, ctx.descriptor.out_header is None. > But the documentation says for descriptor: > > descriptor > The MethodDescriptor object representing the current method. This object > should not be changed by the user code. > > So how to nail this?? Also, any docs/examples for the sampe usage? > > Thanks in advance. > Mehmet > > On Thu, May 24, 2012 at 12:31 AM, Burak Arslan <[email protected] > > wrote: > >> On 05/23/12 18:58, Wolfgang Sourdeau wrote: >> >>> Le 12-05-23 11:56, Mehmet Arikkan a écrit : >>> >>>> Hi, >>>> >>>> I see a "FIXME" in the trunk as such (in soap11.py): >>>> >>>> # FIXME: There's no way to alter soap response headers for the user. >>>> >>>> >> yes, but look at it in its context: >> >> if ctx.out_error is not None: >> >> # FIXME: There's no way to alter soap response headers for the >> user. >> >> >> so that's true only in case the use code throws an exception... >> >> >> Is there no way to alter SOAP Header (i.. add elements) or if there is, >>>> how can we do it easily? >>>> >>>> >>>> >>> >>> From my experience, it is possible to modify the response headers by >>> using the rpc decorator rather than srpc and then modifying the >>> ctx.out_header attribute. >>> That is, if we are talking stricly about the SOPE layer, and not the >>> HTTP layer... >>> >>> >> that's correct. in http you have ctx.transport.resp_headers dict but no >> ctx.out_header support yet. >> >> burak >> >> >> ______________________________**_________________ >> Soap mailing list >> [email protected] >> http://mail.python.org/**mailman/listinfo/soap<http://mail.python.org/mailman/listinfo/soap> >> > >
_______________________________________________ Soap mailing list [email protected] http://mail.python.org/mailman/listinfo/soap
