TITLE OF PAPER: Web Services for Python URL OF PRESENTATION: _URL_of_powerpoint_presentation_ PRESENTED BY: Christopher Blunck REPRESENTING: _name_of_the_company_they_represent_ CONFERENCE: PyCON 2004 DATE: 20040326 LOCATION: _venue_and_room_in_venue_ -------------------------------------------------------------------------- REAL-TIME NOTES / ANNOTATIONS OF THE PAPER: {If you've contributed, add your name, e-mail & URL at the bottom} A pywebsvcs.sf.net This is an applications type presentation not an HTML presentation Web services overview (standard shtick) SOAP WSDL UDDI Subtle changes relative to CORBA make certain problems easier to solve Exchange patterns: request/response, notification, solicitation Namespace aware (!) Low system reqts: embedded devices? [Quarter-dollar-size web server w/ 256 byte TCP/IP stack on 8-bit processor - done at Stanford(?)] Web services for Python: SOAP: yes (client and server) WSDL: yes (comprehension) UDDI: not yet Two projects: SOAPpy ZSI (Zolera SOAP Infrastructure) - focus of talk Invoking services from Python If WSDL exists (desirable): - Use ServiceProxy directly; or - Use wsdl2py to convert it to Python code If no WSDL exists: - use Binding (undesirable) [example and demo of ServiceProxy - calling Google in 4 lines of code using WSDL ] wsdl2py generates Python code from WSDL file, which you then call [example] Binding is more like ServiceProxy but requires you to know an exact URL, so less desirable [example] Providing web services from python Define function register via ZSI dispatach Done. Use wsdl2py to generate response typecode info Handling Complex Types in SOAP: Use TypeCodes ("Complex Types are pain in ass -- avoid if possible") TypeCodes are ZSI classes W/O TypeCodes, ZSI marchalls as a dict or list (best effort) Use wsdl2py to get TypeCodes [TypeCode example - see how ugly] Server best practices: Use WSDL and wsdl2py (Duh) Wrap responses in TypeCode enabled classes (wsdl2py helps) ... Client best practices: Use wsdl2py Bind through WSDL (use ServiceProxy or generated classes) Use dynamic binding wehre possible for fault tolerance Q: Do you edit wsdl2py generated code? A: No, just import it. Q: So avoid returning data more complicated than strings and numbers? A: Even there, typecodes give names to string values. useWSDL=true causes it to infer information. Q: Encrypted transport:? A: Decoupled from transport; could be HTTPS, could be negotiated. Q: BigCos like MS pushing WS -- leads to cliques -- will interoperability suffer? A: It's a W3C standard for what that's worth (i.e. nothing) Q: Is there py2wsdl? A: No, it's hard Q: Have you thought about using interfaces to generate WSDL A: Tried to stay out of interfaces -- highly controversial, will wait for debate to be settled Q: Opinion on ReST (Representational State Transfer) A: No. (nor XML-RPC) Q: followup: I'm from Red Hat, XML-RPC is dumbed-down SOAP. A: [woohoo. Actually SOAP is XML-RPC that got co-opted and then sent to the W3C to be wrecked.] -------------------------------------------------------------------------- REFERENCES: {as documents / sites are referenced add them below} pywebsvcs: http://pywebsvcs.sourceforge.net/ -------------------------------------------------------------------------- QUOTES: "People see web services on my resume and ask me to design some web pages" -------------------------------------------------------------------------- CONTRIBUTORS: {add your name, e-mail address and URL below} Ted Leung, twl@osafoundation.org, http://www.sauria.com/blog Russell Finn, rsf@sprucehill.com, http://www.sprucehill.com/rsf/blog/ [future] -------------------------------------------------------------------------- E-MAIL BOUNCEBACK: {add your e-mail address separated by commas } -------------------------------------------------------------------------- NOTES ON / KEY TO THIS TEMPLATE: A headline (like a field in a database) will be CAPITALISED This differentiates from the text that follows A variable that you can change will be surrounded by _underscores_ Spaces in variables are also replaced with under_scores This allows people to select the whole variable with a simple double-click A tool-tip is lower case and surrounded by {curly brackets / parentheses} These supply helpful contextual information. -------------------------------------------------------------------------- Copyright shared between all the participants unless otherwise stated...