RESTful Web Services article from SDN
2006-09-08 11:40
260 查看
"restful web services" is an article by sameer tyagi, published on sdn, that discusses the use of rest through the jax-ws apis, as shown in the java ee blueprints catalog. the article shows how rest works (including the four verbs normally associated with it) as well as the mechanisms for publishing and c restful services as the standard apis propose.
one very useful part of the article discusses when architects might want to use rest vs. soap:
architects and developers need to decide when this particular style is an appropriate choice for their applications. a restful design may be appropriate when:
the web services are completely stateless. a good test is to c whether the interaction can survive a restart of the server.
a caching infrastructure can be leveraged for performance. if the data that the web service returns is not dynamically generated and can be cached, then the caching infrastructure that web servers and other intermediaries inherently provide can be leveraged to improve performance. however, the developer must take care because such caches are limited to the http get method for most servers.
the service producer and service c have a mutual understanding of the c and c being passed along. because there is no formal way to describe the web services interface, both parties must agree out of band on the schemas that describe the data being exchanged and on ways to process it meaningfully. in the real world, most commercial applicati that expose services as restful implementati also distribute so-called value-added toolkits that describe the interfaces to developers in popular programming languages.
bandwidth is particularly important and needs to be limited. rest is particularly useful for limited-profile devices such as pdas and mobile ph for which the overhead of headers and additi layers of soap elements on the xml payload must be restricted.
web service delivery or aggregation into existing web sites can be enabled easily with a restful style. developers can use technologies such as asynchr javascript with xml (ajax) and toolkits such as direct web remoting (dwr) to c the services in their web applications. rather than starting from scratch, services can be exposed with xml and c by html pages without significantly refactoring the existing web site architecture. existing developers will be more productive because they are adding to something they are already familiar with, rather than having to start from scratch with new technology.
a soap-based design may be appropriate when:
a formal c must be established to describe the interface that the web service offers. the web services description language (wsdl) describes the details such as messages, operati bindings, and location of the web service.
the architecture must address complex n requirements. many web services specificati address such requirements and establish a common vocabulary for them. examples include transacti security, addressing, trust, coordinati and so on. most real-world applicati go bey simple crud operati and require c information and c state to be maintained. with the restful approach, developers must build this plumbing into the application layer themselves.
the architecture needs to handle asynchr processing and invocation. in such cases, the infrastructure provided by standards such as wsrm and apis such as jax-ws with their client-side asynchr invocation support can be leveraged out of the box.
the c of the article sums up what the author is trying to communicate:
jax-ws provides comprehensive support for building web services. developers can leverage the capabilities of this api to build and c a variety of web services, whether those services are based on wsdl or are restful in behavior. the combination of the provider and dispatch interfaces allows web services to be built and c and it provides developers with the flexibility to process the messages sent over the wire in a variety of ways. in additi the future holds the possibility of describing restful web services for tools to c which will further simplify the developer's experience.
however, the amount of code involved in using the apis - even with annotation and api support - is staggering. what's your approach, and what's your opinion of it?
one very useful part of the article discusses when architects might want to use rest vs. soap:
architects and developers need to decide when this particular style is an appropriate choice for their applications. a restful design may be appropriate when:
the web services are completely stateless. a good test is to c whether the interaction can survive a restart of the server.
a caching infrastructure can be leveraged for performance. if the data that the web service returns is not dynamically generated and can be cached, then the caching infrastructure that web servers and other intermediaries inherently provide can be leveraged to improve performance. however, the developer must take care because such caches are limited to the http get method for most servers.
the service producer and service c have a mutual understanding of the c and c being passed along. because there is no formal way to describe the web services interface, both parties must agree out of band on the schemas that describe the data being exchanged and on ways to process it meaningfully. in the real world, most commercial applicati that expose services as restful implementati also distribute so-called value-added toolkits that describe the interfaces to developers in popular programming languages.
bandwidth is particularly important and needs to be limited. rest is particularly useful for limited-profile devices such as pdas and mobile ph for which the overhead of headers and additi layers of soap elements on the xml payload must be restricted.
web service delivery or aggregation into existing web sites can be enabled easily with a restful style. developers can use technologies such as asynchr javascript with xml (ajax) and toolkits such as direct web remoting (dwr) to c the services in their web applications. rather than starting from scratch, services can be exposed with xml and c by html pages without significantly refactoring the existing web site architecture. existing developers will be more productive because they are adding to something they are already familiar with, rather than having to start from scratch with new technology.
a soap-based design may be appropriate when:
a formal c must be established to describe the interface that the web service offers. the web services description language (wsdl) describes the details such as messages, operati bindings, and location of the web service.
the architecture must address complex n requirements. many web services specificati address such requirements and establish a common vocabulary for them. examples include transacti security, addressing, trust, coordinati and so on. most real-world applicati go bey simple crud operati and require c information and c state to be maintained. with the restful approach, developers must build this plumbing into the application layer themselves.
the architecture needs to handle asynchr processing and invocation. in such cases, the infrastructure provided by standards such as wsrm and apis such as jax-ws with their client-side asynchr invocation support can be leveraged out of the box.
the c of the article sums up what the author is trying to communicate:
jax-ws provides comprehensive support for building web services. developers can leverage the capabilities of this api to build and c a variety of web services, whether those services are based on wsdl or are restful in behavior. the combination of the provider and dispatch interfaces allows web services to be built and c and it provides developers with the flexibility to process the messages sent over the wire in a variety of ways. in additi the future holds the possibility of describing restful web services for tools to c which will further simplify the developer's experience.
however, the amount of code involved in using the apis - even with annotation and api support - is staggering. what's your approach, and what's your opinion of it?
相关文章推荐
- java端RESTful web services的几种实现方式
- 使用 Spring 3 来创建 RESTful Web Services
- jax-rs(Java API for RESTful Web Services) 实践教程 之四 —— @Context注入HttpServletRequest 使REST保持状态!
- 就是这么简单!使用Rest-assured 测试Restful Web Services
- 使用Jersey框架创建RESTful Web Services
- 使用Jersey框架创建RESTful Web Services
- 通过Ajax方式上传文件,使用FormData进行Ajax请求 博客分类: RESTful Web ServicesWeb前端开发
- jax-rs(Java API for RESTful Web Services)实践教程 之二 —— get/post/put/delete/head
- Spring MVC 4 RESTFul Web Services CRUD例子(带源码)【这才是restful,超经典】
- 《 Restful Web Services 》读书笔记 | Chapter Five
- Access Web services from wireless devices
- 《 Restful Web Services 》读书笔记 | Chapter SIX
- RESTful Web services: The basics
- Windows Communication Foundation and RESTful Web Services Primer(教你制作rest wcf)
- 深入理解RESTful Web Services
- Spring MVC 4 RESTFul Web Services CRUD例子(带源码)【这才是restful,超经典】
- 《RESTful Web Services》第三章 设计表述
- Jersey -RESTful Web Services in Java基础框架示例
- java搭建RESTful WebServices 快速入门(一)