understanding web services

28
! " # $ % & $./run { Created by Fabrício Epaminondas ©2015-2020 Web SERVICES Understanding

Upload: fabricio-epaminondas

Post on 16-Apr-2017

98 views

Category:

Technology


3 download

TRANSCRIPT

!

"

#

$

%&

$./run

{

'

Created by Fabrício Epaminondas ©2015-2020

Web SERVICES

Understanding

INTRODUCTION

The Insight

Impact of internet growing 3

The rising of Service-Oriented-Architecture (SOA)

• Reusability• Integration • Interoperability

Initial approach 4

Application

Client RPC

RPC library

Transport

Application

Server RPC

RPC library

Transport

RPC = Remote Procedure Call

History 5

• RPC (Remote Procedure Call) solutions•RMI

•Remote Method Invocation •CORBA

•Common Object Request Broker Architecture•And others

•Sun RPC, DCOM…

CORBA in a nutshell 6

IDL = Interface Definition Language

CORBA in a nutshell 7

CORBA: Java Client Sample 8

WHAT IS A WEB SERVICE?

The Concepts

“A Web Service is a piece of business logic, located somewhere on the internet, that is accessible through standard-based Internet protocols, such as HTTP or SMTP. Using a web service could be as simple as logging into a site or as complex as facilitating a multi-organization business negotiation.”

(David Chappel, Java Web Services).

10

Characteristics 11

•XML-based •Loosely coupled •Coarse-grained •Ability to be synchronous or asynchronous •Supports Remote Procedure Calls (RPCs)

Major Web Services Technologies 12

•Simple Object Access Protocol (SOAP)

Soap Envelope

Header

Body

SOP Envelope

Major Web Services Technologies 13

•Web Service Description Language (WSDL)

Major Web Services Technologies 14

•Universal Description, Discovery, and Integration (UDDI)

Major Web Services Technologies 15

Web Services and SOA Architecture 16

Registry

(

Service Provider

"

Service Consumer

"

1. Pu

blish

WSD

L

2. Query services3. Response WSDL

4. XML service request

5. XML service response

CREATING A WEB SERVICE

SOAPThe Practice

Practice: Web Service SOAP 18

• Sample Project using only Java 8 • Testing using SOAP UI

RESTful WEB Services Basics

The Principles

The Principles 20

• Uniform Interface using using Uniform Resource Identifiers (URIs)

• Client-Server • Stateless •Cacheable •Layered System

When Use REST over SOAP 21

• REST is not protocol, rather a way of doing Web calls over HTTP using XML or JSON

• Easy to use as it's a simple HTTP protocol with JSON or XML

•Great for using with Javascript, AJAX, and jQuery.

•Usually REST offers rapid operating speed without the need of extensive processing.

• No standard authentication protocol. • No standard data definition language.

Sample Architecture 22

O 'REST Client

REST Service

Data Server

) Internet

REST Basics 23

• Main HTTP Verbs •GET •POST •PUT •DELETE

REST Basics 24

• Define your API url

mysite.com/myapp/v1

REST Basics 25

• Design your Web Services operations combining resources and verbs

Operations Definition

List Tickets GET /myapp/tickets

Get Single Ticket GET /myapp/tickets/<id>

Create Ticket POST /myapp/tickets

Update Existing Ticket PUT /myapp/tickets/<id>

Delete Existing Ticket DELETE /myapp/tickets/<id>

CREATING A RESTful WEB

ServiceThe Practice

Practice: RESTful WEB Service 27

• Sample Project using Spring Boot •Testing using Postman

github.com/fabricioepa/lab-springboot-rest-sample

!

"

#

$

%&

$./run

{

Created by Fabrício Epaminondas ©2015-2020

FABRICIO EPAMINONDAS + linkedin.com/in/fabricioepa

, fabricioepa.wordpress.com

- fabricioepa

. @fabricioepa

'Contact