Saturday, January 24, 2009

Converting WSDL1.1 to WSDL2.0 using Woden

WSDL2.0 is the W3C’s latest specification for Web Service Description Language (WSDL) , WSDL2.0 provide more enhanced mechanism for service description some of significant features over WSDL1.2 are listed below .

  • WSDL2.0 is much more simple and easy to learn, some of the ambiguities of WSDL1.2 have removed.
  • Removal of message constructs. These are specified using the XML schema type system directly.
  • Improved support for HTTP bindings.
  • Unlike WSDL1.1, WSDL2.0 core specification supports for REST. Lawrence Mandel wrote a good article about REST support for WSDL2.0.

    This is a good tutorial about WSDL2.0 and it’s new features.












Still WSDL2.0 is not widely use in industry but it’s just a matter of time , once the WSDL2.0 become more popular people want to change there old WSDL1.1 files in to WSDL 2.0 , converting by hand is always painful but Woden : a WSDL2.0 processor project provide XSL based converter tool for this task . Here I discuss how can easy to use this Converter tool to convert from WSDL1.1 toWSDL2.0

Converter tool using command line
java -Djava.ext.dirs=/home/sagara/woden org.apache.woden.tool.converter.Convert

This command list all the option needs to use this tool, for example you could specify your existing WSDL1.1 file and target directory as follows.

java -Djava.ext.dirs=/home/sagara/woden org.apache.woden.tool.converter.Convert -wsdl /home/sagara/test/converter/Echo.wsdl


Converter tool programmatically

Sometime you want to do the conversion by programmatically; here I have given small example for that.


String wsdlDoc = "/home/sagara/test/converter/Echo.wsdl";
String newTargetNS = null;
String targetDir = "/home/sagara/test/converter/";
boolean verbose = true;
boolean overwrite = true;

Convert convert = new Convert();
try {
convertFile = convert.convertFile(newTargetNS,wsdlDoc,targetDir,verbose,overwrite);
System.out.println(convertFile);
} catch (Exception e) {
e.printStackTrace();
}