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 creator Server as the operating environment for Web services and selected IBM Rational creator Developer (RAD) for WebSphere is as the development platform of this article. RAD optimizes the test environment for IBM WebSphere creator 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
Web Services has been developed in two ways: 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 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 (Java API for XML Web services) is a set of Java APIs designed to implement XML Web services. JDK 1.6 has a Jax version of 2.1. However, Jax only provides the basic functionality of Web services, so if you want to implement the complex features 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. So this article will share the following:
Development of Web Services server-side development Web Service clients Web services communication based on HTTPS protocol optimizing network data transmission using @MTOM
Jax Web Services Development
Rad is a full-featured integrated development environment (IDE) based on Eclipse, so developers familiar with Eclipse can quickly start using the RAD platform.
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
Select the appropriate Target Runtime (confirm that the Server Runtime is created in Servers view) and make sure that the ADD project to an ear is checked, so that you do not need to manually create the ear.
Figure 2. Select a running environment to complete Project creation
Complete the creation of Web Project.