You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Jean-Sebastien Delfino <js...@apache.org> on 2006/03/01 09:28:05 UTC

New Tuscany WSDL2Java tool based on the Axis2 WSDLJava

I took a shot at integrating the Axis 2 WSDL2Java code generator into 
our WSDL2Java tool and Maven plugin. I basically use a combination of 
our SDO code generator (to figure out the SDO type mappings) and the 
Axis 2 WSDL2Java (to generate Java service interfaces).

Here is how it currently works:
1. We start  with a  WSDL file, WSDL operations flowing XSD elements and 
types, defined in inline XSDs or imported XSDs.
2. Run the WSDL through the SDO code generator, we do not need to 
generate the SDO classes here, we just run the SDO generator to populate 
a Map containing the SDO type mappings (XSD qname -> simple type or 
generated SDO class name)
3. Create an Axis2 TypeMapper from that Map, create an Axis2 
CodegenConfiguration and configure it with the proper options to 
generate an interface with the desired style, in the desired package etc.
4. Register with the Axis2 CodegenConfiguration an 
SDODataBindingCodegenExtension - this does not generate any databindings 
at the moment, it just sets the configured TypeMapper containing the SDO 
type mappings on the CodegenConfiguration
5 Create an Axis2 InterfaceWriter, create an Axis2 JavaEmitter and call 
writeInterface on it. This generates a Java service interface, the 
generated methods flow simple Java types and generated SDO classes.

This can be used from the command line or from a Maven build (with the 
Maven plugin that I checked in under java/sca/plugin).

There are some minor issues left, the generated methods have a throws 
RemoteException clause which is not required by SCA, I couldn't get the 
Axis2 pretty printer to be recognized (but the generated code is still 
formatted ok), I also had to extend the Axis2 JavaEmitter class to turn 
a protected method to public... but this is a starting point. I will 
start a discussion on the Axis2 dev list to see if we can get some 
improvements to WSDL2Java to make it easier to embed, customize and use 
in Tuscany.

So our WSDL2Java tool is pretty much functional now. I integrated it in 
the build of the Bigbank sample to demonstrate how to use it. The 
AccountService interfaces are now automatically generated from 
AccountService.wsdl as part of the Maven build.

-- 
Jean-Sebastien