您的位置:首页 > 职场人生

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?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  职场 Services web