## Creating a Web service using Ant tasks in the Workbench

You can use Ant through the Eclipse workspace to generate a Web service using the CXF run-time environment. Both top-down and bottom-up Web services development is supported with the Ant tasks.

Before creating the Web service you must:

- Complete the prerequisites in: Creating Web services and clients using Apache CXF and Ant tasks
- If you are creating a top-down Web service, create or import a WSDL file into the WebContent folder of the Dynamic Web project.
- If you are creating a bottom-up Web service, create or import a Java bean into the source folder of the Dynamic Web project.

  Note: There are certain limitations when developing a bottom-up Web service using the Ant tasks as opposed to the Web services wizards. If an explicit service endpoint interface (SEI) is required one must be extracted beforehand and both the implementation class and SEI must be annotated with @javax.jws.WebService before running the Ant build file.

To begin you need to modify the Ant properties file than was imported using the Ant Files wizard in the prerequisites.

1. Edit the `cxf_tdjava.properties` if doing top-down development or the `cxf_bujava.properties` file for bottom-up development.
   1. Ensure the scenarioType parameter is set to service.
   2. Set the initialSelection parameter to the location of your WSDL file (top-down) or Java bean (bottom-up).
   3. All other parameters are optional and should be deleted if not explicitly set. The default values for the remaining properties will be retrieved from the Dynamic Web project settings and preferences. For additional information on how to set these parameters refer to:
      - Top-down CXF Web service Ant task properties file reference
      - Bottom-up CXF Web service Ant task properties file reference

      Save the properties file.

2. Select the `cxf_tdjava.xml` (top-down) or `cxf_bujava.xml` (bottom-up) and from the top level menu and select Run > External Tools > External Tools Configurations.
3. In the dialog that opens select Ant Build and then select the 'New launch configuration' button in the toolbar. Select the JRE tab and select Run in the same JRE as the workspace. Click Apply and then Run.
4. A `Build Successful` message will be output to the console once the Web service has been generated.

Creating a Web service client using Ant tasks in the Workbench