uCosminexus Application Server, Application Development Guide

[Contents][Glossary][Index][Back][Next]

8.2.4 Generating a Java source

Based on the created WSDL file, generate a Java source (skeleton, SEI, and Java Bean (stub) of the Web Service implementation class) required for developing and executing Web Services. You can generate a Java source from Eclipse. To generate a Java source:

  1. In the Project Explorer view, select the project to be used for developing Web Services.
    Select a dynamic Web project for developing the POJO Web Services and an EJB project for developing the EJB Web Services.
  2. From the Eclipse menu bar, choose File - New - Other.
    The New dialog box appears.

    [Figure]

  3. Choose Cosminexus Web Service - Web Service (Starting from a WSDL file) and click the Next button.
    The Web Service (Starting from a WSDL file) page of the Web Service (Starting from a WSDL file) dialog box appears.

    [Figure]

    Note
    When the Web Service (Starting from a WSDL file) dialog box is displayed, depending on the selection status in the Project Explorer view, the Finish button might be activated, even if Project is blank. If you click the Finish button, based on the behavior of Eclipse API, InvocationTargetException and NullPointerException are output to the error dialog box and the error log. In such cases, if you specify the Project and Java source folder, you can continue the process.
  4. Specify the following items:
    Item name Specified value
    Project Select the dynamic Web project name or EJB project name of the workspace.
    WSDL file Specify the WSDL file or the WSDL file URL.
    Java source folder Specify the folder for generating the Java source.
    When the following settings are specified and the Web Service (Starting from a WSDL file) dialog box appears, the Java source folder column becomes blank and the subsequent operations can no longer be performed. Therefore, specify a folder other than the project root in Java source folder.
    • When the project root is set up in Source folders on build path in the Source tab of the Java Build Path page of the Properties dialog box, for the project used to develop Web Services
     
    Also, if the values entered in Project and Java source folder are changed, the values of the following items return to their initial states:
    • If the values in Project are changed
      The values of WSDL file, Java source folder, Java package, and Binding file return to the initial state.
    • If the values in Java source folder are changed
      The values of WSDL file, Java package, and Binding file return to the initial state.
     
    Specify the following items, as and when required:
    Item name Specified value
    Java package Specify the package name of the Java source to be generated.
    Binding file Specify the binding file.
    For more details on each item, also see 14.1 cjwsimport command in the manual uCosminexus Application Server Web Service Development Guide.
  5. Click the Finish button.
    A message indicating that the processing is executed appears and the Java source is generated.
    Note
    If the WSDL file and binding file are modified, and the Java source is regenerated using the Web Service (Starting from a WSDL file) dialog box due to the upgrade of the Web Service version, make sure that a file with the name same as of the output file does not exist in the folder specified in Java source folder.
    If a file with the name same as of the output file exists, the file is overwritten or an error occurs. If an error occurs and a file is output, before the Java source is regenerated using the Web Service (Starting from a WSDL file) dialog box, confirm that a file with the same name as the output file does not exist in the folder specified in the Java Source folder.
    • If SEI or Java Bean (stub) with the name same as of the output file exists in the specified folder, SEI or Java Bean (stub) is overwritten.
    • If a skeleton of the Web Service implementation class with the name same as of the output file exists in the specified folder, a warning message appears in the Console view and the skeleton of the Web Service implementation class is not generated. Therefore, the consistency between the Web Service implementation class in the project and the SEI and Java Bean in the Web project cannot be attained and the Web service might not be executed successfully. To make the Web Service implementation class and the SEI and Java Bean consistent, you must perform one of the following processing:
      [Figure]Empty the folder where the file is output, re-execute the Web Service (Starting from a WSDL file) dialog box, and then generate the skeleton of the Web Service implementation class.
      [Figure]Upgrade the version of the Web Service implementation class, empty the folder where the file is output, re-execute the Web Service (Starting from a WSDL file) dialog box, and then generate the skeleton of the Web Service implementation class of a new version.
      To be able to use the contents of the old Web Service implementation class for implementing the skeleton of the newly generated Web Service implementation class, add the implementation part of the old upgraded Web Service implementation class and the implementation of the new version in the skeleton of the new Web Service implementation class.