IntelliJ IDEA 2021.1 Help

Getting started with Web service

To develop a Web service in IntelliJ IDEA, the corresponding module must be relevantly configured and supplied with all the required libraries and servlet references. This section describes the most common ways to meet these requirements.

Make sure the Web and JavaEE: WebServices (JAX-WS) bundled plugins are enabled. The plugins are activated by default. If the plugins are disabled, enable them on the Installed tab of the Plugins page as described in Manage plugins.

Enabling Web Services Development Support through a Dedicated Facet

This approach is applicable if you are going to develop a Web service of the type GlassFish/JAXWS2.X RI/Netro 1.X/JWSDP2.0 or Apache Axis.

A Web Services facet can be only added as a child of a Web facet. Note that only one Web Services facet is allowed in a module.

You can create a new module with the dedicated facets or add the facets to an existing module. In either case, IntelliJ IDEA downloads the predefined WS engine implementation version.

To create a module with a Web Services facet:

  1. Do one of the following:

    • If you are going to create a new project: click Create New Project on the Welcome screen or select File | New | Project.

      As a result, the New Project wizard opens.

    • If you are going to add a module to an existing project: open the project you want to add a module to, and select File | New | Module.

      As a result, the New Module wizard opens.

  2. On the first page of the wizard, in the left-hand pane, select Java. In the right-hand part of the page, specify the JDK that you are going to use.

  3. Under Additional Libraries and Frameworks, select the Web Application checkbox.

    Select the version of the Servlet specification to be supported from the Versions list.

    If you want the deployment descriptor web.xml file to be created, select the Create web.xml checkbox.

  4. Select the WebServices checkbox.

  5. Select the desired WS engine implementation from the Version list.

  6. You'll need a library that implements %tech_name%. the selected WS engine. You can choose to use an existing library, create and use a new one, download the library files if they are not yet available on your computer, or postpone setting up the library until a later time.

    Use librarySelect the library that you want to use (if the corresponding library is already defined in IntelliJ IDEA).
    Create

    If the corresponding jar files are already available on your computer, you can arrange those files in a library. Click Create and select the necessary files in the dialog that opens.

    Optionally, click Configure to edit the selected library.

    Download

    Select this option to download the necessary library files.

    Optionally, click Configure to edit the library settings and contents.

    Set up library laterSelect this option to postpone setting up the library until a later time.

    Click Next.

  7. Specify the name and location settings.

    Click Finish.

To add a Web Services facet to an existing module:

    1. Open the Project tool window (e.g. View | Tool Windows | Project ).

    2. Right-click the project or the module folder and select Add Framework Support.

    3. In the left-hand pane of the Add Frameworks Support dialog that opens, select the Web Application checkbox.

    4. In the right-hand part of the dialog, select the version of the Servlet specification to be supported from the Versions list.

      If you want the deployment descriptor web.xml file to be created, select the Create web.xml checkbox.

    5. Select the WebServices checkbox.

    6. If you want sample server code to be generated, select the corresponding checkbox.

    7. Select the desired WS engine implementation from the Version list.

    8. You'll need a library that implements %tech_name%. the selected WS engine. You can choose to use an existing library, create and use a new one, download the library files if they are not yet available on your computer, or postpone setting up the library until a later time.

      Use librarySelect the library that you want to use (if the corresponding library is already defined in IntelliJ IDEA).
      Create

      If the corresponding jar files are already available on your computer, you can arrange those files in a library. Click Create and select the necessary files in the dialog that opens.

      Optionally, click Configure to edit the selected library.

      Download

      Select this option to download the necessary library files.

      Optionally, click Configure to edit the library settings and contents.

      Set up library laterSelect this option to postpone setting up the library until a later time.
    9. Click OK in the Add Frameworks Support dialog.

Adding the Necessary Libraries to an Existing Modules

This approach is applicable if the necessary libraries have been previously downloaded.

  1. Open the module settings.

  2. With the desired module selected, click the Dependencies tab.

  3. To enable Web development, click the Add button and select Single-Entry Module Library from the context menu. In the dialog that opens, select the javaee.jar library and click OK.

  4. Click the Add button again, then select Single-Entry Module Library from the context menu. In the dialog that opens, select the javaee.jar library and the required Web service-specific libraries.

    • The location of the javaee.jar library is defined during the installation of IntelliJ IDEA.

    • The location of the Web-service specific libraries is defined during their download.

  5. Click OK when ready.

Enabling an Extra WS Engine

Besides most common WS engines, support of which is enabled through dedicated facets, with IntelliJ IDEA you can also use the following ones:

Moreover, you can use any desired WS engine implementation version instead of restricting yourself to the predefined one.

To use a custom WS engine:

  1. Download the desired WS engine implementation.

  2. In the Settings/Preferences dialog Ctrl+Alt+S, click Tools | Web Services in the left pane and specify the path to external web service engines, server name and port, and so on (for details, see Web Services ).

Last modified: 24 March 2021