Slide 1

Slide 1 text

Tecnologías para Servicios y servicios Web: SOA, REST, GraphQL.

Slide 2

Slide 2 text

#Hola Noé Domínguez-Porras (@noe_dgz)

Slide 3

Slide 3 text

Agenda ● La arquitectura de la Web ● SOA ● Service ● Web Service ● Tecnologías SOA: SOAP, WSDL, UDDI ● REST ● GraphQL

Slide 4

Slide 4 text

La arquitectura de la Web Sí, tiene una arquitectura oficial

Slide 5

Slide 5 text

1. The World Wide Web (WWW, or simply Web) is an information space in which the items of interest, referred to as resources, are identified by global identifiers called Uniform Resource Identifiers (URI). Architectural Bases a. Identification. URIs are used to identify resources. b. Interaction. Web agents communicate using standardized protocols that enable interaction through the exchange of messages which adhere to a defined syntax and semantics. c. Formats. Most protocols used for representation retrieval and/or submission make use of a sequence of one or more messages, which taken together contain a payload of representation data and metadata, to transfer the representation between agents. La web y su arquitectura

Slide 6

Slide 6 text

SOA La arquitectura oficial de la Web

Slide 7

Slide 7 text

Estilo arquitectónico de SOA

Slide 8

Slide 8 text

• Analysis Paralysis – Enterprise architectural efforts do not get off the ground – Results in an inflexible architecture • Over-Standardization – Can’t satisfy different needs of different parts of an organization – Results in a stovepipe development • Rigidity in Data Definition – Requires to support specific data definitions Motivaciones para SOA

Slide 9

Slide 9 text

service-oriented architecture [w3c] A set of components which can be invoked, and whose interface descriptions can be published and discovered. “A service is an abstract resource that represents a capability of performing tasks that form a coherent functionality from the point of view of providers entities and requesters entities.” service-oriented architecture [Wikipedia] “A software design and software architecture design pattern based on structured collections of discrete software modules, known as services“ Software Oriented Architecture

Slide 10

Slide 10 text

Estilo arquitectónico de SOA

Slide 11

Slide 11 text

An interaction model between three primary parties – Service provider – publishes a service description and provides the implementation for the service – Service consumer – either use the uniform resource identifier (URI) for the service description directly or can find the service description in a service registry and bind and invoke the service. – Service broker – provides and maintains the service registry (optional). Estilo arquitectónico de SOA

Slide 12

Slide 12 text

Service definición

Slide 13

Slide 13 text

Services are self-contained functions that provide access to certain resources and capabilities, and can be composed with other services to form different services “A service is an abstract resource that represents a capability of performing tasks that form a coherent functionality from the point of view of providers entities and requesters entities.” [W3C] ¿Qué es un servicio?

Slide 14

Slide 14 text

Web Service definición

Slide 15

Slide 15 text

[W3C] There are many things that might be called "Web services" in the world at large. However, for the purpose of this Working Group and this architecture, and without prejudice toward other definitions, we will use the following definition: A Web service is a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP-messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards. Web Services

Slide 16

Slide 16 text

Tecnologías SOA SOAP Use a protocol independent from HTTP

Slide 17

Slide 17 text

Tecnologías SOA: SOAP. SOAP follows the RPC model

Slide 18

Slide 18 text

Tecnologías SOA: SOAP.

Slide 19

Slide 19 text

Tecnologías SOA WSDL Create a description of your services and its types described in XML.

Slide 20

Slide 20 text

WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information. http://ws.redpack.com.mx/RedpackAPI_WS/services/RedpackWS?wsdl Tecnologías SOA: WSDL.

Slide 21

Slide 21 text

Tecnologías SOA: WSDL.

Slide 22

Slide 22 text

Tecnologías SOA: WSDL.

Slide 23

Slide 23 text

Tecnologías SOA: WSDL. WSDL code generation

Slide 24

Slide 24 text

Tecnologías SOA UDDI Create a directory of your services

Slide 25

Slide 25 text

Tecnologías SOA: UDDI.

Slide 26

Slide 26 text

Tecnologías SOA: UDDI.

Slide 27

Slide 27 text

Tecnologías SOA: UDDI.

Slide 28

Slide 28 text

REST Porque hacer SOA es muy complejo

Slide 29

Slide 29 text

“Representational State Transfer (REST) architectural style for distributed hypermedia systems, describing the software engineering principles guiding REST and the interaction constraints chosen to retain those principles.”[1] Hypermedia, an extension of the term hypertext, is a nonlinear medium of information that includes graphics, audio, video, plain text and hyperlinks. Simplemente usa HTTP y mapea los métodos de HTTP a estados. REST Fielding, R. T., & Taylor, R. N. (2000). Architectural styles and the design of network-based software architectures. Doctoral dissertation: University of California, Irvine.

Slide 30

Slide 30 text

Client-Server: Separation of concerns is the principle behind the client-server constraints. Stateless Session: state is therefore kept entirely on the client. Cache constraints to form the client-cache-stateless-server style. Uniform Interface (central feature). The REST interface is designed to be efficient for large-grain hypermedia data transfer, optimizing for the common case of the Web, but not optimal for other forms of architectural interaction. Layered System style allows an architecture to be composed of hierarchical layers by constraining component behavior such that each component cannot "see" beyond the immediate layer with which they are interacting Code-on-demand REST allows client functionality to be extended by downloading and executing code in the form of applets or scripts. This simplifies clients by reducing the number of features required to be pre-implemented. REST architecture derivation Fielding, R. T., & Taylor, R. N. (2000). Architectural styles and the design of network-based software architectures. Doctoral dissertation: University of California, Irvine.

Slide 31

Slide 31 text

Swagger.io Para hacer más fácil la creación de servicios REST

Slide 32

Slide 32 text

REST: Swagger.io https://swagger.io/

Slide 33

Slide 33 text

https://swagger.io/ REST: Swagger.io

Slide 34

Slide 34 text

REST: Swagger.io https://swagger.io/

Slide 35

Slide 35 text

Proyecto: https://github.com/swagger-api/swagger-codegen Generadores de código: Swagger.io ●API clients: ActionScript, Ada, Apex, Bash, C# (.net 2.0, 4.0 or later), C++ (cpprest, Qt5, Tizen), Clojure, Dart, Elixir, Eiffel, Erlang, Go, Groovy, Haskell (http-client, Servant), Java (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java), Kotlin, Lua, Node.js (ES5, ES6, AngularJS with Google Closure Compiler annotations) Objective-C, Perl, PHP, PowerShell, Python, R, Ruby, Rust, Scala (akka, http4s, swagger-async-httpclient), Swift (2.x, 3.x, 4.x), Typescript (Angular1.x, Angular2.x, Fetch, jQuery, Node) ●Server stubs: C# (ASP.NET Core, NancyFx), C++ (Pistache, Restbed), Erlang, Go, Haskell (Servant), Java(MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy, Play Framework), PHP (Lumen, Slim, Silex, Symfony, Zend Expressive), Python (Flask), NodeJS, Ruby (Sinatra, Rails5), Rust, Scala (Finch, Lagom, Scalatra)

Slide 36

Slide 36 text

GraphQL Un lenguaje de consulta de información

Slide 37

Slide 37 text

Design Consideration 1. Data-fetching API powerful enough to describe all of Facebook 2. yet simple enough to be easy to learn and use by our product developers. GraphQL is a query language designed to build client applications by providing an intuitive and flexible syntax and system for describing their data requirements and interactions. GraphQL is a query language

Slide 38

Slide 38 text

GraphQL is a query language

Slide 39

Slide 39 text

GraphQL

Slide 40

Slide 40 text

GraphQL

Slide 41

Slide 41 text

GraphQL: ventajas Ventajas ● Simplifica la lógica: no hay que consultar varios endpoints para obtener la información que necesitas. ● Toda tu información en el mismo lugar. ● No tienes que lidiar con versiones de una API. ● Puedes confiar en los tipos de dato (GraphQL describe tipos). Desventajas ● No hay cache Antipatrón ● Tener múltiples instancias de GraphQL.

Slide 42

Slide 42 text

Conclusiones ● Todo en la vida tiene un trade-off. ● Si necesitas una interfaz simple para clientes variados es preferible privilegiar los datos y GraphQL es un lenguaje para eso. ● El hypermedia se sirve muy bien por REST (Objetos con su estado). ● La generación de código de SOA era buena, pero repetitiva en los clientes. Para eso existe WSDL o Swagger que generan los clientes en automático. ● Una nueva generación de Computo de servicios está renovando SOA. ○ Microservicios (ver http://www.opengroup.org/). ○ En desarrollo continuo => Google Scholar keyword: “Microservices” ● Casi todo en el Internet es un servicio, este modelo de cómputo privilegia el acceso fácil a usuarios finales. También composición e integración de sistemas. Ahí reside la vigencia de SOA.

Slide 43

Slide 43 text

Conclusiones Think about it: Desarrollar SOA != Desarrollar con Java

Slide 44

Slide 44 text

www.codersmexico.com www.scala.org.mx/scala_school Donde trabajo: webeng.kaist.ac.kr

Slide 45

Slide 45 text

@noe_dgz noedominguez.com