In general, you build a web service implemented within a EJB module or a web application just as you would build any other project. As with other projects, the IDE automatically detects whether a project is part of a J2EE application and sets whether to package the archive files on the classpath accordingly. The IDE does not package API libraries like the Servlet API in your EJB module JAR file. You can adjust which archive files are packaged with your module in the module project's Project Properties dialog box.
However, for JAX-WS web services, the wsimport tool is run as part of the build process. For JAX-RPC web services, the wscompile tool that is run, instead. (JAX-RPC support is intended for legacy systems only.) To develop JAX-RPC servces, install the "JAX-RPC Web Services" plugin, available from the Plugins manager.
To build the web service: