Some additional thoughts.
soaplib now requires lxml, which is not supported at this time on Jython. Maybe an earlier release of soaplib would work.Tools like soaplib are code-first in their orientation. You get some control over the generated WSDL, but it's not terribly stable as the code changes. And it's hard to get it right when you're mixing different languages. In general, I think the better practice is to use contract-first, writing the WSDL with a good XSD, in conjunction with the document/literal wrapped style (http://blog.springframework.com/arjen/archives/2006/06/09/tutorial-writing-contract-first-web-services/, http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/).I have not implemented this strategy in Jython, just Java, but it should work well in Jython. Something like the following makes sense:
- Use your favorite web app framework like Django or Pylons, running on WSGI/modjy, to define web service endpoints (these are just URLs). Provide also a service point for getting WSDL docs, properly bound against your actual host. You need this binding so tools like soapUI properly work.
- Parse incoming XML requests with javax.xml.xpath. This package provides the same namespace awareness for which soaplib leverages lxml, for the obvious reason that you need NS support to do any real web service work. An alternative is to use ElementTree, but it's pretty slow on Jython right now. This is definitely a case where I would recommend using Java libraries instead of the available Python libraries. (Better yet would be good Jython wrappers of these Java libraries, so porting lxml to Jython is the right approach.)
- Use your choice of templating, like Django, Freemarker, Mako, etc, to output XML documents. Just make certain you appropriately escape any content (any good template system supports that without CDATA hacks!).
- Test, test, test. I like soapUI. I also worked with javax.xml.validation to validate soap docs against the WSDL.- JimOn Mon, Sep 27, 2010 at 12:03 PM, Mark Santcroos <email@example.com> wrote:Hi,
I would like to build a web service written in python, but because of
our other services I would like to deploy it in our tomcat container.
My current plan is using modjy as a wsgi server for soaplib, but I'm
open to other suggestions.
Are there people who have done similar things and want to share their
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
Jython-users mailing list