How do I access SOAP headers in a Spyne srpc method? -


forgive me if being thick spyne documentation on headers seems bit thin , link sample code broken. think found sample code here seems access headers in listener callback function. need access in srpc method if possible.

what (this not work):

class myrequest(complexmodel):     messages = array(unicode)  class myheader(complexmodel):     trackingid = bytearray  class mysoapservice(servicebase):     @srpc(myrequest, _in_header=myheader)     def postmessages(req, hdr):         logging.info(u'received: {0:s}'.format(hdr.trackingid)) 

if helps, trying replace service written in .net defines message headers in message contract this:

[messagecontract] public class myrequest {   [messageheader]   public guid trackingid { get; set; }    [messagebodymember]   public string[] messages { get; set; } } 

you can't read header data within srpc function. @srpc existing functions don't want touch. should use @rpc unless know need @srpc

decorate function using @rpc. passes rpc context (conventionally named ctx) first argument function. then, ctx.in_header you'll find header data. can set ctx.out_header alter outgoing response headers.

also, pull requests docs pure gold me :)


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -