简体   繁体   English

在WCF中以哪种格式发送消息

[英]In which format messages are sent in WCF

Context 语境

I am new to WCF . 我是WCF新手。

I was reading an article about message contract and found that WCF is sending message using SOAP . 我在阅读有关消息契约的文章,发现WCF正在使用SOAP发送消息。

My doubt is, if we are enabled REST in WCF service , then will it still use SOAP format for exchanging data. 我的疑问是,如果我们REST in WCF service中启用了REST in WCF service ,那么它将仍然使用SOAP格式交换数据。

In WebGet and WebInvoke attribute[which are for REST ], we are mentioning the inputformat like JSON or XML . WebGetWebInvoke属性(用于REST )中,我们提到了JSONXML

Question

If messages are sent through SOAP , then why are those needed ? 如果消息是通过SOAP发送的,那么为什么需要这些消息?

If all message contracts are sent using SOAP format, then message contract should not work in case of webHttp binding. 如果所有消息约定都使用SOAP格式发送,则在webHttp绑定的情况下消息约定不起作用。

The protocol format will depend on the binding you select. 协议格式将取决于您选择的绑定。 Here's a list of the different system provided bindings and the underlying protocol they use. 这是a list of the different system provided bindings及其使用的基础协议a list of the different system provided bindings

In WebGet and WebInvoke attribute[which are for REST], we are mentioning the inputformat like JSON or XML. 在WebGet和WebInvoke属性(用于REST)中,我们提到了JSON或XML之类的输入格式。 If messages are sent through SOAP, then why are those needed. 如果消息是通过SOAP发送的,那么为什么需要这些消息。

If you use the WebHttpBinding which uses standard HTTP instead of SOAP then those attributes allow you to specify whether you want to format the requests using plain XML (not SOAP) or JSON. 如果使用使用标准HTTP而不是SOAP的WebHttpBinding ,则这些属性允许您指定是要使用纯XML(不是SOAP)还是JSON格式化请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM