Friday, October 30, 2009

WSF/C++ Code generation Tool

WSF/C++ comes with the build in code generation tool which allows you to generate Client Stubs and Service Skeletons in C++ by pointing to a WSDL.

If you downloaded the windows binary zip file, you will get the code generation tool binary jar files. If you download the source distribution, you will have to build the tool before using it.

1. Building from the source.  On Linux.

In the outermost directory of the source distribution, the build script for building the codegen tool is available. It is named build_codegen.sh.

First you need to build and install wsf/cpp to a preferred location. .you would need to download and install maven2. Then specify the directory where you have build and installed the wsf/cpp.

Example,

I have installed the wsfcpp to the location /home/nandika/wsfcpp.  directory.

$ sh build_codegen.sh /home/nandika/wsfcpp.

This would build and copy the jar files and codegen scripts to the directory /home/nandika/wsfcpp/bin/codegen/ directory.

2. Building from the source, on Windows

On windows, again, you need to have installed mavan2. First edit the configure.in file and run the build.bat file located in the outermost directory of the source distribution in order to build and make the binary dist.

Next run the build_codegen.bat file to build the code generation tool jar files from the source.  Next run the copy_codegen.bat file to copy the code generation tool and its scripts to the bin directory of the binary distribution. It will be located in the directory bin\tools\codegen directory.

3. Codegen tool Options

Code Generation tools provides you will multiple options. 

Some of the most common options are

1. –uri –> Specify the uri to the wsdl

2. –d    -> Data binding option ( This can be either adb or none )

3. –u   -> Unpack classes option

4. –0   -> Specify the output directory

5. –uw –> Unwrapped mode ( allows you to generate simple parameters for operations instead of data binding classes )

6 –ss    -> Generate Service Code

7. –sd  -> Generate Service deployment descriptors and build files ( services.xml and build.sh )

An example code generation command.

wsdl2cpp.sh –uri calculator.wsdl –d adb –u –uw –o calculator

This command instruct the codegen script to use the calculator.wsdl file located in the same directory and generate client side code ( default ) with adb data binding and use the unwrapped mode. It will output the generated source code to the calculator directory.

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Pretty nice post. I just stumbled upon your blog and wanted to mention that I've

    truly enjoyed surfing around your weblog posts.
    Sneakerheads2020
    Latest Jordan UK

    ReplyDelete
  3. On windows, again, you need to have installed mavan2. First edit the configure.in file and run the build.bat file located in the outermost directory of the source distribution in order to build and make the binary dist. satin bed set , king size comforters on sale ,

    ReplyDelete
  4. amazing, thanks you have shared it with us
    wolverine boots

    ReplyDelete
  5. The story every individual is interested is about the successful achievements of academic grades
    wolverine boots

    ReplyDelete