Middleware and Integrative architectures
Middleware
- is a software programming running at the top of operating system and below the
applications. It connects applications or software components.
- provides a standard high level interface to the application developers and integrators, so
that application can easily interoperate. Interoperability is the ability of two or more
components or systems to exchange information.
There are three types of middleware.
1. transaction-oriented
2. object-oriented
3. message oriented middleware.
Transaction-oriented middleware
- supports distributed computing involving database applications.
Message-oriented middleware
- supports reliable, asynchronous communications between distributed components or
applications.
Object-oriented middleware
- systems are based on object-oriented paradigm, and primarily support synchronous
communications between distributed objects or software components.
Examples are CORBA, DCOM and RMI. 1.6.2.
Integrative architectures
- are the standard methodologies for application integration. These architectures include,
CORBA, DCOM and RPC. The architectures act as a middleware, a software application
that mediates between different applications.
(Common Object Request Broker Architecture) CORBA is a software standard
that is defined and maintained by the Object Management Group (OMG). The Common
Object Request Broker Architecture (CORBA) is a standard architecture for a distributed
objects system. CORBA is designed to allow distributed objects to interoperate in a
heterogenous environment, where objects can be implemented in different
programming language and/or deployed on different platforms.
Distributed component object model- extends the COM to support communication
between objects.
o is a software architecture or remote protocol that defines a binary standard for
component interoperability.
o is a software architecture that allows applications to be built from binary
software components. Is binary interface standard for software components, that
allows inter-process communication. Binary interface is a program interface
between binary program modules often one of the module is library or operating
system and the other is user program module. Defines how computational
routines are called in machine code or low-level which is hardware independent.
RPC (Remote procedure calls)
This method develops each application which is required to be integrated as a largescale
object or component with encapsulated data. And it provides an interface to allow other
applications to interact with the running application. Remote Procedure Invocation applies
the principle of encapsulation to integrating applications. If an application needs some
information that is owned by another application, it asks that application directly. If one
application needs to modify the data of another, then it does so by making a call to the
other application. Each application can maintain the integrity of the data it owns.
Furthermore, each application can alter its internal data without having every other
application be affected.
Web Services & Middleware
Application integration technology
- Allows applications to be integrated more rapidly, easily and less expensively
program-to- program interactions whereas web for program-to-user interactions
- allow companies to reduce the cost of doing e-business, to deploy solutions faster and to open
up new opportunities
Web services model built on emerging standards such as:
HTTP
XML
Simple Object Access Protocol (SOAP)
Web Services Description Language (WSDL)
Universal Description, Discovery and Integration (UDDI)
developed in order to distribute an object and serve it to various users in the web environments
-
used in the server situations while solving the web-scalability problem of the other distributed
object technologies
WSDL, and SOAP exploit XML.
a. WSDL is an XML describing the web service.
b. SOAP is an XML describing the called method, its parameters, and its return value, can be
delivered over the HTTP
1. A client that wants to be serviced should first find the supported services from the pre-existing
registry before compiling a code.
2. After finding its services through searching, the client gains the Web Service Description
Language (WSDL) that a server previously registers. From theWSDL, the client knows the service
provider location and the parameters to the found method.
3. After the client binds the described service during the compile time, it calls the local agent
whenever the client invokes a method call, and the local agent delivers it to the server side agent
through Simple Object Access Protocol (SOAP) over HTTP, FTP, SMTP, andTCP during the runtime.
4. The server side agent activates the appropriate object, and delivers the calls to the object.
Network:
A network is a collection of computers and other devices that can send data to and
receive data from each other.
A network is often connected by wires.
However, wireless networks transmit data through infrared light and microwaves.
Node:
Each machine on a network is called a node.
Most nodes are computers, but printers, routers, bridges, gateways etc.. can also be
nodes.
Nodes that are fully functional computers are also called hosts.
Packet:
All modern computer networks are packet-switched networks: data traveling on the
network is broken into chunks called packets and each packet is handled separately.
Each packet contains information about who sent it and where it's going.
Protocol:
A protocol is a precise set of rules defining how computers communicate: the format of
addresses, how data is split into packets
IP:
IP was designed to allow multiple routes between any two points and to route packets of
data around damaged routers.
TCP:
Since there are multiple routes between two points, and the packets that make up a
particular data stream.
Furthermore, they may not arrive in the order they were sent, if they even arrive at all.
UDP:
UDP is an unreliable protocol that does not guarantee that packets will arrive at
their destination or that they will arrive in the same order they were sent.
Ports:
Each computer with an IP address has several thousand logical ports.
Each port is identified by a number between 1 and 65,535. Each port can be allocated
to a particular service.
Port numbers 1 through 255 are reserved by IP for well-known services. If you connect to
port 80 of a host, for instance, you may expect to find an HTTP server.
Internet:
largest IP-based network for connecting machines together.
Java: easy-to-use, cross-platform model for network communications.
What is a Socket?
Sockets are a means of using IP to communicate between machines, so sockets allow
Java to interoperate with legacy systems by simply talking to existing servers using their pre-
defined protocol.
Internet protocol: User Datagram Protocol (UDP) andTransmissionControl Protocol (TCP).
Internet Addresses or IP Addresses
Every network node has an address, a series of bytes that uniquely identify it.
Internet addresses are manipulated in Java by the use of the InetAddress class. InetAddress
takes care of the Domain Name System (DNS) look-up and reverse look-up;
IP addresses can be specified by either the host name or the raw IP address. InetAddress
provides methods to getByName(), getAllByName(), getLocalHost(), getAddress(), etc.
IP addresses are a 32-bit number, often represented as a "quad" of four 8-bit numbers
separated by periods.
They are organized into classes (A, B, C, D, and E). For example 126.255.255.255
Client/Server Computing- Java language communicate with remote file system
How UDPclients and UDPservers communicate over sockets
Creating UDP Servers:
To create a server with UDP, do the following:
1. Create a DatagramSocket attached to a port.
int port = 1234;
DatagramSocket socket = new DatagramSocket(port);
2. Allocate space to hold the incoming packet, and create an instance of DatagramPacket to hold the
incoming data.
byte[] buffer = new byte[1024];
DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
3. Block until a packet is received, then extract the information you need from the packet.
// Block on receive()
socket.receive(packet);
// Extract the packet data
byte[] data = packet.getData();
// Find out where packet came from
// so we can reply to the same host/port
InetAddress remoteHost = packet.getAddress();
int remotePort = packet.getPort();
Creating UDP CLients
1. First allocate space to hold the data we are sending and create an instance of DatagramPacket
to hold the data.
byte[] buffer = new byte[1024];
int port = 1234;
InetAddress host = InetAddress.getByName("magelang.com");
DatagramPacket packet = new DatagramPacket(buffer, buffer.length, host, port);
2. Create a DatagramSocket and send the packet using this socket.
DatagramSocket socket = new DatagramSocket();//free local port to use
socket.send(packet);
// Find out where we are sending from
InetAddress localHostname = socket.getLocalAddress();
int localPort = socket.getLocalPort();
HowTCPclients andTCPservers communicate over sockets
CreatingTCP Servers:
To create aTCP server, do the following:
1. Create a ServerSocket attached to a port number.
ServerSocket server = new ServerSocket(port);
2. Wait for connections from clients requesting connections to that port.
// Block on accept()
Socket channel = server.accept();
You'll get a Socket object as a result of the connection.
3. Get input and output streams associated with the socket.
out = new PrintWriter (channel.getOutputStream()); `
out.println("Hey! I heard you over this socket!");
reader = new InputStreamReader (channel.getInputStream());
in = new BufferedReader (reader);
Now you can read and write to the socket, thus, communicating with the client.
String data = in.readLine();
Creating TCP Clients:
To create TCP client, do the following:
1. Create a Socket object attached to a remote host, port.
Socket client = new Socket(host, port); When the constructor returns, you have a connection.
2. Get input and output streams associated with the socket.
out = new PrintWriter (client.getOutputStream());
out.println("Watson!" + "Come here...I need you!");
reader = new InputStreamReader (client.getInputStream());
in = new BufferedReader (reader);
Now you can read and write to the socket, thus, communicating with the server.
String data = in.readLine();
LOW LEVEL DATA COMMUNICATION
TCP/IP(Transmission Control Protocol/Internet Protocol)
The Protocol upon which the whole Internet is based
o Each node must be configured forTCP/IP to function properly.
A software-based protocol
TCP/IP is basically the binding together of Internet Protocols used to connect hosts on the
internet- Main ones are IP and TCP TCP and IP have special packet structure
IP (Internet Protocol) is responsible for delivering packets of data between systems on the
internet and specifies their format. Packets forwarded based on a four byte destination IP
address (IP number) IP DOES NOT MAKE GUARANTEES! It is very simple - essentially: send and
forget.
TCP (TransmissionControl Protocol) is responsible for verifying the correct delivery of
data/packets from client to server. Data can be lost
.SoTCP also adds support to detect errors and retransmit data until completely received
Version — Indicates the version of IP currently used.
IP Header Length (IHL) — Indicates the datagram header length in 32-bit words.
Type-of-Service — Specifies how an upper-layer protocol would like a current datagram to be
handled, and assigns datagram various levels of importance.
Total Length — Specifies the length, in bytes, of the entire IP packet, including the data and
header.
Identification — Contains an integer that identifies the current datagram. This field is used to
help piece together datagram fragments.
Flags — Consists of a 3-bit field of which the two low-order (least-significant) bits control
fragmentation. The low-order bit specifies whether the packet can be fragmented. The middle
bit specifies whether the packet is the last fragment in a series of fragmented packets.The
third or high-order bit is not used.
Fragment Offset — Indicates the position of the fragment’s data relative to the beginning of
the data in the original datagram, which allows the destination IP process to properly
reconstruct the original datagram.
Time-to-Live — Maintains a counter that gradually decrements down to zero, at which point
the datagram is discarded.
Protocol — Indicates which upper-layer protocol receives incoming packets after IP processing
is complete.
Header Checksum — Helps ensure IP header integrity. Source Address — Specifies the
sending node. Destination Address — Specifies the receiving node. Options — Allows IP to
support various options, such as security.
Data — Contains upper-layer sent in packet.
There are 11 fields inTCP Packet:
1. Source Port and Destination Port — Identifies points at which upper- layer source and
destination processes receiveTCP services.
2. Sequence Number In the connection-establishment phase, this field also can be used
to identify an initial sequence number to be used in an upcoming transmission.
3. Acknowledgment Number — Contains the sequence number of the next byte of data the
sender of the packet expects to receive.
4. Data Offset — Indicates the number of 32-bit words in theTCP header.
5. Reserved — Remains reserved for future use.
6. Flags — Carries a variety of control information, including the SYN and ACK bits used for
connection establishment, and the FIN bit used for connection termination.
7. Window — Specifies the size of the sender’s receive window (that is, the buffer space
available for incoming data).
8. Checksum — Indicates whether the header was damaged in transit.
9. Urgent Pointer — Points to the first urgent data byte in the packet.
10. Options — Specifies variousTCP options.
11. Data — Contains upper-layer sent in packet.