Professional Documents
Culture Documents
Web Services
http://docs.oracle.com/javaee/6/tutorial/doc/gilik.html http://geronimo.apache.org/GMOx O!"#/developing$ client$%or$rest%ul$&eb$service.html
Outline
I. What is Web Services? II. Why Web Services? III. Web Services Architecture IV. Web Services Description Language (WSDL) V. RESTful Web Services VI. Developing Client for RESTful Web Service
3
For example:
Microsoft's DCOM (Distributed Component Object Model) for communication between networked computers access remote COM (Component Object Model) interface through remote procedure calls. Corba uses IIOP (Internet Inter-ORB Protocol) to access remote objects. In Java RMI (Remote Method Invocation) is used to access an EJB (Enterprise Java Bean) object which is again language specific. All of the above examples suggest that remotely accessing an object required proprietary technologies that were tightly coupled to the remote code.
4
2. Using Web Services you can expose your application and its functionality globally. 3. Using Web Services, an enterprise would not not depend on one particular vendor for all the solutions.
It can move to different vendors for different functionality and can optimally choose out of several options.
4. Web Services use standardized protocols SOAP, UDDI, WSDL and HTTP for implementation. 5. Web Services has support for most of the communication protocol and it can be implemented using FTP as well as HTTP. 6. Web Services follow a loosely coupled architecture.
6
The syntax of a WSDL suggests that it is a set of definitions where the definition element is at the root.
10
<message>
This element defines the various messages used by the Web service. In an example two message name,
helloRequest which is associated with hello data type and helloResponse which is associated with helloResponse data type as defined in the <types> element.
Each message type has unique name which is suggested by <message name=""> tag. The <part element="" ...> suggests the data type associated with each message. <part> element can be considered as a parameter to a function call.
12
Project Jersey is the production-ready reference implementation for the JAX-RS specification
Jersey implements support for the annotations defined in the JAX-RS specification, making it easy for developers to build RESTful web services with Java and the Java Virtual Machine (JVM)
Because RESTful web services use existing well-known W3C and Internet Engineering Task Force (IETF) standards (HTTP, XML, URI, MIME) and have a lightweight infrastructure that allows services to be built with minimal tooling, developing RESTful web services is inexpensive and thus has a very low barrier for adoption
You can use a development tool such as NetBeans IDE to further reduce the complexity of developing RESTful web services
15 16
Web service delivery or aggregation into existing web sites can be enabled easily with a RESTful style
Developers can use such technologies as JAX-RS and Asynchronous JavaScript with XML (AJAX) and such toolkits as Direct Web Remoting (DWR) to consume the services in their web applications Rather than starting from scratch, services can be exposed with XML and consumed by HTML pages without significantly refactoring the existing web site architecture Existing developers will be more productive because they are adding to something they are already familiar with rather than having to start from scratch with new technology
The service producer and service consumer have a mutual understanding of the context and content being passed along
Because there is no formal way to describe the web services interface, both parties must agree out of band on the schemas that describe the data being exchanged and on ways to process it meaningfully In the real world, most commercial applications that expose services as RESTful implementations also distribute so-called value-added toolkits that describe the interfaces to developers in popular programming 17 languages
18
6asks
1. Create a Dynamic Web Project to consume the Web Service 2. Developing the Web based Client 3. Setting Up the Deployment Plan 4. Deploying and Testing the Web Client Deploy , Testing
This tutorial will take you through the steps required in developing, deploying and testing a RESTful Web Service Client in Apache Geronimo for a web services which are already deployed on the server We will be creating a Web based Client which can access the RESTful web service via GET and POST methods. You can easily create this client without any external tools except that of a server environment. To run this tutorial, as a minimum you will be required to have installed the following prerequisite software.
Sun JDK 5.0+ (J2SE 1.5) Apache Geronimo 2.x Eclipse IDE for Java EE Developers - Europa release Geronimo Eclipse Plug-in 2.x
http://geronimo.apache.org/apache-geronimo-v301-release.html
19
20