Web Service Development Guide : PART V HydraExpress Reference : Chapter 21 The Project File and Directory Structure : The Project File
The Project File
When the code generator rwsfgen is invoked, a top-level configuration file is created that contains all project elements, including any WSDLs or XML Schemas provided to the generator, all generation options, and any special mappings or other elements used as an argument during code generation. This file supports a project structure of any complexity and allows you to easily maintain your project using one file.
The code generator accepts any file of any name that adheres to the schema used by the project file, so you can easily create and maintain your own project files that contain special options or elements you wish to use for particular projects.
One useful technique is to create a customized project file containing special generation options that you want your project to use. If you provide this file to HydraExpress, it will use it to generate code. HydraExpress will then create a new project file in the output directory you specify for the project. This new project file is a combination of the custom project file provided the code generator, default generation options, and any additional options specifically provided on the command line. See “Adding Options and Customized Mappings to the HydraExpress Project File” for more information.
This section discusses a sample project file, adding options to a project file, and the HydraExpress project schema.
A Sample Project File
Let’s look at a simple project file. If you generated code using the default options for the example DayOfWeek located in your <installdir>\examples\webservices\DayOfWeek directory, you will have the following project file in a code generation directory DayofWeekExample:
<rwsf-codegen-project> <options> <!--1-->
<option name='haltonerror' value='true'/>
<option name='project-name' value='DayOfWeekExample'/> <!--2-->
<option name='logfilename' value='rwsfgen.log'/>
<option name='datamap'
value='C:\RogueWave\hydraexpress\conf\common\cppdatamapstl.xml'/>
<option name='stl' value='true'/>
<option name='outdir' <!--3-->
value='C:\RogueWave\hydraexpress\examples\webservices\
DayOfWeek\DayOfWeekExample'/>
<option name='sample' value='true'/>
<option name='toplevelclasses' value='true'/>
<option name='html' value='true'/>
<option name='client' value='true'/>
<option name='server' value='true'/>
<option name='standalone' value='false'/>
<option name='soapenc' value='false'/>
<option name='make' value='true'/>
<option name='clean' value='true'/>
<option name='makefilename' value='makefile'/>
<option name='ordinalanonymous' value='false'/>
<option name='verbose' value='false'/>
<option name='whitespace' value='true'/>
<option name='childtypeattr' value='true'/>
<option name='wrapped' value='false'/>
<option name='sourcepro' value='false'/>
<option name='maxgentypes' value='0'/>
</options>
<mappings> <!--4-->
<name xsdname="choice" xsdtype="" name="ChoiceElement" namespace=""/>
</mappings>
<files> <!--5-->
<input file='C:\RogueWave\hydraexpress\examples\
webservices\DayOfWeek\DayOfWeek.wsdl'/>
</files>
</rwsf-codegen-project>
//1 The options element includes all options, either default options, or options provided to the generator on the command line. For instance, because the whitespace option was set to true in the initial example-project.xml file provided on the command line, the option is copied to the generated project file, DayOfWeekExample.xml. The whitespace option would have been the default value, false, otherwise. (See “Generator Options” for a list of all generator options and their default values.)
//2 The project-name is a required option and is the basis for the name of the generated project file, as well as the name of the code generation directory.
Note: HydraExpress supports only file paths without spaces, so do not include spaces in file or directory names.
//3 The outdir value corresponds to the name of the code generation directory, including its full path. This value defaults to the project-name.
//4 The mapping element contains any customized datatype mappings you provided to the generator. Note that one customized mapping is always present, to map any schema element named choice to an object ChoiceElement. Without this mapping, a conflict could occur between an element named choice, and XML Schema’s <xsd:choice>.
//5 The files element lists all WSDLs or XML Schemas provided to the generator. Any number of WSDLs or schemas are supported.
If you wish to override elements in the project file, you may enter them on the command line. Any options entered on the command line override those inside the HydraExpress project file. In addition, if you provide more than one HydraExpress project file to the code generator, the values in the last project file override any previously-set values in the event of conflicts. See “Conflicting Options and Property Precedence” for more information on property precedence.
Adding Options to a Project File Vs. Adding them to the Command Line
Adding options to a project file requires a slightly different syntax than adding them to the command line. The command line accepts options prefaced with “no”, such as “nohtml” or “noserver,” while the project file instead requires a simple option value of “false”.
For example, to override the default setting html that always generates documentation, on the command line, you would enter:
 
prompt> rwsfgen -projectname MyProject -nohtml HelloWorld.wsdl
However, in a project file, you would enter:
 
<options>
...
<option name='html' value='false'/>
...
</options>
For a list of all generator options, see Table 12, “Code generator options.”
Creating a Customized Project File for Special Generation Options
HydraExpress reads any file of any name that contains supported project file options. This ability provides a great degree of flexibility while generating code.
The advantage of this feature is that, for instance, if you want code to be regularly generated using a particular option, you can create an XML file specifying that option and provide it as an argument to the generator. The code generator uses the options contained in any such file to generate code, and then merges these options with the HydraExpress project file it generates.
For example, if you want to always generate code with the -whitespace and -sourcepro options, you could create a HydraExpress project file titled standard-properties.xml. If you used this as an argument to the code generator, you would not need to specify these options on the command line.