|Author:||The TurboGears Development Team <firstname.lastname@example.org>|
|Copyright:||Copyright 2008, 2009, 2010 The TurboGears Development Team|
|Author:||Kevin Dangoor <email@example.com>|
|Copyright:||Copyright 2006, 2007 Kevin Dangoor and Arbor Networks|
Table of Contents
TurboGears gives you a plain HTTP with JSON return values API for your application for free. This isn’t always what you want, though. Sometimes, you don’t want to expose all of the data to the web that you need to render your templates. Maybe you need to support a protocol that names the function it’s calling as part of what it POSTs such as SOAP or XML-RPC.
TGWebServices provides a super simple API for creating web services that are available via SOAP, HTTP->XML, and HTTP->JSON. The SOAP API generates WSDL automatically for your Python and even generates enough type information for statically typed languages (Java and C#, for example) to generate good client code on their end.
How easy is it?
class Multiplier(WebServicesRoot): @wsexpose(int) @wsvalidate(int, int) def multiply(self, num1, num2): return num1 * num2
The great thing about this is that the code above looks like a ‘’‘normal Python function’‘’ and doesn’t know a thing about web services.
Questions about TGWebServices should go to the TurboGears Web Services mailing list.