LibraryLink ToToggle FramesPrintFeedback

Chapter 3. Developing a Service Using WSDL as a Starting Point

When starting with a WSDL file, ,you need to generate the stub code for your service. You may also need to generate the starting point code for your service. To generate the required code you have two options:

Once the stub code is generated, you can implement your service's logic and deploy it.

If you have a copy of FUSE Services Framework, or Apache CXF, installed on your system, you can use the wsdl2java tool to generate the stub code and the starting point code. Example 3.1 shows the command and the options to use.

The -impl flag tells the tool to generate the starting point code for your implementation. The -d outDir flag tells the tool the name of the folder into which the generated code is written.

For more information about using the FUSE Services Framework tooling see the FUSE Services Framework library..

Even if you do not have FUSE Services Framework or Apache CXF installed, you can generate the required Java classes using the Maven tooling. You need to include the Apache CXF code generation plug-in in your project file and configure it to use the wsdl2java goal.

Example 3.2 shows the XML needed to configure the Apache CXF code generation plug-in to generate the stubs and starting point code.

Example 3.2. Maven Configuration for Generating Starting Point Code From WSDL

<project xmlns=""

         <artifactId>cxf-codegen-plugin</artifactId> 1
         <version>cxf-version</version> 2
              <phase>generate-sources</phase> 3
                <sourceRoot>sourceDir</sourceRoot> 4
                     <wsdl>myService.wsdl</wsdl> 5
                         <extraarg>-impl</extraarg> 6
                <goal>wsdl2java</goal> 7

The Maven POM fragment shown in Example 3.2 does the following:


Specifies that the Apache CXF code generation plug-in is to be loaded.


Specifies the version of the Apache CXF code generation plug-in to use.


Specifies that the plug-in is run during the generate-sources phase of a project build. You evoke the generate-sources phases using the mvn generate-sources command.


Specifies the directory into which the generated source files will be placed.


Specifies the path to the WSDL file from which the source code will be generated.


Specifies that a starting point implementation class is to be generated.


Specifies that the code generation plug-in will use its wsdl2java goal.

The implementation code consists of two files:

  • — The service interface(SEI) for the service.

  • — The class you will use to implement the operations defined by the service.

To provide the business logic for your service's operations complete the stub methods in You usually use standard Java to implement the business logic. If your service uses custom XML Schema types, you must use the generated classes for each type to manipulate them. There are also some FUSE Services Framework specific APIs that can be used to access some advanced features.