Outils pour utilisateurs

Outils du site


cours:app_rep_orientees_service_2016_2017:lab_abc

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
cours:app_rep_orientees_service_2016_2017:lab_abc [2018/03/22 07:36]
tigli [Creation of various endpoints in configuration]
cours:app_rep_orientees_service_2016_2017:lab_abc [2019/04/24 07:33] (Version actuelle)
tigli [Introduction]
Ligne 1: Ligne 1:
  
-==== Introduction ​====+==== Few reminders about WCF ABC Model   ====
  
 The ABC of Windows Communication Foundation The ABC of Windows Communication Foundation
Ligne 22: Ligne 22:
   * You deploy an endpoint for the contract by binding it (using the binding definition, hence the name) to a network address.   * You deploy an endpoint for the contract by binding it (using the binding definition, hence the name) to a network address.
  
 +==== Binding ====
  
-==== Creation ​of various endpoints ​in configuration ====+Bindings are nothing but the transport protocols that are used for the communication with the client application. WCF provides a wide range of transport protocols that can be used as in the requirements.
  
-Endpoints provide clients with access to the functionality a Windows Communication Foundation (WCF) service offers. You can define one or more endpoints for a service by using a combination of relative and absolute endpoint addresses, or if you do not define any service endpoints, the runtime provides some by default for you. This topic shows how to add endpoints using a configuration file that contain both relative and absolute addresses. ​+A binding has the following characteristics:​
  
-== question 1 Adresses == +  * Transport: Defines the base protocol to be used, like HTTP, Named Pipes, TCP and MSMQ are some of the protocols. 
 +  * Encoding (Optional): Three types of encodings are available, they are:
  
-  ​* Take the calculator Web service (with and add and sub between two value) ​ +  ​- Text Encoding 
-  ​* Add various endpoints ​ for this same Web service only changing the web adress (A) on the localhost (only changing port and path so). +  ​- Binary Encoding 
-  ​* To test them write a graphical client that propose add and sub operations ​(two Buttonsbetween two values (two (TextBox)and that displays the result (Label), on two or three different adresses at  least.+  ​- Message Transmission Optimization Mechanism ​(MTOM)
  
-** Comments ​**  +  ​Protocol (Optional)Defines the information to be used in the binding such as Securitytransaction ​or reliable messaging capability.
-// When configuring a service ​in Visual Studiouse either a Web.config file or an App.config file to specify the settings. The choice of the configuration file name is determined by the hosting environment you choose for the service. If you are using IIS to host your service, use a Web.config file. If you are using any other hosting environment,​ use an App.config file//+
  
  
-//Use the Configuration Editor Tool in Visual Studio(or SvcConfigEditor.exe)//​+==== Types of Binding ====
  
-== question 2 Bindings ==+Some predefined bindings are :
  
-  * [[https://​docs.microsoft.com/​en-us/​dotnet/​framework/​misc/​binding|Introduction to Bindings]]+== BasicHttpBinding ==
  
-  ​Take the calculator ​Web service ​(with and add and sub between two value) +   *It is suitable for communicating with ASP.NET ​Web services ​(ASMX)-based services that comfort ​with WS-Basic Profile conformant Web services. 
-  Define two endpoints : one with basicHttpBinding ​and the other with wsHttpBinding +   ​*This binding uses HTTP as the transport ​and text/XML as the default message encoding. 
-  What are the differences between both services now ?  +   ​*Security is disabled by default 
-  To test them write a graphical client that propose add and sub operations (two Buttons) between two values (two (TextBox)and that displays the result (Label), on the two endpoints.+   ​*This binding does not support WS-* functionalities like WS- AddressingWS-Security,​ WS-ReliableMessaging 
 +   *It is fairly weak on interoperability.
  
-== question 3 : Contracts ​== +==  ​WSHttpBinding ​== 
-|||+
  
-** Fault Contract ​**+   *Defines a secure, reliable, interoperable binding suitable for non-duplex service contracts. 
 +   *It offers lot more functionality in the area of interoperability. 
 +   *It supports WS-functionality and distributed transactions with reliable and secure sessions using SOAP security. 
 +   *It uses HTTP and HTTPS transport for communication. 
 +   ​*Reliable sessions are disabled by default.
  
-In WCF (Windows Communication Foundation),​ we will not expose exception directly to client if it occurs at service level. Fault Contract is used to return error details to the other party i.e. client. ​+== WSDualHttpBinding == 
  
-  * Add to your calculator ​WS an exception ​... for example add "​divide"​ operation ​and threw an exception on division by zero:  //throw new Exception(“Exception occurred ​at service level : Divide by zero”);// +This binding is same as that of WSHttpBinding,​ except it supports duplex service. Duplex service is a service which uses duplex message pattern, which allows service ​to communicate with client via callback. 
-  ​* Test it without Fault Contract (with your Graphical Test Client extended to divide numbers)What happens ?  + 
-  ​* To integrate a more meaning full exception, you can add a Fault Contract following these steps :  +In WSDualHttpBinding reliable sessions are enabled by default. It also supports communication via SOAP intermediaries. 
-    * Add [FaultContract(typeof(CustomFaultDetails))]in your [Service Contract] + 
-    * and then use it in your code .. +==  WSFederationHttpBinding ==  
-       ​// CustomFaultDetails ex new CustomFaultDetails();​ // + 
-       ​// ex.ErrorID = “12345“;//​ +This binding support federated security. It helps implementing federation which is the ability to flow and share identities across multiple enterprises or trust domains for authentication and authorization. It supports ​WS-Federation protocol. 
-       ​// ex.ErrorDetails ​“Specific error details here.“; // +NetTcpBinding 
-       * // throw new FaultException(ex,“Reason: Testing…..“); // + 
-  * Test it without Fault Contract ​(with your Graphical Test Client extended to divide numbers)What happens ​+This binding provides secure and reliable binding environment for .Net to .Net cross machine communication. By default it creates communication stack using WS-ReliableMessaging protocol ​for reliability,​ TCP for message delivery ​and windows security for message and authentication ​at run time. It uses TCP protocol and provides support for security, transaction and reliability. 
 + 
 +==  NetNamedPipeBinding ==  
 + 
 +This binding provides secure and reliable binding environment for on-machine cross process communication. It uses NamedPipe protocol and provides full support for SOAP security, transaction and reliability. By default ​it creates communication stack with WS-ReliableMessaging for reliability,​ transport security for transfer security, named pipes for message delivery and binary encoding
 + 
 +==  NetMsmqBinding ==  
 + 
 +   ​*This binding provides secure ​and reliable queued communication for cross-machine environment. 
 +   ​*Queuing is provided by using MSMQ as transport
 +   ​*It enables for disconnected operations, failure isolation and load leveling 
 + 
 +==  NetPeerTcpBinding ==  
 + 
 +   *This binding provides secure binding for peer-to-peer environment and network applications
 +   ​*It uses TCP protocol for communication 
 +   *It provides full support for SOAP security, transaction and reliability. 
 + 
 +==== Exercice : Creation of various endpoints in configuration with different kinds of bindings ===
 + 
 +Endpoints provide clients with access to the functionality a Windows Communication Foundation ​(WCF) service offers. You can define one or more endpoints for a service by using a combination of relative and absolute endpoint addressesor if you do not define any service endpoints, the runtime provides some by default for you 
 + 
 + 
 + 
 +  * Take the calculator Web service ​(with and add and sub between two value) 
 +  * Define two endpoints : one with basicHttpBinding and wsHttpBinding (two standard bindings for SOAP based web services) 
 +  * What are the differences between both services now  
 +  * To test them write a console or a graphical client that propose add and sub operations on the two endpoints.
  
-==== References ==== 
  
-[[https://​msdn.microsoft.com/​fr-fr/​library/​aa480190.aspx|[[Lien externe]]Introduction to Building Windows Communication Foundation Services]] 
cours/app_rep_orientees_service_2016_2017/lab_abc.1521700596.txt.gz · Dernière modification: 2018/03/22 07:36 par tigli