Does WCF always use SOAP to send information over your binding?

前端 未结 1 941
梦如初夏
梦如初夏 2020-12-28 22:26

I understand you can choose from a range of bindings, such as TCP, HTTP, HTTPS etc.

Am I correct in thinking it always uses SOAP to send data over this connection? I

相关标签:
1条回答
  • 2020-12-28 23:12

    No, not all. The WebHttpBinding is designed around REST protocols (HTTP GET, POX, JSON, etc.)

    Technically, WCF is just a generic messaging protocol and can use any kind of encoding at all. The default and most common encodings are basicHttpBinding and wsHttpBinding, which are both based around SOAP/XML.

    Then you have netTcpBinding, which uses a binary message encoding, netMsmqBinding, which uses the Microsoft Message Queue (MSMQ) protocol, and so on. There's really no hard-coded format for messages in WCF.

    SOAP has its own specification for serializing exceptions (AKA faults), so the behaviour is always more or less the same when you use a SOAP-based binding; when you use other bindings, the faulting behaviour may be considerably different, in some cases actually swallowing exceptions unless you override the default behaviour (this is what happens in the webHttpBinding).

    0 讨论(0)
提交回复
热议问题