cours:app_rep_orientees_service_2016_2017:lab_contract
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
cours:app_rep_orientees_service_2016_2017:lab_contract [2019/04/23 22:12] – [Type of Contracts] tigli | cours:app_rep_orientees_service_2016_2017:lab_contract [2019/04/24 05:57] (Version actuelle) – [References] tigli | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | |||
+ | ==== Few reminders about WCF ABC Model ==== | ||
+ | |||
+ | The ABC of Windows Communication Foundation | ||
+ | |||
+ | " | ||
+ | |||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | |||
+ | Web services zealots who read Web Service Description Language (WSDL) descriptions at the breakfast table will easily recognize these three concepts as the three levels of abstraction expressed in WSDL. So if you live in a world full of angle brackets, you can look at it this way: | ||
+ | |||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | |||
+ | " | ||
+ | |||
+ | * You define a contract and implement it on a service | ||
+ | * You choose or define a service binding that selects a transport along with quality of service, security and other options | ||
+ | * You deploy an endpoint for the contract by binding it (using the binding definition, hence the name) to a network address. | ||
===== Contracts in WCF ===== | ===== Contracts in WCF ===== | ||
Ligne 12: | Ligne 34: | ||
we've already used Data Contract and Operation Contract. | we've already used Data Contract and Operation Contract. | ||
+ | |||
+ | == Service contract and Operation Contract == | ||
+ | |||
+ | Service contracts define the Interface for the service | ||
+ | |||
+ | An Operation Contract defines the method exposed to the client to exchange the information between the client and server. An Operation Contract describes what functionality is to be given to the client, such as addition, subtraction and so on. | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | == Data Contract == | ||
+ | Data Contracts define the data type for variables that are the same as get and set properties but the difference is that a Data Contract in WCF is used to serialize and deserialize the complex data. It defines how data types are serialized and deserialized. Using serialization, | ||
+ | |||
+ | [[http:// | ||
== Fault Contract == | == Fault Contract == | ||
||| | ||| | ||
- | In WCF (Windows Communication Foundation), we will not expose | + | A Fault Contract handles the exception and understands the cause of the error that occurs in the WCF service. When we develop a managed application or service, we will handle the exception |
+ | |||
+ | [[http:// | ||
== Message Contract == | == Message Contract == | ||
- | DataContract has limited control over the SOAP message | + | The default |
+ | ==== Exercices on Contracts ==== | ||
- | ==== Tutorial ==== | + | === Exercice on DataContract, |
+ | Create a calculator service that implement add and sub operations on complex numbers instead of numerical ones. | ||
+ | This justifies to introduce DataContract for the Complex number Type. | ||
=== Exercice on Fault Contract === | === Exercice on Fault Contract === | ||
- | Create a simple calculator service with Add operation | + | In the Add operation, throw general exception and send exception information from service to client with FaultException. |
+ | |||
+ | |||
- | [[http:// |
cours/app_rep_orientees_service_2016_2017/lab_contract.1556057555.txt.gz · Dernière modification : 2019/04/23 22:12 de tigli