Hi Jason, I have been thinking of the same thing, and I have an implementation at http://code.djangoproject.com/ticket/547. Its a near literal copy of SimpleXMLRPCServer, long live open source :-)
Jason Huggins wrote: > Has anyone else thought about how SOAP or XML-RPC would work with > Django's Manipulators? > > Okay... here's the "back story" to the question... > > I have a "pre-alpha" web services layer (currently it's just for > XML-RPC, but I'd like to add SOAP, and even -- gasp-- the Atom > protocol). It's composed of three elements: > 1) An "auth" middle ware that expects and parses HTTP Basic > Authentication headers (which is different than the default form based > authentication in Django. > 2) An "xmlrpc" middleware that converts XML-RPC requests to/from Python > data structures... It's really just a wrapper that plugs xmlrpclib into > the Django 'middleware' workflow. > 3) A "web service" view that can do basic CRUD operations on a django > model... It's kinda like Django's generic views, but it's more focused > on straight data structures... To me, it appears the existing "generic > views" in Django assume a web browser. They aren't "generic" enough. > :-) > > Right now, I have get_list() and get_object() working fairly smoothly > through XML-RPC... even with permissions and authentication! > > But things get tricker when it comes to add/update... Right now, I'm a > little stuck on the data model validation part... The existing Add and > Change Manipulators assume they are given an HTML form to parse. After > my xmlrpc middleware executes and hands off the request to the module > that'll do the "CRUD" operations, I'm already dealing with a straight > Python datastructure. I'm especially stuck on trying to figure how to > gracefully do validations and then return a data structure full of > error messages back through xml-rpc... The problem is that Django does > validations and error messages expecting a "flattened" name/value pair > data structure... That's because that's what HTML forms provide... but > with XML-RPC and SOAP, you're not limited to flat name/value pair data > structures... I'm just starting to figure out how to hack my XML-RPC > stuff into Django Manipulators without too much pain.... > > > - Jason -- Amit Upadhyay Blog: http://www.rootshell.be/~upadhyay +91-9867-359-701
