Web Service Development Guide : PART V HydraExpress Reference : Chapter 20 The HydraExpress Code Generator : Invoking the Generator
Invoking the Generator
HydraExpress’s code generator requires:
at least one file argument that specifies either a HydraExpress project file, a WSDL file or an XML Schema. Multiple WSDLs and XML Schemas, and HydraExpress project files may be specified.
a project name provided either through the -projectname command line option or in a HydraExpress project file using the project-name attribute. If a project name is not specified, an error is generated: “ERROR: A project name was not found. Please specify a project name on the command line or in a project file.”
By default, HydraExpress places the generated code into a directory based on the provided project name, although that value can be overridden using the -outdir option. To create a code generation directory with a different name, simply use the -outdiroption as discussed in “Generator Options.”
In addition, various generation options are available.
To use rwsfgen, obtain or create a WSDL or XML Schema document. To use one of the examples provided with the HydraExpress installation, go to the directory <installdir>\examples\ xmlbinding\... containing XML binding examples using XML Schemas, or <installdir>\examples\ webservices\... containing Web services examples using WSDLs.
1. Set your environment, as described in Chapter 2, “Setup,” in the HydraExpress User Guide.
2. Open a command prompt and navigate to the directory containing the WSDL or schema file.
3. Invoke the HydraExpress code generator, as described in “Invoking the Generator with a WSDL File” and “Invoking the Generator with an XML Schema” . The general command line format for the generator is:
 
<prompt> rwsfgen [options] -projectname MyProject file [file file...]
The mandatory file argument specifies either a HydraExpress project file or any number of WSDL or XML Schema files. The mandatory -projectname argument identifies a name for this project and also mandates the name of the generated HydraExpress project file, as well as the code generation directory. The options may either precede or appear after the file argument.
A HydraExpress project file is an XML-based file containing all project elements for this particular project, such as WSDLs, schemas, options, compilers, and other project elements. You may create this file yourself and use it as a sole argument to the generator. Alternatively, HydraExpress generates this file for you, names it according to your project name, and includes in it all WSDL(s), schema(s), and any optional arguments used when you invoked the generator. See “Introduction to the HydraExpress Project File” .
The rwsfgen program accepts the optional arguments and properties shown in “Generator Options” .
Introduction to the HydraExpress Project File
The XML-based HydraExpress project file defines all elements for this project.
If the command line does not specify a project file, HydraExpress generates one using the options specified on the command line. For example, a command line of
 
rwsfgen -projectname MyProject MyWSDL.wsdl
would result in the creation of a project file called MyProject.xml in a directory MyProject. The project file would define a single WSDL file, MyWSDL.wsdl, and would also include a number of other elements defining default values for the various project options.
To reinvoke the code generator, you may either
call the rwsfgen application with the MyProject.xml as the only argument
call the rwsfgen application with one or more WSDL or XML files, the mandatory -projectname argument, and any other available options. At reinvocation, the generator regenerates the project file, merging any additional command line arguments.
For detailed information on the HydraExpress project file, see “The Generated Project Directory.”
Using the HydraExpress Project File to Set Options
While you may enter options on the command line, you may also either add them directly to an already-generated HydraExpress project file, or create a separate HydraExpress project file containing options that you wish to use regularly across like projects. This file may be called anything as long as it includes available HydraExpress project elements and options. See “The Generated Project Directory” for an example project file.
For example, the shipped examples use a HydraExpress project file titled example-project.xml. This file contains options such as -sourcepro or -whitespace and is provided to HydraExpress at code generation time. For an example of this file, see the DayOfWeek example in your <installdir>\examples\webservices\DayOfWeek directory.
For more information on options in general, see “Generator Options.” For more information on using a HydraExpress project file to set options, see “Creating a Customized Project File for Special Generation Options.”