Getting Started with JAX-WS Web services

Source: Internet
Author: User
Tags soap glassfish tomcat netbeans

Java API for XML Web Services (JAX-WS) 2.0, JSR 224 is an important part of the Java EE 5 platform. As a follow-on release of the Java API for xml-based RPC 1.1 (JAX), JAX-WS simplifies the development task of WEB Services using Java technology. It addresses some of the problems that exist in Jax-RPC 1.1, provides support for multiple protocols, such as SOAP 1.1, SOAP 1.2, and XML, and provides a tool that specifically supports other protocols such as HTTP. JAX-WS uses JAXB 2.0 for data binding and supports the service endpoint interfaces that are generated through custom control. With its support for annotations, JAX-WS simplifies WEB service development and reduces the size of run-time JAR files.

This document outlines how to use the IDE to develop JAX-WS WEB services and use it in three different clients--java the Java classes in the SE application and the servlet or JSP pages in the Web application. The three clients created in this document are separate applications that use the same WEB services. For advanced tutorials on clients, see Getting Started with Jax-ws WEB services clients.

The software required for this tutorial

Before you begin, you need to download and install the following software on your computer:

NetBeans IDE 6.0 Web & Java EE (download).

Java Standard Development Kit (JDK) version 5.0 or version 6.0 (download).

Glassfish V2 or Tomcat Web Server, both of which can be installed in the NetBeans IDE 6.0 Setup program.

Creating a Web Service

The goal of this exercise is to create a project that fits the selected deployment container. Then, we'll create a WEB service in the project.

Select container

You can deploy Web services in a Web container or in an EJB container. This is determined by the choice of implementation. For example, if you plan to deploy to a Tomcat Web Server with only one Web container, you should choose to create a Web application instead of an EJB module.

Select the File > New Project (ctrl-shift-n) option. Select the Web application option in the Web category, or select EJB Module in the Enterprise category.

Name the project Calculatorwsapplication.

Depending on the deployment server you are using, do the following:

For GlassFish, set Java EE Version to Java EE 5.

For Tomcat Web Server, uncheck the Set Source level to 1.4 check box.

Click the Finish button.

Creating a Web service by learning Java classes

Right-click the Calculatorwsapplication node and select New > Web Service option.

Name the Web service Calculatorws and type in the Package field, and then click the Finish button.

The Projects window displays the structure of the new Web service, and the visual designer is displayed in the editor area. For example, for WEB applications, the IDE looks like this:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.