Introduction
Web Services is a service-oriented technology that provides services through standard WEB protocols to ensure that application services on different platforms can interoperate. Depending on the application implemented by the Web Services specification, data can be exchanged with each other, regardless of the language, platform, or internal protocol they are using, which is the benefit of Web services. This article selected IBM WebSphere application Server as the operating environment for Web services, and selected IBM Rational application Developer (hereafter known as RAD) for WebSphere is as the development platform of this article. RAD optimizes the test environment for IBM WebSphere application Server, reducing the time that developers consume by configuring the environment. All of the examples presented in this article are developed and tested on the RAD for WebSphere platform.
Web Services and Jax-ws
There are two forms of Web Services development: REST and SOAP. REST Web Services is based on the HTTP protocol, and SOAP Web Services supports multiple transport protocols: HTTP, SMTP, MIME, and so on. This article mainly describes SOAP Web services. For JAVA, there are currently two types of SOAP Web Services specifications: Jax-ws and SAAJ.
SOAP Web services typically require that the server side provide a machine-readable description (usually based on WSDL) so that the client can identify the WEB service provided by the server side.
Jax-ws (Java API for XML Web services) is a set of Java APIs designed to implement XML Web services. JDK 1.6 is jax-ws with a version of 2.1. However, JAX-WS only provides the basic functionality of Web services, so if you want to implement the complex functions of web services, such as WS-SECURITY,WS-POLICY,WS-RM, you need to switch to Apache CXF, Metro or Axis.
This article is targeted at developers who first contacted Web services or JAX-WS. So this article will share the following:
Web Services server-side development
Development of Web Services clients
Web services communication based on HTTPS protocol
Using @MTOM to optimize the network large data transmission
JAX-WS Web Services Development
Rad is a full-featured integrated development environment (IDE) based on Eclipse, so developers who are familiar with Eclipse can quickly start using RAD platforms.
Server-Side development:
First, on the RAD platform, create a simplest Web service that only returns a string to the client-"Hello world". The workflow on the server side is as follows: Complete Web Services authoring, publishing Web services Generate service description files (WSDL) for client access. Next, wait for the SOAP request message from the client to parse the method call and the parameter format. According to the description of WSDL and WSML, the corresponding object is invoked to complete the specified function, and the return value is returned to the user in a SOAP response message.
First, create a new Web Project–webprojectdemo in RAD,
Figure 1. Create Web Project