其余的代理对象生成器 [英] ReST Proxy Object Generator

查看:147
本文介绍了其余的代理对象生成器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个第三方公司已经编写了一组REST服务。我已经得到了所有的code工作,但在事后,除去一些腿部的工作,我想有人会知道,连接到REST服务,使用的是哪种请求和响应对象code发电机需要创建并生成code表示那些。我对谷歌一看,却什么也没看到合适的(也许这就是所谓的别的东西)。

A third party company has written a set of ReST service. I've got all the code working, but in hindsight, to remove some of the leg work, I thought someone might know of a code generator that connects to the ReST service and works out what request and response objects need to be created and generate the code for those. I had a look on google, but didn't see anything suitable (maybe it's called something else).

我在寻找类似于添加在Visual Studio中的Web引用,它生成代理,它需要你的对象的功能。

I'm looking for functionality similar to adding a Web Reference in Visual studio, where it generates the proxy and the objects it requires for you.

REST服务是用Java编写的,所以我不能使用任何好的WCF的东西。

The ReST service is written in Java, so I can't use any of the nice WCF stuff.

推荐答案

这是不是真的有可能我很害怕,除非服务的发行商专门发布元数据以某种形式对他们的服务;然后它会是一个专有的扩展,你必须code特别针对自己。

This isn't really possible i'm afraid, unless the publisher of the service specifically publishes meta data in some form about their service; and then it'll be a proprietary extension that you'll have to code specifically against yourself.

没有什么内置的REST,使自我介绍,所以没有办法知道哪些藏品等等都可用,或什么对象需要/暴露,直到你真正调用它。

There's nothing built in to REST to enable self-description so there is no way of knowing what what collections etc are available, or what objects it needs/exposes until you actually invoke it.

这是例外的情况是类似的的OData服务,其中关于对象的元数据与对象公布收藏自己 - 但随后的OData是建在一个RESTful方式的协议;这是不同的,以它只是被'REST服务。

An exception to this is something like an oData service where meta data about objects is published along with the object collections themselves - but then oData is a protocol built in a RESTful manner; that's different to it just being 'a REST service'.

这样一来,你在服务作者的怜悯是dilligent并为您提供您需要一个可以被机器读出并转化为code中的信息。

As a result, you're at the mercy of the service authors to be dilligent and provide you with the information you need that can read by a machine and turned into code.

例如,如果数据传输使用XML那么他们也应该(恕我直言)公布其描述对象的一个​​或多个XML模式,他们会发给你,他们希望你发送给他们。

For example, if the data is transported with XML then they should also (imho) publish one or more XML schemas that describe the objects they will send to you and that they expect you to send to them.

这是最大的战役 - 写作code到实际上与REST服务接口可能是最容易的;不是试图code自己的SOAP客户端肯定更漂亮!

That's the biggest battle - as writing code to actually interface with a REST service is probably the easiest; certainly much nicer than trying to code your own SOAP client!

这篇关于其余的代理对象生成器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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