This session focuses on the evaluation of communication between applications, it talks about RPC, RMI, WebServices, XML-RPC, REST and newer technologies like GraphQL & MQTT.
2. Background
Initially application were standalone and were not communicating with each other
During DOS era OS services were basically interrupts, language runtime provide wrapper over
them to make life of programmer easy.
Later on OS services started were exposed as system calls or win32 API calls.
With multitasking operating systems applications were required to communicate to each other
Inter-process communication was there but that can only be used if both applications resides on
same machine
In order to decouple logic and increase reusability and distribution some communication
mechanism was required
3. Client-Server Architecture
Initially Implemented by means of Sockets
Server socket read commands and execute them in a gigantic switch case
A lot of boilerplate had to written in order to make this work.
Was very difficult to manage on both server side and client side.
Serialization of objects was an issue, usually delimited data was transferred(comma separated,
pipe separated).
Serialization also had to be handled by the developer himself
Bad handling usually mixing delimiter with actual data.
4. NUXI problem
Machine A is using Big Endian
It tries to send “UNIX” to Machine B
Machine B is using Little Endian
Machine B read data and saves it as NUXI
Here endian means the way data is stored in a word
5. RPC(Remote Procedure Call)
RPC was a protocol initially designed for DCE(Distributed Computing Environment)
RPC is synchronous operation, requires caller to be suspended until execution is done and result
is returned
An IDL(Interface Definition Language) is published as part of contract for RPC
Stub were generated from IDL, it acts as the representative of remote procedure in client code.
When this method is called it is received by stub
Stub handles conversion of objects into wire format and vice versa(marshalling & unmarshalling)
and forwarded call the second party
6. RPC(Remote Procedure Call)
Client must know the address of machine hosting remote procedure.
Similarly server has a stub(server stub) that receives the call
Server Stub convert data received from wire to objects and forward it to the actual method.
You can’t send pointers to an RPC since both process resides in different address space.
RPC was very much language and technology dependent.
RPC become foundation for may other technologies including COM/OLE, DCOM, CORBA, RMI
8. Problems with RPC
Very much language dependent
Binary formats with no backward compatibility, fixed formats
Not very flexible
Almost no security
Generally not used for public communication
9. XML-RPC
XML-RPC started in 1990’s and marked the birth of web services
Lightweight version of RPC with a couple of new supported types
Language neutral & uses the reliability of HTTP
Payload is text(XML), easy to debug and inspect
Simple and straight forward in terms of implementation and design
11. SOAP(Simple Access Object Protocol)
Based on XML, where message is not method call, instead it is an envelop with headers, body,
faults
Contract first approach, where contract is WSDL
WSDL(Web Service Description Language) instead of IDL
Provides a flexible way to generate client side & server side stubs
WSDL also generates classes for messages, reducing boilerplate
Extensible in terms of adding more features on top of SOAP
WS-Addressing
WS-Security
WS-Profile
12. SOAP
Transport neutrality allows SOAP to operate under any protocol including HTTP, JMS, SMTP, UDP
and TCP
Webservice Registry
UDDI(Universal Description, Discovery, and Integration)
13. ReST(Representational State Transfer)
ReST was mainly used to leverage HTTP, where HTTP method describes the intention of call
PUT -> Create
GET -> Retrieve
POST -> Update
DELETE -> Delete
URL’s specifies resource to access for example
DELETE /employee/123
POST /employee/123
PUT /employee
GET /employee/123
14. ReST(Representational State Transfer)
ReST didn’t specified underlying payload format
XML/JSON/YAML everything is fine
Doesn’t talk much about security
Code first approach
WADL was there but is not adapted widely yet
15. GraphQL
GraphQL is ReST done right
It is a query language for API’s
It is mainly using JSON
Allows you to fetch only information you need, or read multiple entities at the same time in one
single call
Allows notification on updates of resources called mutation
17. gRPC
gRPC is Google’s RPC
This is another way to improve RPC
Mainly uses protobuff as communication format
Very lightweight
Allows streaming output
Allows stub generation and channel selection
19. XMPP
Open standard for messaging and presense
Open & living standard
XMPP Core defines near real-time exchange of structured yet extensile data between two or
more network entities
XEP’s defines extensions to the XMPP Core, like
XEP-0001 XMPP Extension Protocols
XEP-0009 Jabber-RPC
XEP-0072 SOAP Over XMPP
XEP-0080 User Location
XEP-0174 Serverless Messaging
20. MQTT(MQ Telemetry Transport)
Machine to Machine IoT connectivity protocol
Lightweight publisher/subscriber messaging transport
Designed for constrained devices and low-bandwidth, high-latency or unreliable networks
Utilize JSON as payload
Pushy is using MQTT for push notifications on android
MQTT is used Facebook messenger