WCF 绑定消息格式混淆
我对 WCF 感到困惑,有人可以帮我澄清一下吗?
根据 Michele Leroux 的 WCF 书籍,以下内容是正确的。
“无论消息编码格式如何,消息都会以 SOAP 1.1 或 SOAP 1.2 的形式在网络上表示” - 我通过创建一个简单的 net.tcp 绑定服务并使用 WCF 测试客户端查看请求和响应 XML 来确认这一点。
根据 http://www.codemeit.com /wcf/wcf-restful-pox-json-and-soap-coexist.html 但是,以下情况是正确的。“webHttpBinding 指定服务理解通用 HTTP 请求而不是 SOAP 请求。REST服务构建在带有 GET HTTP 动词的通用 HTTP 请求之上。”
那么这两种说法怎么可能都是真的呢?
Im getting confused with WCF, can someone clarify this for me please.
According to Michele Leroux's WCF book the following is true.
"Regardless of the message-encoding format, messages are represented on the wire either as SOAP 1.1 or SOAP 1.2" - I confirmed this by creating a simple net.tcp bound service and used the WCF test client to see the request and response XML.
According to http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html however, the following is true."webHttpBinding specifies that the service understands generic HTTP requests instead of SOAP requests. The REST service is built on top of generic HTTP request with GET HTTP verb."
So how can both these statements be true?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
WCF 现在有人格分裂。其中绝大多数内容都涉及 SOAP(1.1 或 1.2),即使编码器生成 XML 以外的内容,消息最终也会结构化为 SOAP。
但是,WebHttpBinding 很特殊。它使用 Json/POX 编码器,将所有 SOAP 框架从消息中剥离出来,只发送消息正文,但是这恰好是在线结构化的。这意味着它可用于通过 HTTP 发送任何内容类型
WCF now has a split personality. The vast majority of it talks SOAP (1.1 or 1.2) and messages end up structured as SOAP on the wire even if the encoder produces something other than XML
However, the WebHttpBinding is special. It uses the Json/POX encoder which strips all of the SOAP framing off the message just sending the message body, however that happens to be structured, down the wire. This means that it can be used to send any content type over HTTP