Friday, March 22, 2019

Tute_06

Compare and contrast Message oriented communication with resource oriented communication



Message oriented communication 

Message-oriented communication is a way of communicating between processes. Messages, which correspond to events, are the basic units of data delivered. Tanenbaum and Steen classified message-oriented communication according to two factors---
  synchronous/asynchronous communication 
  transient or persistent communication. 

 resource oriented communication

A resource-oriented architecture (ROA) is the structural design supporting the inter-networking of resources. A resource, in this context, is any entity that can be identified and assigned a uniform resource identifier 

 Discuss the resource based nature of the REST style

    Representational State Transfer (REST) is an architectural
    style for the service of web . 
    The REST is used as a basis for HTTP 1.1 development

    REST is 
    •Resource-based 
    •Focuses on Representations 



Explain the meaning of “representations” in REST style 

•How resources get manipulated and presented 
•Part of the resource state is transferred between client and server 
•Typically JSON or XML 
•Or even can be a web page, file, image, etc…
•E.g. The state of a student (as per the database) can be represented by a resource of webpage, XML dataset, etc…



Discuss the constraints of REST, indicating their use in the domain of web

1)Client-server

•The REST is for explicitly for networked distributed systems, which are based on the client-server style


2) Layered System 

•A client doesn’t need to know whether it is connected directly to the end server, or to an intermediary along the way. 
•Intermediary servers may improve system scalability by enabling load-balancing and by providing shared caches. •Layers may also enforce security policies.

3) Stateless

•One client can send multiple requests to the server 
•each request is independent 
•every request must contain all the necessary information so that the server can understand it and process it accordingly. •the server must not hold any information about the client state. 
•Any state information must stay on client –such as sessions.


4) Cacheable


•As many clients access the same server, often they may request the same resources 

•it is necessary that these responses might be cached, avoiding unnecessary processing, which may affect performance



5) Code-On-Demand (Optional) 
•This allows the customer to run some code on demand, that is, extend part of server logic to the client, either through an applet or scripts.

6) Uniform Interface 
•defines the interface between clients and servers. 
•It simplifies and decouples the architecture, which enables each part to evolve independently
➤Identification of resources 
•Based on the web’s Request-Response model

•Request = URL + HTTP Verbs (GET,POST,PUT,DELETE) 
•Response = HTML, XML, JSON, TXT, etc…


Identify contemporary examples of different types of implementations for the
elements of REST style

Components

•Software that interacts with one another 
•Communicate by transferring representations of resources through a standard interface rather than operating directly upon there source itself 
•Used to access, provide access to, or mediate access to resource


Connector 

•represent activities involved in accessing resources and transferring representations. 
•REST encapsulates different activities of accessing and transferring representations into different connector types •connectors are abstract interfaces for component communication, enhancing simplicity by hiding the underlying implementation of resources and communication mechanisms



Data 
•key aspect of REST is the state of the data elements, its components communicate by transferring representations of the current or desired state of data elements



Explain how to define the API of RESTful web services using RESTful URLs 


Request = URL + HTTP Verbs (GET,POST,PUT,DELETE)



•URL is the key technique in RESTful communication 

•The API of the RESTful service is a set of URLs 

•The resource is determined by the URL segments 

•The CRUD operations are determined by the HTTP verb

Discuss the pros and cons of using MVC for RESTful web service development, indicating the application of MVC in RESTful web service design



MVC is pretty straightforward. There is a Model, a Controller and a View. When we create a website, it all come together as 'client sends REST keyword request to server -> the server matches the requested URL to the controller action . which then calls the model(s) for data gathering/processing, gets the result . and returns the result back to the client as a HTML page (view)'.
Discuss the JAX-RS API and its implementations 

JAX-RS is an API 

•There are two implementations
1. Jersey
2. RESTeasy


Identify the annotations in JAX-RS, explaining their use 

@PathThe

@Pathannotation’s value is a relative URI path indicating where the Java class will be hosted: for example,/helloworld. You can also embed variables in the URIs to make a URI path template. 

@GET

The@GET annotation is a request method designator and corresponds to the similarly named HTTP method. The Java method annotated with this request method designator will process HTTP GET requests. The behavior of a resource is determined by the HTTP method to which the resource is responding.

@POST

The@POST annotation is a request method designator and corresponds to the similarly named HTTP method. The Java method annotated with this request method designator will process HTTP POST requests. The behavior of a resource is determined by the HTTP method to which the resource is responding. 

@PUT

The@PUT annotation is a request method designator and corresponds to the similarly named HTTP method. The Java method annotated with this request method designator will process HTTP PUT requests. The behavior of a resource is determined by the HTTP method to which the resource is responding. 

@DELETE

The@DELETE annotation is a request method designator and corresponds to the similarly named HTTP method. The Java method annotated with this request method designator will process HTTP DELETE requests. The behavior of a resource is determined by the HTTP method to which the resource is responding.







Friday, March 15, 2019

Tute_05

Compare and contrast web applications with web services

The main difference between a web service and a web application is, that a web application is typically intended for human-to-computer interaction, whereas web services are typically intended for computer-to-computer interaction.




➧Web services are server-side application components, which provides a set of services

•The services of the web service are exposed via an API 
•Loosely coupled architecture, and interacts with client-side components via the API 
•Multiple types of clients can communicate with the web-service via the API

Discuss what WSDL is and the use of it in the context of web services 



WSDL is an XML vocabulary for describing Web services allowing developers to describe Web Services and their capabilities, in a standard manner.

•standard format to describe a Web Service

•The document written in WSDL is also simple called WSDL (or WSDL document) 

•WSDL is a contract between the XML(SOAP) Web service and the client who wishes to use this service

•The service provides the WSDL document and the Web service client uses the WSDL document to create the stub (or to dynamically decode messages)




Usage of WSDL

WSDL is often used in combination with SOAP and XML Schema to provide web services over the Internet. A client program connecting to a web service can read the WSDL to determine what functions are available on the server. Any special datatypes used are embedded in the WSDL file in the form of XML Schema.


Explain the fundamental properties of a WSDL document 

specifies three fundamental properties: 


➺What a service does -operations (methods) provided by the service 
➺How a service is accessed -data format and protocol details 
➺Where a service is located -Address (URL) details 



Use of WSDL document in web services and client development

➥WSDL is often used in combination with SOAP and an XML Schema to provide Web services over the Internet. A client program connecting to a Web service can read the WSDL file to determine what operations are available on the server. Any special datatypes used are embedded in the WSDL file in the form of XML Schema.




Discuss the structure of the WSDL document

WSDL Document Elements. A WSDL document has a definitions element that contains the other five elements, types, message, portType, binding and service. The following sections describe the features of the generated client code. WSDL supports the XML Schemas specification (XSD) as its type system.




explaining the elements in WSDL 
  • Types, which provides data type definitions used to describe the messages exchanged.
  • message, which represents an abstract definition of the data being transmitted. A message consists of logical parts, each of which is associated with a definition within some type system.
  • portType, which is a set of abstract operations. Each operation refers to an input message and output messages.
  • binding, which specifies concrete protocol and data format specifications for the operations and messages defined by a particular portType.
  • port, which specifies an address for a binding, thus defining a single communication endpoint.
  • service, which is used to aggregate a set of related ports.


Compare the PortType and operation elements in WSDL with the java equivalences 

portType (Analogs to Java interface)
  • PortType is an abstraction part of WSDL.
  • An abstract set of operations supported by one or more endpoints.
PortType defines the abstract interface of a web service.

➤A single Web service can support a number of different protocols. The structure of the data depends on the protocol that you use to invoke the Web service. Because of this, you need a way to map from the operations to the endpoints from which they can be accessed. The portType element takes care of this mapping.

➤You can place a portType definition for each of the protocols available to you for this Web service. For instance, you can have individual portType definitions for using SOAP, HTTP-POST, and HTTP-GET. The operation name is the method available from the Web service.

Compare and contrast the binding and service elements in WSDL 

binding
  • Binding is an concrete part of WSDL.
  • Describes how the operation is invoked by specifying concrete protocol and data format specifications for the operations and messages.
  • bindings are three types
    1. SOAP Binding 
    2. HTTP GET & POST binding
    3. MIME binding

 ➤binding mechanism is used to attach a specific protocol or data format or structure to an abstract message, operation, or endpoint.


 Explain how SOAP is used with HTTP 

SOAP supports both functional oriented and message oriented communication
•SOAP messages are carried as the payload of some other network protocol, for example via HTTP or SMTP (Simple Mail Transfer Protocol) or FTP (File Transfer Protocol) or TCP/IP (Transmission Control Protocol/Internet Protocol)
Web services use SOAP as the logical transport mechanism for moving messages between services described by WSDL interfaces

Discuss how SOAP can be used for     functional oriented communication

SOAP is known as the Simple Object Access Protocol, but in later times was just shortened to SOAP v1.2. SOAP is a protocol or in other words is a definition of how web services talk to each other or talk to client applications that invoke them.


Explain the structure of SOAP message in message oriented communication, indicating the elements used 


SIMPLE OBJECT ACCESS PROTOCOL


SOAP supports both functional oriented and message oriented communication


•SOAP messages 
•consistent envelope -header and body 
•consistent data encoding -based on XML Schema type system 
•protocol binding framework 



•Envelope 
•wraps entire message and contains header and body •defines an overall framework for expressing what is in a message; who should deal with it, and whether it is optional or mandatory
•Header 
•optional element with additional info such as security or routing
•Body 
•application-specific message content being communicated as arbitrary XML payloads in the request and response messages
•fault element provides information about errors that occurred while processing the message


 Discuss the importance of the SOAP   attachments, explaining the MIME header 


The Attachment Feature defines a set of properties described in Property definition for the Attachment Feature Property Name Property Description SOAP Message An abstract structure that represents the primary SOAP message part of the compound SOAP structure. Secondary Part Bag An abstract structure that represents the compound SOAP structure's secondary part(s). This structure is a bag that contains representations of each of the compound SOAP structure's secondary part(s).


➤SOAP messages may have one or more attachments 
•each AttachmentPart object has a MIME header to indicate the type of data it contains. 
•it may also have additional MIME headers to identify it or to give its location, which can be useful when there are multiple attachments 
•when a SOAP message has one or more AttachmentPart objects, its SOAPPart object may or may not contain message content


Identify different set of frameworks/librarie
-s for SOAP web service development, in different environments (Java, .Net, PHP, etc…) 



We can create SOAP web services using JAX-WS API, however some of the other frameworks that can be used are Apache Axis and Apache CXF. Note that they are not implementations of JAX-WS API, they are totally different framework that work on Servlet model to expose your business logic classes as SOAP web services.



Explain the annotations in JAX-WS, providing examples of their use 



➧Describes the supported JAX-WS annotations and their associated properties. The @Action annotation specifies the WS-Addressing action that is associated with a web service operation.


JAX-WS

This JAX-WS annotation can be used in 2 ways. If we are annotating this over a class, it means that we are trying to mark the class as the implementing the Web Service, in other words Service Implementation Bean (SIB). Or we are marking this over an interface, it means that we are defining a Web Service Interface (SEI), in other words Service Endpoint Interface.

Some of the important annotations used in JAX-WS API are:
·         @WebService-


This JAX-WS annotation can be used in 2 ways. If we are annotating this over a class, it means that we are trying to mark the class as the implementing the Web Service, in other words Service Implementation Bean (SIB). Or we are marking this over an interface, it means that we are defining a Web Service Interface (SEI), in other words Service Endpoint Interface.

·         @SOAPBinding - 

     Demonstration of @SOAPBinding JAX-WS annotation has already been shown in first program in 1.1. This annotation is used to specify the SOAP messaging style which can either be RPC or DOCUMENT. This style represents the encoding style of message sent to and fro while using the web service.

·         @WebMethod

JAX-WS is bundled with JDK 1.6, which makes Java web service development easier to develop. 


Discuss how a web service can be tested using different approaches (using a dummy client or a dedicated tool, etc…) 


This new way of software development brings out new issues for Web Service testing to ensure the quality of service that are published, bound, invoked and integrated at runtime. Testing services and service-centric systems poses new challenges to traditional testing approaches. Several Web Services testing approaches were developed to address these new challenges. 

Friday, March 8, 2019

Tute_04

Distributed systems


distributed system is a system whose components are located on different networked computers, which communicate and coordinate their actions by passing messages to one another.
➤The components are distributed and executed in multiple devices




   distributed systems and distributed computing 

➧Distributed system: a collection of independent computers that are connected with an interconnection network.
➧Distributed computing: a method of computer processing in which different parts of a computer program are run on two or more computers that are communicating with each other over a network.


Compare and contrast the standalone systems with distributed systems



standalone system Advantages

➽One advantage of a standalone computer is damage control. For example, if something goes wrong, only the standalone will be affected.

➽it takes a lot less expertise to manage one computer than it does to setup or troubleshoot several.

➽Standalone computers can also be more convenient. 
Distributed system Advantages

 o Economics
 o Speed
 o Inherent distribution
 o Reliability
 o Incremental growth


 elements of distributed systems 





•Processing components 
•Data networks for components
•Data stores (data bases) and Data
•The configuration of the above elements


Identify different types of services


➯Mail service (SMTP, POP3, IMAP) 
➯File transferring and sharing (FTP) 
➯Remote logging (telnet) 
➯Games and multimedia (RTP, SIP,H.26x) 
➯Web (HTTP)


specifying the protocols

➯Layered Protocols

➯Lower-Level Protocols

➯Transport Protocols

➯Higher-Level Protocols

➯Middleware Protocols



Identify examples for both browser-based and non-browser-based clients of distributed systems 



browser-based

Many companies assume that developing business applications"inside the browser" is their only option.

while browsers provide an excellent,fast way to deploy simple application,for more complex business application needs,a browser based approach is very expensive and often fall short of usability needs.

non-browser-based

Anything that's not a browser that goes online.
Currently, the most popular non-browser web clients are robots that index the web for search engines and link checkers that find broken links,but there is an infinite number of possible client programs and devices.



Discuss the characteristics of different types of Web-based systems, including the RiWAs 


Web sites 
➜Web applications 
➜Web services and client apps 
➜Rich Internet Applications (RIAs)/Rich     Web based       Applications (RiWAs)


Explain different architectures for distributed systems, explaining special features of each 

client-server (or two-tier) architecture



➤The basic architecture of the distributed systems
➤client (user) sends a request asking the server for some               service and the server responses with the resources

3-tier architecture 



➤is used, when there is a need for data persistence and                  also to separate the application logic from the data
➤This can be seen as an extension of 2-tier architecture


n-tier architecture


When there is a need for further separation and distribution of the components, more tiers can be added and extend the 2-tier or 3-tier architecture into an n-tier architecture


Service Oriented Architecture (SOA)



➤When different types of distributed systems want to communicate and share their services forming enterprise level systems, the Service Oriented Architecture (SOA)is used.


Compare and contrast the micro-service architecture from monolithic architecture 



Microservices Architecture. The idea is to split your application into a set of smaller, interconnected services instead of building a single monolithic application.

Each microservice is a small application that has its own hexagonal architecture consisting of business logic along with various adapters.


Benefits of Monolithic Architecture
  • ➧Simple to develop.
  • ➧Simple to test. For example you can implement end-to-end testing by simply launching the application and testing the UI with Selenium.
  • ➧Simple to deploy. You just have to copy the packaged application to a server.
  • ➧Simple to scale horizontally by running multiple copies behind a load balancer.

Benefits of Microservices Architecture
  • ➧It enables each service to be developed independently by a team that is focused on that service.
  • ➧Microservice architecture enables each microservice to be deployed independently. As a result, it makes continuous deployment possible for complex applications.
  • ➧Microservice architecture enables each service to be scaled independently.


Explain the MVC style, indicating the limitations of it in the context of web-based systems 

MVC Pattern stands for Model-View-Controller Pattern. This pattern is used to separate application's concerns.
  • Model - Model represents an object or JAVA POJO carrying data. It can also have logic to update controller if its data changes.
  • View - View represents the visualization of the data that model contains.
  • Controller - Controller acts on both model and view. It controls the data flow into model object and updates the view whenever data changes. It keeps view and model separate.


Identify different approaches of use of MVC for web-based systems and discuss their strengths and weaknesses 

strengths of MVC
1) Faster development process
2) Ability to provide multiple views
3) Support for asynchronous technique
4) Modification does not affect the entire model
5) MVC model returns the data without formatting
6) SEO friendly Development platform

weaknesses  of MVC
1) Increased complexity
2) Inefficiency of data access in view
3) Difficulty of using MVC with modern user interface.
4) Need multiple programmers
5) Knowledge on multiple technologies is required.
6) Developer have knowledge of client side code and html code.

Discuss the need for very specific type of communication technologies/techniques for the distributed/web-based systems 
Information and communication technologies for development (ICT4D) refers to the application of information and communication technologies (ICT) toward social, economic, and political development, with a particular emphasis on helping poor and marginalized people and communities. It aims to help in international development by bridging the digital divide and providing equitable access to technologies. ICT4D is grounded in the notions of "development", "growth", "progress" and "globalization" and is often interpreted as the use of technology to deliver a greater good. Another similar term used in the literature is "digital development". ICT4D draws on theories and frameworks from many disciplines, including sociology, economics, development studies, library, information science, and communication studies. 
Compare and contrast RPC with RMI


The common difference between RPC and RMI is that RPC only supports procedural programming whereas RMI supports object-oriented programming. Another major difference between the two is that the parameters passed to remote procedures call consist of ordinary data structures. 





Explain the need for CORBA, indicating it’s use in web-based systems 


Functional oriented communication 

Common Object Request Broker Architecture (CORBA)




➤is a specification developed by the Object Management Group (OMG). CORBA describes a messaging mechanism by which objects distributed over a network can communicate with each other irrespective of the platform and language used to develop those objects.


Discuss the XML specification, highlighting the important sections such as element naming conventions 

The main and the only component of XML is called an element. 

•An element has 3 components
      1.Start tag
      2.Body
      3.End tag
•There are special type of element with a single self closing tag
An element has a name 

•Element names are case-sensitive 
•Element names must start with a letter or underscore •Element names cannot start with the letters xml (or XML, or Xml, etc) 
•Element names can contain letters, digits, hyphens, underscores, and periods 
•Element names cannot contain spaces
•Any name can be used, no words are reserved 




Compare and contrast XML and JSON, indicating the pros and cons of both 



XML is a meta-language/markup language and JSON is a lightweight data-interchange. That is, XML syntax is designed specifically to have no inherent semantics. 
JSON parser, therefore, knows exactly what every JSON document means.





Identify other data formatting/structuring techniques available for the communication of web-based systems 

In a web-based learning environment communication can be either:  

Synchronous-communication takes place at the same time.This requires that all participants are present at the same time.This type of communication is used fairly rarely for specific purposes such as getting acquainted.

Asynchronous- communication takes place at different times or over a certain period of time.This allows more time to work on messages and to react to other student's message.


communication can vary also depending on the amount of people it involves. Communication on the web can be divided into types,involves a different amount of participants at a time