My contract-first wishlist - No Fluff Just Stuff

My contract-first wishlist

Posted by: Craig Walls on July 21, 2006

In recent months, I've become quite a fanatic of contract-first web-services using the Spring-WS project. Arjen Poutsma has done some really good stuff in that space. I was a skeptic at first, but the more I think about it, I believe it's the right way to do web-services.

I won't go into all of the details of contract-first, but in a nutshell...You start by defining what the XML messages going in and out of a web-service look like. Based on that, you define the contract. The contract comes in two parts: The data contract (defined by an XSD) and the operation contract (defined in WSDL). To accomodate reuse, the data contract should be separate from the operation contract. This is backwards from many SOAP stacks that simply take an object's interface and SOAP-ify it.

Again, I'll let you read Arjen's blog for more info on why contract-first is a good thing. He has written several great entries on contract-first services.

The reason I'm writing today is to see if anyone can help me with my contract first wish list. In order to automate as much of contract-first development as possible, it'd be nice to generate the XSD and WSDL files instead of writing them by hand. Fortunately, there are plenty of tools out there to do this...

I've found several XSD inference tools that, when given an XML document, generate an XSD file that will validate the given XML. One such tool is Trang. Another is a web-based version of a Microsoft inference tool.

As for WSDL generation, I've found WSCF and it's Eclipse plugin version, jWSCF. It starts with an XSD file and walks me through a wizard to generate a WSDL file. It's even smart enough to make some guesses for my operations based on the XML types in the XSD file (eg, "calculateFigureRequest" results in an operation called "calculateFigure").

I've used these tools to write a Spring-WS service with some success and it certainly makes things much easier. I may need to make small tweaks to the XSD and WSDL, but at least I don't have to write them completely from scratch.

Nevertheless, while these tools are great, they aren't quite what I want. First, I want them both to be Eclipse plugins. I want to be able to select or open an XML file (or files) in Eclipse and ask Eclipse to generate either an XSD file, WSDL file, or both. jWSCF walks me through WSDL generation in Eclipse, but it depends on me having an XSD to start with. Neither Trang nor the MS tool are Eclipse plugins.

Even so, jWSCF uses a COM component under the covers. So even though it is an Eclipse plugin, it needs Windows and I'm unable to use it on my Powerbook.

At very least, I want someone to write an Eclipse plugin around Trang and to remove the COM dependency from jWSCF so that I can run it on my Mac. That would be a good start and I'd be quite happy with that. But it would even be better if I could select the XML file and then walk though a wizard (ala, jWSCF) and generate both the XSD and WSDL file at once. In short, I'm asking for a contract-first plugin for Eclipse.

I'd write such a plugin myself except that (1) I don't have the time and (2) I don't know much about writing Eclipse plugins.

Anybody know of any Eclipse plugin(s) that would help?

Craig Walls

About Craig Walls

Craig Walls is a Principal Engineer, Java Champion, Alexa Champion, and the author of Spring AI in Action, Spring in Action, and Build Talking Apps. He's a zealous promoter of the Spring Framework, speaking frequently at local user groups and conferences and writing about Spring. When he's not slinging code, Craig is planning his next trip to Disney World or Disneyland and spending as much time as he can with his wife, two daughters, 1 bird and 2 dogs.

Why Attend the NFJS Tour?

  • » Cutting-Edge Technologies
  • » Agile Practices
  • » Peer Exchange

Current Topics:

  • Languages on the JVM: Scala, Groovy, Clojure
  • Enterprise Java
  • Core Java, Java 8
  • Agility
  • Testing: Geb, Spock, Easyb
  • REST
  • NoSQL: MongoDB, Cassandra
  • Hadoop
  • Spring 4
  • Cloud
  • Automation Tools: Gradle, Git, Jenkins, Sonar
  • HTML5, CSS3, AngularJS, jQuery, Usability
  • Mobile Apps - iPhone and Android
  • More...
Learn More »