Google协议缓冲区和HTTP [英] Google Protocol Buffers and HTTP
问题描述
我使用gSoap重构旧的C ++系统到SOA。我们有一些性能问题(非常大的XML),所以我的主管问我看看协议缓冲区。我做了,它看起来很酷(我们需要C + +和Java支持)。然而协议缓冲区只是用于序列化的解决方案,现在我需要将其发送到Java前端。我应该从C ++和Java透视图中通过HTTP(只是内部网络)发送这些序列化的东西?
I'm refactoring legacy C++ system to SOA using gSoap. We have some performance issues (very big XMLs) so my lead asked me to take a look at protocol buffers. I did, and it looks very cool (We need C++ and Java support). However protocol buffers are solution just for serialization and now I need to send it to Java front-end. What should I use from C++ and Java perspective to send those serialized stuff over HTTP (just internal network)?
PS。另一个人试图加速我们的gSoap解决方案,我只对协议缓冲区感兴趣。
PS. Another guy tries to speed-up our gSoap solution, I'm interested in protocol buffers only.
推荐答案
具有HTTP请求的二进制有效载荷,或在HTTP响应中。只需将协议缓冲区的字节直接写入请求/响应,并确保将内容类型设置为application / octet-stream。客户端和服务器应该能够轻松地处理休息。我不认为你需要任何更加特别的任何一端。
You can certainly send even a binary payload with an HTTP request, or in an HTTP response. Just write the bytes of the protocol buffer directly into the request/response, and make sure to set the content type to "application/octet-stream". The client, and server, should be able to take care of the rest easily. I don't think you need anything more special than that on either end.
这篇关于Google协议缓冲区和HTTP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!