开发者

I need an efficient protocol between webservices that are more or less supported by all major languages

I am looking for a fast and efficient protocol that can be used between different web services to send text-data (not binary data). Doesn't matter if the protocol is binary or text base.

Some conditions:

  • I has to be more "efficient" than normal XML which adds a lot of extra data and the tools to read/write is too heavy

  • It has to be "supported" by most major languages, meaning it cannot only be available for one specific language. At the moment, both Java and PHP have to be开发者_开发百科 able to talk to each other using this protocol.

I have already looked at:

  • XML - which I am currently using.
  • Hessian 2 -which works perfectly in Java, but the PHP-support is out of date
  • JSON -the different between JSON and XML is only minor

Any suggestions are welcome!

Update 1: It should be possible to use this protocol over HTTP.


I have two answers.

First of all, REST services are "supported" from any stack capable of making an HTTP request. If you really need better efficiency than SOAP, just doing it yourself with REST is probably your best bet.

Second, does it really need to be 'more "efficient" than normal XML'? Have you profiled it? Are you certain that data transfer between your service and the client is going to be your bottleneck? How big is your payload with/without the XML?


Protocol Buffers might be exactly what you want. It's a Google creation that, in their words, is "a language-neutral, platform-neutral, extensible way of serializing structured data for use in communications protocols, data storage, and more."

Their official docs show implementations in Java, C++ and Python. However, the protocol is simple and has been implemented in a lot of languages (I use a C# implementation, for example.)

IMHO, there are other methodologies in this area, but nothing quite meets the sweet spot of proto-buffers in terms of simplicity and performance across a variety of languages.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜