Re: [flask] soaplib with Flask
- From:
- James Seppi
- Date:
- 2011-02-23 @ 19:55
Andrew:
That was exactly what I was looking for! Thanks so much for the help!
Regards,
James
On Wed, Feb 23, 2011 at 1:43 PM, Andrew Wilson <wilson.andrew.j@gmail.com>wrote:
>
> Hi James.
>
> You probably want to do use werkzeug's Dispatcher middleware to combine
> your flask app with your soaplib app. It could look something like this:
>
> https://gist.github.com/841006
>
>
> <https://gist.github.com/841006>
>
> On Wed, Feb 23, 2011 at 11:17 AM, James Seppi <james.seppi@gmail.com>wrote:
>
>> Hi all:
>>
>> I wanted to ask if anyone had experience running SOAP services with
>> Flask. I think I'd like to use soaplib (currently using 2.0.0-beta) because
>> of its automatic WSDL file creation, but if anyone has other options I am
>> all ears.
>> With soaplib, I've been able to make my own SOAP service outside of Flask
>> and successfully serve it. I want to know if there is any way to integrate
>> it within Flask, similar to this example with web.py and soaplib:
>> http://webpy.org/cookbook/webservice Basically, I don't know what to do
>> with my Service class to get them to run in Flask.
>>
>>
>> class HelloWorldService(DefinitionBase):
>>> @rpc(String,Integer,_returns=Array(String))
>>> def say_hello(self,name,times):
>>> results = []
>>> for i in range(0,times):
>>> results.append('Hello, %s'%name)
>>> return results
>>>
>>
>> if __name__=='__main__':
>>> soap_application = soaplib.core.Application([HelloWorldService],
>>> 'tns')
>>> wsgi_application = wsgi.Application(soap_application)
>>> #now what?
>>>
>>
>> Any help or advice on how to get started is much appreciated!
>>
>
>
Re: [flask] soaplib with Flask
- From:
- Armin Ronacher
- Date:
- 2011-02-23 @ 22:17
Hi,
On 2011-02-23 8:55 PM, James Seppi wrote:
> Andrew:
>
> That was exactly what I was looking for! Thanks so much for the help!
Recommendation:
Instead of this:
flask_app = Middleware(flask_app)
Do this instead:
flask_app.wsgi_app = Middleware(flask_app.wsgi_app)
Why? Because then you don't loose the reference to flask_app.
Regards,
Armin
Re: [flask] soaplib with Flask
- From:
- Andrew Wilson
- Date:
- 2011-02-23 @ 23:49
On Wed, Feb 23, 2011 at 4:17 PM, Armin Ronacher <armin.ronacher@active-4.com
> wrote:
> Hi,
>
> On 2011-02-23 8:55 PM, James Seppi wrote:
> > Andrew:
> >
> > That was exactly what I was looking for! Thanks so much for the help!
> Recommendation:
>
> Instead of this:
>
> flask_app = Middleware(flask_app)
>
> Do this instead:
>
>
> flask_app.wsgi_app = Middleware(flask_app.wsgi_app)
>
> Why? Because then you don't loose the reference to flask_app.
>
>
> Regards,
> Armin
>
Good call - the gist has been updated accordingly.