将 protobuf-net 与 WCF 客户端和 java 服务器结合使用
我们希望使用“协议缓冲区”在 .net 客户端和 java 服务器之间进行通信。
理想情况下,希望通过 WCF 使用 protobuf-net,因为我们与其他服务的所有其余通信都通过 WCF 堆栈。
我有一个概念证明 .net WCF 客户端使用 protobuf-net 端点行为与 .net WCF 服务器通信,这似乎工作正常。
我的问题是我们如何配置java服务器以将proto-buf发送到我们的WCF客户端?即,我们是否需要将 java 服务器作为 SOAP 服务公开给 WCF,并通过它发送 proto-buf?
We are looking to communicate between a .net client and a java server using 'Protocol Buffers'.
Ideally would would like to use protobuf-net through WCF since all the rest of our communications to other services goes through the WCF stack.
I have a proof of concept .net WCF client talking to a .net WCF server using protobuf-net endpoint behaviour and that seems to work fine.
My question is how would we go about configuring the java server to send the proto-buf to our WCF client? I.e. Do we need to expose the java server to WCF as a SOAP services and send the proto-buf over that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您的 WCF 客户端使用 protobuf-net 端点,那么它就没有使用 SOAP,不是吗?我不能说我个人使用过 protobut-net,但我知道它是 SOAP 的替代品。基本上,看看它使用的协议并实现与 servlet 相同的协议。老实说,我希望这相当简单。
如果它有效并且您可以将 servlet 作为开源贡献,我怀疑您不是唯一愿意这样做的人:)
If your WCF client is using a protobuf-net endpoint, it's not using SOAP is it? I can't say I've used protobut-net personally, but I understood that it was an alternative to SOAP. Basically, have a look at the protocol it uses and implement the same protocol as a servlet. I would expect that to be reasonably simple, to be honest.
If it works and you can contribute the servlet as open source, I suspect you're not the only one who'd like to do this :)
在这种情况下,我强烈建议使用常规 SOAP 作为协议,并将
byte[]
或Stream
(或任何有效的)公开为有效负载 - 然后处理应用程序中的编码。WCF 中的序列化器挂钩意味着它很大程度上类似于
byte[]
有效负载(基于每个参数/结果),但我不能保证它将在 WCF 之外轻松解构。此外...如果您将其描述为包含 BLOB 的 SOAP 消息,那么您就是诚实的 SOAP。
In that scenario, I would strongly recommend using regular SOAP for the protocol, and exposing a
byte[]
orStream
(or whatever works) as the payload - and then handle the encoding in your application.The serializer hooks in WCF mean that it is largely similar to a
byte[]
payload (on a per-parameter/result basis), but I can't guarantee that it will be easily deconstructed outside of WCF.Besides... if you describe it as a SOAP message that includes a BLOB, you are being truthful to SOAP.