???? Web Services and Its Applications - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

???? Web Services and Its Applications

Description:

Title: E-Business for Accountants Last modified by: Li Yinsheng Document presentation format: Other titles: Arial Arial Unicode MS Tahoma Wingdings ... – PowerPoint PPT presentation

Number of Views:28
Avg rating:3.0/5.0
Slides: 20
Provided by: educ5480
Category:

less

Transcript and Presenter's Notes

Title: ???? Web Services and Its Applications


1
????Web Services and Its Applications
WSA
  • Fall OCT 31, 2007

Li Yinsheng (021-51355352) Email
liys_at_fudan.edu.cn Institute of e-Business Fudan
University Software School http//eb.fudan.edu.cn
2
Case Description
  • This cased is produced based on examples by Sun
    Microsystems, Inc.
  • Java WSDP

3
Application Architecture
4
Business Workflow Scenario
  • Coffee Break server uses both JAXM messaging
    (request/response model) and JAX-RPC to
    communicate with its two distributors
  • Coffee Break server uses JAXR to send a query
    searching for coffee distributors that support
    JAX-RPC
  • Coffee Break server requests price lists from
    each of the coffee distributors price list
    delivered as JavaBean component (JAX-RPC)
    price list delivered as XML document (JAXM)

5
Business Workflow Scenario
Business Workflow Scenario
  • Coffee Break Server creates a local database of
    distributors
  • When an order is placed, suborders are sent to
    one or more distributors using the distributor's
    preferred protocol

6
Architectural Modules
  • JAX-RPC distributor service
  • JAXM distributor service
  • Web server module
  • JAXR registry

7
JAX-RPC Distributor Service
  • Service interface
  • Service implementation
  • Service registration

8
JAX-RPC Distributor Service
Service Interface
package com.sun.cb import java.rmi.Remote impor
t java.rmi.RemoteException public interface
SupplierIF extends Remote public
ConfirmationBean placeOrder(OrderBean order)
throws RemoteException public PriceListBean
getPriceList() throws RemoteException
9
JAX-RPC Distributor Service
Service Implementation
public ConfirmationBean placeOrder(OrderBean
order) Date tomorrow com.sun.cb.DateHelper.add
Days(new Date(), 1) ConfirmationBean
confirmation new ConfirmationBean(order.getId(),
tomorrow) return confirmation public
PriceListBean getPriceList() PriceListBean
priceList loadPrices() return priceList
10
JAX-RPC Distributor Service
Service registration using JAXR
public class OrgPublisher public static void
main(String args) ResourceBundle
registryBundle ResourceBundle.getBundle("com.
sun.cb.CoffeeRegistry") String queryURL
registryBundle.getString("query.url") String
publishURL registryBundle.getString("publish.url
") String username registryBundle.getString("r
egistry.username") String password
registryBundle.getString("registry.password")
String endpoint registryBundle.getString("endpo
int") String keyFile registryBundle.getString(
"key.file")
11
JAX-RPC Distributor Service
Service registration using JAXR
JAXRPublisher publisher new JAXRPublisher()
publisher.makeConnection(queryURL, publishURL)
String key publisher.executePublish (username,
password, endpoint) try FileWriter out new
FileWriter(keyFile) out.write(key)
out.flush() out.close() catch (IOException
ex) System.out.println(ex.getMessage())

12
JAX-RPC Distributor Service
Messaging Model Used
  • Uses request/response messaging
  • JAXM provider is not used
  • Two request/response interactions
  • request Requests for current wholesale coffee
    prices
  • response Current price lists
  • request Customer orders for coffee
  • response Order confirmations

13
JAX-RPC Distributor Service
Messages Being Exchanged
  • Pre-agreed upon Message formats in DTD's
  • request-prices.dtd
  • price-list.dtd
  • coffee-order.dtd
  • confirm.dtd
  • Sample Messages
  • request-prices.xml
  • price-list.xml
  • coffee-order.xml
  • confirm.xml

14
JAX-RPC Distributor Service
JAXM Client
  • Creating request message
  • Extracting information from the response message

15
JAX-RPC Distributor Service
JAXM Service
  • Servlet based
  • PriceListServlet for price list response
    message
  • ConfirmationServlet for order confirmation
    response message

16
Web Server Modules
  • For creating dynamic contents
  • Uses
  • Servlet
  • JSP
  • Template Tag library for common look and feel
  • JSTL custom tags
  • JavaBeans components
  • Contains business logic
  • Send requests to web services
  • Handles responses from web services message

17
Web Server Modules
MVC Pattern
  • Coffee break web module is based on MVC pattern
  • Dispatch servlet as Controller
  • Examines the request URL
  • Creates and initializes model JavaBeans
    components
  • Dispatches requests to view JSP pages

18
Web Server Modules
JSP Pages and Java Beans
  • Update order data
  • JSP page orderForm
  • JavaBean ShoppingCart
  • Update delivery and billing data
  • JSP page checkoutForm
  • JavaBean CheckoutFormBean
  • Display order confirmation
  • JSP page checkoutAck
  • JavaBean OrderConfirmations

19
Web Server Modules
Servlets
  • RetailPriceListServlet
  • Responds to requests to reload the price list
  • Creates a new RetailPriceList and a new
    ShoppingCart
  • Used only by administrator
  • Protected resource
  • In order to load the price list, a user must
    authenticate (using basic authentication) and the
    authenticated user must be in the admin role
Write a Comment
User Comments (0)
About PowerShow.com