- If client invokes server in loop as follows, it will have bad performance.
Client:
foreach ()
{
invoke server
}
In order to improve performance, client should invoke serve once (get a collection of results) as follows, then client will handle these results in loop.
Client:
collection results = invoke server;
foreach (result in results)
{
handle result;
}
- WebMessageBodyStyle
比如:
xml:
Bare:
1: 请求消息主体:
2: <Employee xmlns="http://www.artech.com/"
3: xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
4: <Department>行政部</Department>
5: <Grade>G9</Grade>
6: <Id>003</Id>
7: <Name>王五</Name>
8: </Employee>
Wrapped:
1: 请求消息主体:
2: <Create xmlns="http://tempuri.org/">3: <employee xmlns:a="http://www.artech.com/"4: xmlns:i="http://www.w3.org/2001/XMLSchema-instance">5: <a:Department>行政部</a:Department>6: <a:Grade>G9</a:Grade>7: <a:Id>003</a:Id>8: <a:Name>王五</a:Name>9: </employee>10: </Create>
Json:
Bare:
1: 请求消息主体:
2: {"Department":"行政部","Grade":"G9","Id":"003","Name":"王五"}Wrapped:1: 请求消息主体:
2: {"employee":{"Department":"行政部","Grade":"G9","Id":"003","Name":"王五"}}
- If client has cache, it should get data from cache first; if not found, then get data from server again.
- Getting data from server and updating UI should process asynchronously.
- If client calling web service failed, you can copy url to browser to see what happens. (there will be some detailed information for failure.)
- Response status code: 1xx(information,不), 2xx (ok,好), 3xx(redirect,转), 4xx(client error,客), 5xx(server error,服)