随笔 - 7  文章 - 5  trackbacks - 0
<2006年10月>
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

目前在研究生阶段,主要是做基于J2EE的web services

常用链接

留言簿(2)

随笔分类

文章分类

最新随笔

最新评论

RESTful Web Services


1. The Fundamental
 
   1.1 What’s REST 
            REST: REpresentational State Transfer 
            It’s an architecture style (the stateless client-server architecture), not a toolkit. 
   1.2 REST defined 
            ●Resources are identified by uniform resource identifiers (URIs) 
            ● Resources are manipulated through their representations 
            ●Messages are self-descriptive and stateless 
            ●Multiple representations are accepted or sent 
            ●Hypertext is the engine of application state 
   1.3 Representation 
            Just think that a web page is a representationof a resource, and the customer can get the resource from the URLs. Clients can then request a specific representation of the concept from the representations the server makes available. 
   1.4 State 
         “State” means application/session state, maintained as part of the content transferred from client to server back to client.Application state is the information necessary to understand the context of an interaction.The "stateless" constraint means that all messages must include all application state. 
     1.5 Transfer of state 
         ●Connectors (client, server, cache, resolver, and tunnel) are unrelated to sessions 
         ●State is maintained by being transferred from clients to servers and back to clients

The Conclusion:
 
         So we can say that “REST is a post hocdescription of the Web”. Unsurprisingly, HTTP is the most RESTful protocol. 

    1.6 REST messages 
           REST can support any media type, but XML is expected to be the most popular transport for structured information, it can make a resource have as many representations as you need,The XmlHttpRequest object lets you do REST from insidea web page.Unlike SOAP and XML-RPC, REST does not really require a new message format; it’s just use URLs to transfer the messages as parameters. 
   1.7 Web based application 
          A Web-based application is a dynamically changing graph of 
         – State representations (pages) 
         – Potential transitions (links) between states 
   1.8 OOP on REST 
          Every useful data object has an address;Resources themselves are the targets for method calls; the list of methods is fixed for all resources. 
   1.9 REST and RPC 
            ●REST is, in a sense, a species of RPC, except the methods have been defined in advance. REST is incompatible with "end-point" RPC. So REST is architecture not only a design style. 
            ●Most RPC applications don't adhere to the REST philosophy. 
            ●It’s possible to work with RPC-style tools to produce REST results. 
   1.10 POST on the REST attitude 
          There are two views on POST, the first is “POST lets you pass a whole lot of parameters and get something back, bypassing caches.”, and the other is “POST lets you create new resources that are related to old ones.” The second view is on the REST point.
 
2. RESTful Web Services 
         In the web services world, REpresentational State Transfer (REST) is a key design idiom that embraces a stateless client-server architecture in which the web services are viewed as resources and can be identified by their URLs. The Java API for XML Web Services (JAX-WS) provides full support for building and deploying RESTful web services. 
   2.1 When to use REST 
            ● The web services are completely stateless. 
            ●A caching infrastructure can be leveraged for performance. 
            ●The service producer and service consumer have a mutual understanding of the context and content being passed along. 
            ●Bandwidth is particularly important and needs to be limited. 
            ●Web service delivery or aggregation into existing web sites can be enabled easily with a RESTful style.
2.2 How to build a RESTful Web Service 
         JAX-WS enables building RESTful endpoints through a javax.xml.ws.Provider interface in the API. Provider is a generic interface that can be implemented by a class as a dynamic alternative to a service endpoint interface (SEI).
       The two important annotations in development:
       1. @WebServiceProvider (wsdl=”…….”)   //wsdl can omit
       2. @BindingType (value=HTTPBinding.HTTP_BINDING)   //Must
      
Reference:
  1. RESTful Web Services by Sameer Tyagi: 
            http://java.sun.com/developer/technicalArticles/WebServices/restful/ 
  2. Publishing a RESTful Web Service with JAX-WS by Doug Kohlert:                     
          http://weblogs.java.net/blog/kohlert/archive/2006/01/publishing_a_re.html
 
3. Make Your Service RESTFul by Robin Zou: 
          http://zouzhile.googlepages.com/basicrestful
 
posted on 2006-10-14 15:26 Stefanie 阅读(855) 评论(2)  编辑  收藏 所属分类: web services

FeedBack:
# re: RESTful Web Services 2006-10-16 20:38 Robin Zou
呵呵, 居然你都开java博客了! 庆祝你开张大吉, 上来顶一下: 顶!!!!!
哈哈  回复  更多评论
  
# re: RESTful Web Services[未登录] 2008-05-10 14:50 user
《RESTful Web Services中文版》官方网站(http://restfulwebservices.cn)提供《RESTful Web Services中文版》PDF电子版样章下载。  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航:
博客园   IT新闻   Chat2DB   C++博客   博问