WCF supports 5 types of contracts
The data type that a service should be use in metadata to enable others to interoperate with the service/ described as data contract.
An operation contract defines the operations, their parameters & the return types.
A fault contract can be associated with service operation to denote errors that can be return
A service contract can be said as the combination of other contracts mentioned above.
An end point is a construct, at which messages are sent/received.
An endpoint is defined in a web.confing file by using the 3 attributes address, binding & contract like <endpoint address = “Value” binding = “Value” contract = “Value”> </enclpoint>
A message is a self contained unit of data which contains several parts like body, header, etc. Message are sent between endpoints of dient & service. WCF supports following message patterns.
Simplex This is one way communication from client to service. In this mechanism / pattern client serds request / message to the service, service consumes that request but doesn’t respond back to the client. To work / implement this message pattern set “ Is one way” property to “true” along with [operation contract] attribute like, [operation contract (is one way = true)] The methods which are following simplex message pattern should not return a value i.e., should not have return type (or) should not contain reference & out parameters. Otherwise, they through an conception “System invalid operation” exception.
This is a two way / bidirectional communicate service and service respond to the client by conserve that message. Client & service will exchange the messages cuing channel A duplex service contract is a message exchange pull in which both client & service endpoints can semi messages to each other independently. To implement this message pattern set “I someway property of [operation contract] attribute to “true” create the call back interface that defines the of operations for invoking on the client Request – Reply This is the default messaging path followed in WCF. In this type of pattern client makes a call to service tions & waits for a response from the service Client request & service response will be through event channels.
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.