Your SlideShare is downloading. ×
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
WCF 4 Overview
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

WCF 4 Overview

1,476

Published on

Overview of WCF 4 main features

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,476
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
79
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Mariano O. Rodriguez
  • 2. Agenda Introducción Contratos Binding Behaviors REST Nuevo en WCF4
  • 3. ABC de WCF Address (Donde) Binding (Como) Contract (Que)
  • 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. Contratos
  • 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. Service Contract[ServiceContract]public interface ICalculator{ [OperationContract] ComplexProblem Do(ComplexProblem p);}
  • 8. Service Contract: OneWay[ServiceContract]public interface IOneWayCalculator{ [OperationContract(IsOneWay=true)] void Do(ComplexProblem p);}
  • 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. 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. Data Contract[DataContract]public class ComplexNumber{ [DataMember] public double Real; [DataMember] public double Imaginary { get; set; }}
  • 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. Bindings
  • 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. Binding en Configuracion<system.serviceModel> <services> <service name="CalculatorService"> <endpoint address=“http://localhost/calculator" binding="basicHttpBinding" contractType="ICalculator" /> </service> </services></system.serviceModel>
  • 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. Behaviors
  • 18. Behaviors Overview Implementan semántica del sistema  Para el desarrollador  Concurrencia  Instanciación  Transacciones  Impersonation  Para operaciones  Throttling  Metadata
  • 19. Instanciación Per Call Singleton Session
  • 20. Throttling<behaviors> <behavior configurationName="CalculatorBehavior" > <serviceThrottling maxConcurrentCalls="10" maxConnections="10" maxInstances="10" maxPendingOperations="10" /> </behavior></behaviors>
  • 21. REST Acrónimo de REpresentational State Transfer Es un estilo de arquitectura  Mejor uso de HTTP  Menor complejidad  Interoperable
  • 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. Identifica recursos con URIshttp://myservice/roomshttp://myservice/rooms(3)http://myservice/Colors(red)http://myservice/Transactions(1145001)
  • 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. 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. REST en WCF
  • 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. 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. 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/

×