RESTful Web Services » History » Version 11
chin-yeh, 10/12/2011 06:20 PM
1 | 1 | chin-yeh | {{toc}} |
---|---|---|---|
2 | |||
3 | h1. RESTful Web Services |
||
4 | 2 | chin-yeh | |
5 | 5 | chin-yeh | h2. System Overview |
6 | 1 | chin-yeh | !rest_json.png! |
7 | 5 | chin-yeh | |
8 | h2. Programming Guide |
||
9 | |||
10 | 6 | chin-yeh | Below is the overview of the *web service layers*: |
11 | 1 | chin-yeh | !component.png! |
12 | 6 | chin-yeh | _Detailed Description:_ |
13 | * *(1)* this is the only integration point for the client |
||
14 | 7 | chin-yeh | * *(2)* this is the service layer that contains business logic |
15 | 6 | chin-yeh | * *(3)* this is the persistence layer |
16 | * *(4)* this is the web service client, it could be web application, ajax application, batch program, as long as it can read or parse <code>JSON</code> formatted data |
||
17 | 1 | chin-yeh | * *(5)* all of the components share the same domain objects |
18 | 7 | chin-yeh | |
19 | h3. How to add new web service method |
||
20 | |||
21 | We use the *Shopper* service to demonstrate how to add new web service method into the existing web service. |
||
22 | |||
23 | The *Shopper* service provides: |
||
24 | * add new shopper |
||
25 | * update shopper profile |
||
26 | * retrieve shopper profile based on ID |
||
27 | |||
28 | 9 | chin-yeh | In short, a new web service method should contain the following components(at least): |
29 | 8 | chin-yeh | !mapping.png! |
30 | 11 | chin-yeh | * *Controller* - this is the place where the client talk to |
31 | * *Services* - this is the business logic of the service |
||
32 | * *DAOs* - persist or query data from data source, e.g. database |