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 am watching a guide to WCF and it is talking about how exceptions are serialized into SOAP and sent to the client. I would have thought that not all bindings would use SOAP to send data, so I am a bit confused about how it works.
Although I understand the fundamentals of WCF, how to set up services and use a proxy on the client, it doesn't seem to have explained exactly how the data is packaged up to send.
Perhaps the answer is obvious, that it just uses XML / SOAP, but I would love to know for sure!
WCF services use SOAP by default, but the messages can be in any format, and conveyed by using any transport protocol like HTTP,HTTPs, WS- HTTP, TCP, Named Pipes, MSMQ, P2P(Point to Point) etc.
Choosing a Binding The first question you should ask yourself is whether your service needs to interact with non-WCF clients. If the answer is yes, and if the client is a legacy MSMQ client, choose the MsmqIntegrationBinding that enables your service to interoperate over MSMQ with such a client.
Bindings are objects that are used to specify the communication details that are required to connect to the endpoint of a Windows Communication Foundation (WCF) service. Each endpoint in a WCF service requires a binding to be well-specified.
NetMsmqBinding. It is used for queue communication. It means that this binding gives us secure and reliable queued communication for the cross machine environment. Uses MSMQ as transport protocol and provides reliable, robust and distributed application.
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
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With