Design and development of JAX-WS 2.0 Web Services

Source: Internet
Author: User
Tags soap web services wsdl java se

Before you start

About this tutorial

In this tutorial, we will design and develop an order processing application and expose its functionality as a WEB service so that various users can submit order information in a platform-independent manner.

Goal

Once you have completed this tutorial, you can apply relevant concepts and knowledge to develop WEB services for your application using JAX-WS technology.

Prerequisite

To successfully complete this tutorial, you should have a basic understanding of the WEB services technology and need to be more proficient in Java programming.

System Requirements

To run the example in this tutorial, you need to install Java Platform, Standard Edition (Java SE) 6.0.

JAX-WS Introduction

Why use Jax-ws?

Jax-ws is a technique for simplifying the work of using Java to construct Web services and Web service clients. This technology provides a complete Web service stack that reduces the task of developing and deploying Web services. JAX-WS supports WS-I Basic Profile 1.1, which ensures that WEB services developed using the JAX-WS stack can be used by any client that is developed in any language using the WS-I Basic Profile standard. JAX-WS also includes the Java Architecture for XML Binding (JAXB) and SOAP with Attachments APIs for Java (SAAJ).

JAXB provides a convenient way to map XML schemas to representations of Java code, thereby supporting data binding capabilities. JAXB eliminates the need to fully understand XML and SOAP parsing by converting XML Schema messages in SOAP messages to Java code. The JAXB specification defines the bindings between Java and XML schemas. SAAJ provides a standard way to handle XML attachments contained in a SOAP message.

Furthermore, JAX-WS provides a Annotation library for converting traditional Java objects (Plain old Java Object,pojo) classes into Web services, which accelerates the development of Web services. In addition, it specifies a detailed mapping between the service defined by the Web Service Description Language (Web Services Description language,wsdl) to the Java class that implements the service. Any complex types defined with WSDL are mapped to Java classes by following the mappings defined by the JAXB specification. Jax-ws before with Java Platform, Enterprise Edition (Java EE) 5 binding. The JAX-WS 2.0 specification was developed as JSR 224 of the Java Community Process (JCP).

Developing WEB Services

Contract priority method and code first method

The best way to enter the JAX-WS era is to develop a WEB service first. You can develop WEB services in one of the following two ways:

Contract first: Start with WSDL contract, generate Java class to implement service.

Code First: Starting with Java classes, using Annotation to generate WSDL files and Java interfaces.

The contract precedence WSDL method requires a good understanding of the WSDL and XML Schema definitions (XML Schema definition,xsd) that are used to define message formats. If you're quite unfamiliar with Web services, it's best to start with code-first, which is used in this tutorial to develop Web services.

Code-first WEB service development

When you use code-first methods, you start with a Java class or class that implements the functionality that you want to expose as a service. Code-first methods are particularly useful in cases where Java implementations have been provided and need to expose implementations as services.

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: info-contact@alibabacloud.com 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.