5.4 Marshalling in Distributed System
5.4 Marshalling in Distributed System
Distributed System
External Data Representation
• Any data type that can be supplied as a parameter or returned, as a
result, must be able to be converted and the individual primitive data
values expressed in an accepted format to support Remote Procedure
Call (RPC) or Remote Method Invocation (RMI) mechanisms.
• Marshalling: Marshalling is the process of transferring and formatting
a collection of data structures into an external data representation
type appropriate for transmission in a message.
• Unmarshalling: The converse of this process is unmarshalling, which
involves reformatting the transferred data upon arrival to recreate the
original data structures at the destination.
Approaches 1. Common Object Request
Broker Architecture (CORBA):
• CORBA is a specification defined by the Object Management Group
(OMG) that is currently the most widely used middleware in most
distributed systems.
• It allows systems with diverse architectures, operating systems,
programming languages, and computer hardware to work together.
• It allows software applications and their objects to communicate with
one another.
• It is a standard for creating and using distributed objects. It is made up
of five major components.
Components of CORBA
• Components:
• Object Request Broker (ORB): It provides a communication infrastructure for the objects to
communicate across a network.
• Interface Definition Language (IDL): It is a specification language used to provide an interface
in a software component. To exemplify, it allows communication between software
components written in C++ and Java.
• Dynamic Invocation Interface (DII): Using DII, client applications are permitted to use server
objects without even knowing their types at compile time. Here client obtains an instance of a
CORBA object and then invocation requests can be made dynamically on the corresponding
object.
• Interface Repository (IR): As the name implies, interfaces can be added to the interface
repository. The purpose of IR is that a client should be able to find an object which is not known
at compile-time and information about its interface then request is made to be sent to ORB.
• Object Adapter (OA): It is used to access ORB services like object reference generation.
Components of CORBA
Data Representation in CORBA
• Common Data Representation (CDR) is used to describe structured or
primitive data types that are supplied as arguments or results during
remote invocations on CORBA distributed objects.
• It allows clients and servers’ built-in computer languages to
communicate with one another. To exemplify, it converts little-endian
to big-endian.
• There are 15 primitive types: short (16-bit), long (32-bit), unsigned
short, unsigned long, float (32-bit), double (64-bit), char, boolean
(TRUE, FALSE), octet (8-bit), and any (which can represent any basic or
constructed type), as well as a variety of composite types.
CORBA CDR Constructed Types:
• sequence:
• string
• array
• struct
• enumerated
• union
Example:
struct Person {
string name;
string place;
long year;
};
Marshalling CORBA
•Marshalling CORBA operations can be produced
automatically.
•CORBA IDL describes the types of data structures and
fundamental data items and provides language/notation
for specifying the types of arguments and results of RMI
methods.
2. Java’s Object Serialization
• Java (RMI) allows you to pass both objects and primitive data values as
arguments and method calls.
• In Java, the term serialization refers to the activity of putting an object
(an instance of a class) or a set of related objects into a serial format
suitable for saving to disk or sending in a message.
• Object serialization. It allows an object to be represented as a sequence
of bytes containing information about the object’s data and the type of
object and the type of data stored in the object.
• After the serialized object is written to the file, it can be read from the
file and deserialized. You can recreate an object in memory with type
information and bytes that represent the object and its data.
Example
• Objects can be serialized on one platform and deserialized on
completely different platforms as the whole process is JVM
independent.
• For example, the Java class equivalent to the Person struct defined in
CORBA IDL might be
import java.io.*;
public class Person implements Serializable {
public String name;
public String place;
public int phonenumber;
public void letter() {
3. Extensible Markup Language
(XML)
• Clients communicate with web services using XML, which is
also used to define the interfaces and other aspects of web
services.
• However, XML is utilized in a variety of different applications,
including archiving and retrieval systems; while an XML
archive is larger than a binary archive, it has the advantage of
being readable on any machine.
• Other XML applications include the design of user interfaces
and the encoding of operating system configuration files.
Example
• In contrast to HTML, which employs a fixed set of tags, XML is extensible in the
sense that users can construct their tags.
• Clients, for example, typically interface with web servers via SOAP messages.
SOAP is an XML standard with tags that web services and their customers can
utilize.
• XML definition of the Person struct:
<person id="9865">
<name>John</name>
<place>England</place>
<year>1876</year>
<!-- comment -->
</person>