RESTful开发-如何与客户共享? [英] RESTful development -How to share with clients?

查看:75
本文介绍了RESTful开发-如何与客户共享?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Jersey/Tomcat6开发某些Web服务.与我对SOAP服务所做的相比,我不知道一旦开发了服务,我应该分享给我的客户什么……只是Web服务的URL?对于SOAP,WSDL文件就足够了,因为客户端可以自行生成存根.

I am using Jersey/Tomcat6 for dveloping some web services. Compared to what I did for SOAP services, I am not getting the idea what should I share to my clients once the services are developed...just the URL of the web service ?? For SOAP, the WSDL file was enough, as the clients self-generated the stubs.

我的服务以JSON格式返回User对象(带有2个字符串)的列表.如果我只与他们共享服务URL,我的客户将如何反序列化JSON?我是否也需要在服务器端共享实体bean(User类和list类)?

My service returns a list of User objects (with 2 Strings) in JSON format. How would my clients de-serialize the JSON if I share just the service URL with them ? Do I need to share the entity bean (The User class, and the list class) on my server side too ?

我一直在阅读一些用于REST的WADL文件...在这里有帮助吗?

I have been reading about some WADL files for REST...are they helpful here ?

感谢您的帮助!

推荐答案

听起来您可能想将一个示例客户端放在一起给所有客户端,以向他们展示如何使用REST服务.当然,理想情况下,您的REST服务将完全支持HATEOAS(作为应用程序状态引擎的超媒体),因此可以发现遍历资源以获得所需结果的方法.我发现真正的HATEOAS实现很少见.对于RESTful式的服务(不完全支持HATEOAS的服务),示例客户端很有用.通常,您可以使用一些Javascript在HTML中实现示例客户端.这使得大多数REST客户端用户都可以轻松访问所有内容.

It sounds like you probably want to put together an example client to give to your, er, clients to show them how to use the REST service. Ideally, of course, your REST service would fully support HATEOAS (Hypermedia As The Engine Of Application State), and so the means of traversing the resources to get the desired results would be discoverable; I've found that real HATEOAS implementation is rare, though. For a RESTful-ish service (one that doesn't fully support HATEOAS), example clients are useful. You can usually implement your example client in HTML with some Javascript; this makes everything very accessible for most REST client users.

这篇关于RESTful开发-如何与客户共享?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆