[spyne] accessing the wsdl
burak.arslan at arskom.com.tr
Mon May 26 16:06:13 UTC 2014
On 26/05/14 16:54, Joseph L. Casale wrote:
>>> I am dealing with what appears to be a broken client that is accessing a service I wrote.
>>> Does spyne have a facility to control where the wsdl is exposed? As a result of current
>>> setup, I am unable to leverage redirect/rewrites for this.
>> You can use the wsdl event of the WsgiApplication
>> wsgi_app =sgiApplication(...)
>> def _on_wsdl(ctx):
>> print ctx.transport.wsdl # set this to whatever you want
>> wsgi_app.event_manager.add_listener('wsdl', _on_wsdl)
> Hey Burak,
> I looked into this and the wsgi class but I think I failed to convey to my issue very well.
> While I am testing with a client for which I have no control nor any insight from its
> esteemed operator, I notice an older implementation I am replacing returns the wsdl
> on a 404 instead of an xml error for example as this silly client makes all sorts of
> unexpected requests in addition to the one I am interested in responding to.
> I looked through the docs and code for the wsgi class and it wasn't immediately obvious
> to me as to how to accomplish this.
And this time you lost me.
Last time I looked at that spec was a long time ago, but AFAIR
SOAP-over-HTTP spec says servers should return either 200, 401 or 500,
you're not allowed to return anything else. So returning wsdl document
on 404 is quite weird and frankly I can't think of an easy way of adding
that functionality easily.
If you want to alter when WsgiApplication returns the wsdl document,
just subclass it and override is_wsdl_request. You might end up copying
the whole (wsdl) logic and altering it to match the behaviour you need
though. Fortunately, wsdl handling code in WsgiApplication is not that
Btw, This might be the weirdest SOAP quirk I've ever heard :)
I hope I was able to help.
More information about the people