Mariano O. Rodriguez
Agenda Introducción Contratos Binding Behaviors REST Nuevo en WCF4
ABC de WCF Address (Donde) Binding (Como) Contract (Que)
WCF Channel Layer       Cliente              Servicio  Protocol Channel 1   Protocol Channel 1  Protocol Channel 2   Proto...
Contratos
Contratos                  Describe las operaciones que el servicio    Servicio                    realiza. Mapea tipos CL...
Service Contract[ServiceContract]public interface ICalculator{    [OperationContract]    ComplexProblem Do(ComplexProblem ...
Service Contract: OneWay[ServiceContract]public interface IOneWayCalculator{    [OperationContract(IsOneWay=true)]    void...
Service Contract: Duplex[ServiceContract(      CallbackContract=typeof(ICalculatorResults)]public interface ICalculatorPro...
Service Contracts: Faults[ServiceContract]public interface ICalculator{    [OperationContract]    [FaultContract(typeof(Di...
Data Contract[DataContract]public class ComplexNumber{    [DataMember]    public double Real;    [DataMember]    public do...
Message Contract[MessageContract]public class ComplexProblem{    [MessageHeader]    public string Operation { get; set;}  ...
Bindings
Standard BindingsName                      Transport    EncodingBasicHttpBinding          HTTP/HTTPS   Text/MTOMNetTcpBind...
Binding en Configuracion<system.serviceModel>  <services>    <service name="CalculatorService">      <endpoint address=“ht...
Custom Bindings<bindings>    <customBinding>        <binding configurationName="Binding1">            <reliableSession buf...
Behaviors
Behaviors Overview Implementan semántica del sistema    Para el desarrollador       Concurrencia       Instanciación  ...
Instanciación Per Call Singleton Session
Throttling<behaviors>  <behavior configurationName="CalculatorBehavior" >    <serviceThrottling maxConcurrentCalls="10"   ...
REST Acrónimo de REpresentational State Transfer Es un estilo de arquitectura    Mejor uso de HTTP    Menor complejida...
Principios de REST Identificar recursos por medio de URIs Uso de verbos HTTP Link resources Presentación en múltiples ...
Identifica recursos con URIshttp://myservice/roomshttp://myservice/rooms(3)http://myservice/Colors(red)http://myservice/Tr...
Verbos HTTP usados Get: obtiene la representación de un recurso Put: actualiza un recurso Post: crea un nuevo recurso ...
Link Resources<order self=’http://example.com/orders(1234)’>  <amount>23</amount>  <product  ref=’http://example.com/produ...
REST en WCF
REST en WCF Basado en nuevos atributos    WebGet (Get)    WebInvoke (Post/Put/Delete) Permite definir el tipo de Seria...
Nuevo en WCF 4   Simplificación de configuración   Activación en IIS (.svc opcional)   Soporte de WS-Discovery (udp bas...
Referencias A Guide to Designing and Building RESTful Web  Services with WCF 3.5    http://msdn.microsoft.com/en-us/libr...
Upcoming SlideShare
Loading in...5
×

WCF 4 Overview

1,504

Published on

Overview of WCF 4 main features

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,504
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
80
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

WCF 4 Overview

  1. 1. Mariano O. Rodriguez
  2. 2. Agenda Introducción Contratos Binding Behaviors REST Nuevo en WCF4
  3. 3. ABC de WCF Address (Donde) Binding (Como) Contract (Que)
  4. 4. WCF Channel Layer Cliente Servicio Protocol Channel 1 Protocol Channel 1 Protocol Channel 2 Protocol Channel 2 Protocol Channel N Protocol Channel N Encoder Encoder Transport Transport
  5. 5. Contratos
  6. 6. Contratos Describe las operaciones que el servicio Servicio realiza. Mapea tipos CLR (WSDL). Describe la estructura de datos. Mapea tipos Datos CLR (XSD). Define la estructura del mensaje. Mapea tipos Mensaje CLR (SOAP message)
  7. 7. Service Contract[ServiceContract]public interface ICalculator{ [OperationContract] ComplexProblem Do(ComplexProblem p);}
  8. 8. Service Contract: OneWay[ServiceContract]public interface IOneWayCalculator{ [OperationContract(IsOneWay=true)] void Do(ComplexProblem p);}
  9. 9. Service Contract: Duplex[ServiceContract( CallbackContract=typeof(ICalculatorResults)]public interface ICalculatorProblems{ [OperationContract(IsOneWay=true)] void SolveProblem (ComplexProblem p);}public interface ICalculatorResults{ [OperationContract(IsOneWay=true)] void Results(ComplexProblem p);}
  10. 10. Service Contracts: Faults[ServiceContract]public interface ICalculator{ [OperationContract] [FaultContract(typeof(DivideByZeroException))] ComplexProblem Do(ComplexProblem p);}try { return n1 / n2;}catch (DivideByZeroException e) { var f = new DivideByZeroException(“Calc Failure”); throw new FaultException<DivideByZeroException>(f);}
  11. 11. Data Contract[DataContract]public class ComplexNumber{ [DataMember] public double Real; [DataMember] public double Imaginary { get; set; }}
  12. 12. Message Contract[MessageContract]public class ComplexProblem{ [MessageHeader] public string Operation { get; set;} [MessageBody] public ComplexNumber Op1 { get; set; } [MessageBody] public ComplexNumber Op2 { get; set; }}
  13. 13. Bindings
  14. 14. Standard BindingsName Transport EncodingBasicHttpBinding HTTP/HTTPS Text/MTOMNetTcpBinding TCP BinaryNetPeerTcpBinding P2P BinaryNetNamedPipeBinding IPC BinaryWSHttpBinding HTTP/HTTPS Text/MTOMWSFederationHttpBinding HTTP/HTTPS Text/MTOMWSDualHttpBinding HTTP/HTTPS Text/MTOMNetMsmqBinding MSMQ BinaryMsmqIntegrationBinding MSMQ BinaryWebHttpBinding HTTP/HTTPS Text/Binary
  15. 15. Binding en Configuracion<system.serviceModel> <services> <service name="CalculatorService"> <endpoint address=“http://localhost/calculator" binding="basicHttpBinding" contractType="ICalculator" /> </service> </services></system.serviceModel>
  16. 16. Custom Bindings<bindings> <customBinding> <binding configurationName="Binding1"> <reliableSession bufferedMessagesQuota="32" inactivityTimeout="00:10:00" maxRetryCount="8" ordered="true" /> <httpsTransport manualAddressing="false" maxMessageSize="65536" hostNameComparisonMode="StrongWildcard"/> <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Default" writeEncoding="utf-8" /> </binding> </customBinding></bindings>
  17. 17. Behaviors
  18. 18. Behaviors Overview Implementan semántica del sistema  Para el desarrollador  Concurrencia  Instanciación  Transacciones  Impersonation  Para operaciones  Throttling  Metadata
  19. 19. Instanciación Per Call Singleton Session
  20. 20. Throttling<behaviors> <behavior configurationName="CalculatorBehavior" > <serviceThrottling maxConcurrentCalls="10" maxConnections="10" maxInstances="10" maxPendingOperations="10" /> </behavior></behaviors>
  21. 21. REST Acrónimo de REpresentational State Transfer Es un estilo de arquitectura  Mejor uso de HTTP  Menor complejidad  Interoperable
  22. 22. Principios de REST Identificar recursos por medio de URIs Uso de verbos HTTP Link resources Presentación en múltiples formatos (JSON/POX) Comunicación Stateless
  23. 23. Identifica recursos con URIshttp://myservice/roomshttp://myservice/rooms(3)http://myservice/Colors(red)http://myservice/Transactions(1145001)
  24. 24. Verbos HTTP usados Get: obtiene la representación de un recurso Put: actualiza un recurso Post: crea un nuevo recurso Delete: elimina un recurso
  25. 25. Link Resources<order self=’http://example.com/orders(1234)’> <amount>23</amount> <product ref=’http://example.com/products(4554)’ /> <customer ref=’http://example.com/customers(1234)’ /></order>
  26. 26. REST en WCF
  27. 27. REST en WCF Basado en nuevos atributos  WebGet (Get)  WebInvoke (Post/Put/Delete) Permite definir el tipo de Serializacion  JSON  XML Soporte de streaming retornando un Stream
  28. 28. Nuevo en WCF 4 Simplificación de configuración Activación en IIS (.svc opcional) Soporte de WS-Discovery (udp based) Soporte de Router  Bridging  Routing por contenido Mejoras para REST  Pagina de ayuda  Integración con rutas de MVC  Caching
  29. 29. Referencias A Guide to Designing and Building RESTful Web Services with WCF 3.5  http://msdn.microsoft.com/en-us/library/dd203052.aspx WCF REST Starter Kit  http://aspnet.codeplex.com/releases/view/24644 Windows Server AppFabric Training Kit  http://www.microsoft.com/download/en/details.aspx?id=7956 OData  http://www.odata.org/
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×