Web trafficofdatadue to HTTPclientcommunicatingwithHTTP
server
Toaccessresources remotely we need
I Padress part protocol resource ID RID
URLformat protocol I IPadres part RID
HTTP Differencebetween HTTP Http
HTTPS combines HTTPand
SS t I securesocketlayer Sst
for securecommunication
OS HTTP SSL HTTPS
Integration Service OrientedModeland Programming
Problems
A client servermodel allows different processes to communicate
remotely However developing a client serverappis tedious
It requires Designing a specificprotocol or adoptingandadapting
to an existing one
Managingconnectionsand streams on bothsides
Implementing a protocolandhandlingerrors
Objective Wewant the
luxury to invokeremoteservices as if
theywere local Thisparadigmhides all theprogramminghastes
and details
Change the perspective fromseeingconnection of
as exchanges
messages to invokingfunctionsremotely
We cave
taking communication into a higherlevel of
abstraction
Having a new layer ontop ofthe Client ServerModel
Hiding the gap between CSS
o Id's not revolution Just build ontopof CISModel
Increase developer productivity nonfunctional
Promote softwareintegrationfar
richerfunctionality higher performance
t
Intimate
d
functionality
Integratingremotefunctioned
Not having bothdataandago Youhave Tabatalgo but
not enough computingpower
perform it elsewhere
Movingfrom a specific protocolwhere functions are
pomade to a more generic protocol wherefountains are
variables EXEC [Link]
A list of functionprototypes that the sower shouldhandle
Service API contactbetweenserviceproviderand consumer
It is the set of functions providedby the provider
API is headerfile or Interface
public interfacecalculator
add floats floating
floatsubtract
float
MFFintetfaa floats
are
floating
andabstract default
nterfa h
Thefalseimplementation acts as a bridge betweenactual
business implementationelsewhere and your code
We needto makethedistinctionbetween RPC beingthe
concept ofinvokingremote functions as iftheywere local and
thetechnologyproviding a genericprotocol to supportRPC
Thesetechnologies handlecommunication details andgenerate
[Link]
RPCluseuryameswithacostiffinstemplemenbation
Both should be in the sameprogramminglanguage
problem with serialization
So we move totheneedof designing a serializationmethod
that is language independent XML is a language thatsits
at equal distancefrom all programminglanguages acting
like a bridge between all languages
There is a special tool atthe levelofthetechnology provider
whichbridgesthegap between the API andthe stubimplementation
for example teep module in python
TAX WS
Taxonomyoftechnologies
GO
Java Python
RPC is language dependantbydefault
becausethe serialization is based on thelanguageused
Languageagnostic technologies
Mostfamous CORBA commonobjectRequestBrokerArchitecture
it uses an underlying protocol II OP
CORBACreated IDL which is a naturalway to define
services
Aslong as client serverfollow thesameprotocol no
matterthe languagethey'rewritten in theycancommunicate
CORBA uses IDL Kempiler idldjaver to generatestub skeleton
usingIDLcompiler written in IPL using
taps IDL camping
IPL 2 Java FDL python
d Favaskeleton
Tvastab pythnstab pythonshel
botharegeneratedforflexibility
XML SOAP
XML extensiblemarkuplanguage
XML SOAP Thistechnology allowsdifferent languages to
communicate using xox to serializethedata
It follows the HTTPprotocol since it wasthereandis capable
hence it's a webservice
of handlingerrors
HTTP has a firewallwhich would only let requests with
the specifiedport
SOAP only uses Post but only its syntax not its
semantics
Now we haveWSDL as the API specificationlanguage
It specifies what theAPI whattheconsumerinvokes
Where URL
If we publishthatWSDL thatWSDLis all whatisneed
toggfMYesitfaeservice API
XML Definesdataformat serialization
Definesformatofmessagesexchangedbetter cos
polyglot
ftp
Saket API
HTTP header
I
sq functionname fakeimpl I stub
I marshalledparams
I HTTPheader
marshaledresults
In XML SOAP the bodyis followingsoap protocol but
is XML based
HTTP needs to beenhanced with more semantics
fromanother protocol henceSOAP
POSTallows sendingsomething in the body
SOAP uses XML structure
for
Casestudy Calculator Ks
In the business impl class
isused to supporttheXMLIsoAP
makesclass remotelyinrobable technology
Providercode
publishingcalculator
object
undertheURL
This will maketheclientside onlyneedtheWSDL
this URL is used to reach that service
file
methodinvocation
REISfeelwebsories
Rest is not a technology does not specifyprotocol API
it is an architectural style set
ofconstraints rules
it is for data driven apps
Nonfunctional requirements ofREST
Performance measuredby response time and numberof
transactions processedpersecond
Scalability preserve performance even whenloadincreases
Simplicity RESTis simple
Rodifiability Allowingthe modificationofresource
Portability
Reliability
Functional requirements
Client server Architecture
stateleness eachclient request a clientto a
from
server must contain all the informationneeded to
understand andprocessthe request withoutrelying
on
any stored content on the server
Cachability usingcaching so that futurerequestsfor
the same resource can be served morequickly
Self descriptivemessages each message response
request should contain all the necessaryinformation
fortherecipienttounderstandanprocessit
HATEOS constraintof RESTarchitecture thatallows
to access resources as dynamiclinks embedded
in the response
Operations are known GET POST PATCH POT DELETE
tD Name
ofcollections isn't enough
to thealttebutes
youneed know
POST X V Ofthedaba
PATCH V x under whichfarmatstrouldit
PUT V X be JSON xM4 leavesitopen
DELETE V X
To resolvetheseissues the servicedevelapper should
provide some documentation
OpenAII
OpenAPI is an API specification language written in
JSON
API is generatedusing thedependency to build gradle
whichwould help us generatetheopenAPIdefinition
This car calculator OpenAPI definition
Then we use swaggertoal that takesOpenAPI definition
and generatesthe client Spk whichcontainsthe stub
barourcasestudes it's
the OpenAPI definition
client
Open API is the link between the stub from
the SDK generated by the Swagger tool and the
Open API definition generated from the business
Implementation using spring doc openape
RestController spring annotation marks the business
implementation as a web service