RESTful Web Services » History » Version 14
chin-yeh, 10/13/2011 09:10 AM
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 | 14 | chin-yeh | > the source file can be found in the trunk, *connector-poc* in [[qconnector:wiki#SCM|SCM]] |
23 | 7 | chin-yeh | |
24 | The *Shopper* service provides: |
||
25 | * add new shopper |
||
26 | * update shopper profile |
||
27 | * retrieve shopper profile based on ID |
||
28 | |||
29 | 9 | chin-yeh | In short, a new web service method should contain the following components(at least): |
30 | 8 | chin-yeh | !mapping.png! |
31 | 12 | chin-yeh | _Detailed Description:_ |
32 | 11 | chin-yeh | * *Controller* - this is the place where the client talk to |
33 | * *Services* - this is the business logic of the service |
||
34 | * *DAOs* - persist or query data from data source, e.g. database |
||
35 | 13 | chin-yeh | |
36 | h3. How to develop web service client |
||
37 | |||
38 | Any programming language which has the *RESTful* & *JSON* API. For the sample RESTful client, refer to the *com.ecosway.connector.poc.client* package in the *connector-poc* project in the [[qconnector:wiki#SCM|SCM]]. |