JMS Web Service Sample (News Service application)

This document is organized into following sub-sections :

Overview of the Sample Application 

Technology Overview

With Oracle9iAS v9.0.3, in addition to the existing  RPC-style Web Service, support has been extended to Document Style Web Service. The following Document Style Web Services are supported 

  • Stateless Java Document Style Web Service
  • Stateful Java Document Style Web Service
  • JMS Document Style Web service

For a stateful Java implementation, Oracle9iAS Web Services allows a single Java instance to serve the Web Service requests from an individual client. For a stateless Java implementation, Oracle9iAS Web Services creates multiple instances of the Java class in a pool, any one of which may be used to service a request. After servicing the request, the object is returned to the pool for use by a subsequent request.

 JMS Document Style Web Service exposes JMS destinations, Queues and Topics, as Web Services, thereby enabling asynchronous invocations by having these destinations consumed by a MDB in the back end.

This application shows how Oracle9iAS Web Services platform can be used to develop and deploy JMS Document Style Web Services. It also showcases the use of Oracle9i Web Services Assembly Tool, which aids in assembling( also generates WSDL and Proxy stubs) Web Services.
 

Application Overview

This sample application revolves around a News Service company ( "Daily Express" ) with around 200 branches across the globe. The focus of this sample is on a single process, the news dispatching process. The process is very simple, whenever any branch gets an important news or information it has to be dispatched to all the other branches of the company. The company also maintains a portal, where people can browse the latest news online.

This application has three modules which constitute the news dispatching process :

  1. NewsService ( JMS Web Service )
  2. Daily Express Application
  3. NewsService Client ( JMS Web Service Clients )

NewsService ( JMS Web Service )

NewsService is the heart of the whole application. NewsService is a JMS Document Style Web Service which exposes a JMS Queue ( News Queue ) as a Web Service. This service accepts messages ( clients send messages by invoking the 'send()' operation of the Web Service ) ,extracts the news content from the message, persists to the datasource and finally publishes to a JMS Topic ( News Topic ).

The JMS Topic ( News Topic ) is also exposed as a JMS Document Style Web Service and hence all clients can subscribe to this Topic and receive news items. This is done by invoking the 'receive()' operation of the Web Service.

Daily Express Application

DailyExpress is a web-portal hosted by the company. This application enables Internet users to browse the latest news online. It retrieves the latest news from the datasource and displays them to the user. Users can also browse through news items based on categories such as Sports, Health, Technology, etc.

NewsService Client ( JMS Web Service Clients )

The NewsService client applications are stand-alone java applications that post/subscribe news to the NewsService Web Service. PostToNewsService uses the proxy stub to post news to the Web Service and ListenToNewsService subscribes to the Web Service and prints the received news in the console.

Application Architecture


Technical Arch

1) NewsService Client application posts a news message by invoking the 'send()' operation on the 'NewsService' Web Service.
2) The News Queue (MDB) is invoked with the news message.
3) Extracts the news message from the payload and persists it to datasource.
4) Then, NewsQueueEJB publishes the news message to the News Topic.
5) News Topic delivers the news message to all the Web Service clients who have subscribed by invoking the 'receive()' operation.
6) NewsService Client application receives the news message.

Installation and Configuration 

Back to Top

For complete set of step-by-step instructions to install and run this application, refer Install.html in the sample jar file .

Description of Sample Files 

Back to Top

The directory structure of the deliverable newsservice.jar is as follows:

NewsService is the top level directory.

NewsService/doc This directory has all the documentation files, Readme and Install HTML files.
NewsService/etc config.xml This is the configuration file for Oracle Web Service Assembly Tool.
META-INF/*.xml This folder contains the config files for the NewsService EAR.
NewsService/sql NewsService.sql This SQL script creates the necessary sequence and table and populates them with sample data, which will be used by this application.
NewsService/DailyExpress META-INF/*.xml This directory has all the configuration files for deploying the MDB.
src/oracle/otnsamples/jmswebservice /NewsInfo.java Java source file for encapsulating news information(Value Object).
/client Contains the Java source files for NewsService client application.
/web Contains the Java source file for 'DailyExpress' application.
public_html/ This directory holds all JSP and configuration files for 'DailyExpress' application.
NewsService/build.xml This is the configuration file for Apache Ant tool to build newsservice.ear 
NewsService/JMSWebService
src/oracle/otnsamples/jmswebservice
/ejb/NewsQueueEJB
This MessageDrivenBean listens to NewsQueue.


Please enter your comments about this sample in the OTN Sample Code Discussion Forum.

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy