[Twisted-Python] SOAP and XML-RPC stuff

Andrew Dalke dalke at dalkescientific.com
Sun May 25 22:01:57 MDT 2003


http://www.twistedmatrix.com/documents/howto/xmlrpc

Has a link under

  "In addition, XML-RPC published methods can return  
twisted.python.defer.Deferred"

The last word is hyperlinked to
    
http://twistedmatrix.com/documents/TwistedDocs/current/api/public/ 
twisted.python.defer.Deferred.html

which does not exist.
   ==
http://twistedmatrix.com/documents/TwistedDocs/current/api/public/ 
twisted.web.xmlrpc.XMLRPC.html
says
  Faults,  Binray, Boolean, DateTime, Deferreds, or Handler instances.

typo: "Binray" --> "Binary"

   ==

Here's a patch to work with SOAPpy 0.10

--- /usr/local/lib/python2.3/site-packages/twisted/web/soap.py  Sun May  
25 21:46:12 2003
+++ /Users/dalke/ftps/Twisted-1.0.5/twisted/web/soap.py Wed Oct 23  
19:55:20 2002
@@ -13,14 +13,11 @@
  """

  # SOAPpy
-try:
-  import SOAPpy as SOAP
-except ImportError:
-  import SOAP
+import SOAP

-  # fix 2.2 issues with SOAP
-  SOAP.SOAPBuilder.dump_str = SOAP.SOAPBuilder.dump_string
-  SOAP.SOAPBuilder.dump_dict = SOAP.SOAPBuilder.dump_dictionary
+# fix 2.2 issues with SOAP
+SOAP.SOAPBuilder.dump_str = SOAP.SOAPBuilder.dump_string
+SOAP.SOAPBuilder.dump_dict = SOAP.SOAPBuilder.dump_dictionary

  # twisted imports
  from twisted.web import server, resource


Or, in short version, change

# SOAPpy
import SOAP

to

# SOAPpy
try:
   import SOAPpy as SOAP
except ImportError:
   import SOAP

   # fix 2.2 issues with SOAP
   SOAP.SOAPBuilder.dump_str = SOAP.SOAPBuilder.dump_string
   SOAP.SOAPBuilder.dump_dict = SOAP.SOAPBuilder.dump_dictionary

(I checked - 0.10 handles the typename changes from 2.2)


    ===

How do I run both an XML-RPC and a SOAP server on the same server?
I tried something like

def main():
     from twisted.internet.app import Application
     app = Application("xmlrpc")

     r = XMLRPC_Calc()
     app.listenTCP(7080, server.Site(r))

     r = SOAP_Calc()
     app.listenTCP(7080, server.Site(r))

     return app

application = main()

if __name__ == "__main__":
     application.run(save=0)


But that doesn't work - the SOAP requests go to the XML-RPC server.
Is there some way to say that "/RPC2" is for XML-RPC and that "/SOAP"
is for SOAP?

					Andrew
					dalke at dalkescientific.com





More information about the Twisted-Python mailing list