I'm reading Thomas Erl's book, "Principles of Service Design" and, when he discusses contracts, they're usually codified in WSDL and XSD. So I've been trying to find a way to quickly throw together Web Services that use WSDL and XSD so that I can play with some of the book's concepts.
Failed Attempts
I thought that Ruby would be the answer. I first tried SOAP4R but found that it could not generate WSDL from service methods and types. Since I don't want to generate WSDL files yet, this was a deal-breaker.
I then tried Ruby's ActionWebService but the generator script was not installed correctly so it wouldn't work.
Success
I then stumbled upon Groovy's WSServer library (installation instructions). Groovy is a dynamic language that runs on the JVM. I installed the Groovy support for Eclipse and had created a fully working web service in minutes. I fired up the Web Service from within Eclipse and then switched over to Microsoft Visual Studio and imported the Service Reference and called my service code from C#. It was so easy.
I then thought I'd try a web service call that would return a complex type (e.g. a Person object). This made the Web Service crash with a stack overflow.
It took me hours to find the solution. The following links helped a lot:
Basic Service - This page showed how to create a simple Web Service.
Using the Aegis Mapping - This showed me that I needed to create a mapping XML element for the Person class that ignored the 'metaClass' property of my Person object. My guess is that the stack overflow was caused by navigating a very deep or even cyclic object graph during the serialization process.
Aegis Binding - This link told me where to put the mapping XML element.
Now I can create Web Services very quickly just to try things out. And they run on any platform Groovy runs.
Have you found a better way to quickly develop Web Services? I'd love to hear about what you've found!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment