Thursday, April 4, 2019

RESTful Web services

Message oriented communication with resource oriented communication 

Message oriented communication
Asynchronous communication does not require both the sender and the receiver to execute simultaneously. So, the sender and recipient are loosely-coupled.The amount of time messages are stored determines whether the communication is transient or persistent.


follow this link additional
https://www.youtube.com/watch?v=hcvBDQUifHc


Discuss the resource based nature of the REST style

A URL a resource identifier that identifies/locates a resource in the server.Representational State Transfer (REST) is a style of software architecture for distributed systems such as the World Wide Web. REST-style architectures consist of clients and servers.

The fundamental concept in any Restful API is the resource. A resource is an object with a type, associated data, relationships to other resources, and a set of methods that operate on it. It is similar to an object instance in an object-oriented programming language, with the important difference that only a few standard methods are defined for the resource (corresponding to the standard HTTP GET,POST,PUT and DELETE methods),while an object instance typically has many methods.
Resources can be grouped into collections.Each collection is homogeneous so that it contains only one type of resource,and underscored.Resources can also exist outside any collection.In this case,we refer to these resources as singleton resources.Collections are themselves resources as well.
Collections can exist globally,at the top level of an API,but can also be contained inside a single resource. In the latter case,we refer to these collections as sub-collections.Sub-collections are usually used to express some kind of "contained in" relationship. We go into more detail on this in Relationships.

Explain the meaning of “representations” in REST style 

Representational State Transfer (REST) is a software architectural style that defines a set of constraints to be used for creating Web services Web resources were first defined on the World Wide Web as documents or files identified by their URLs.REST uses various representations to represent a resource where Text, J SON, XML. The most popular representations of resources are XML and J SON.

 REST, indicating their use in the domain of web 

REST (Representational State Transfer) is an architectural style for developing web services. REST is popular due to its simplicity and the fact that it builds upon existing systems and features of the internet's HTTP in order to achieve its objectives, as opposed to creating new standards, frameworks and technologies.
language-independent architectural style.REST-based applications can be written using any language, be it Java, Kotlin,NET, Angular or JavaScript. As long as a programming language can make web-based requests using HTTP, it is possible for that language to be used to invoke a Restful API or web service.On the server side,there are a variety of REST-based frameworks for helping developers create Restful web services,including Rest let and Apache CXF. From the client side,all of the new JavaScript frameworks,such as JQuery, Node.js,Angular and EmberJS,all have standard libraries built into their APIs that make invoking Restful web services and consuming the XML- or J SON-based data they return a relatively straightforward endeavour Similarly,Restful web services can be written using any language,so developers tasked with implementing such services can choose technologies that work best for their situation.

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

  • Client–server architecture.
  • Statelessness.
  • Cache ability.
  • Layered system.
  • Code on demand (optional)
  • Uniform interface.
  • Relationship between URI and HTTP methods.

The Representational State Transfer (REST) architectural style is a worldview that elevates information into a first-class element of architectures.REST allows us to achieve the architectural properties of performance,sociability,generality,simplicity,modifiable, and extensible.

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

Every system uses resources.These resources can be pictures,Video files,Web pages, business information, or anything that can be represented in a computer-based system.The purpose of a service is to provide a window to its clients so that they can access these resources. Service architects and developers want this service to be easy to implement, maintainable, extensible, and scalable. A Restful design promises that and more. In general, Restful services should have following properties and features, which I'll describe in detail:
  • Representations
  • Messages
  • URLs
  • Uniform interface
  • Stateless
  • Links between resources
  • Caching

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

The most common discussion I've seen regarding the pros and cons of REST tends to frame that discussion relative to SOAP.I have no experience in either.I am currently faced with a decision which my lack of experience is making hard for me to evaluate.I am beginning to develop an application that has several components - primarily an administrative aspect that allows the owner to administer several sites - and a public facing user interface that allows the user to interact with data held on the host.I need to evaluate the implications of allowing the latter part to be hosted anywhere and communicate with the former via a Restful architecture - or demanding that both components reside on the same host.What are the key implications of developing Restful architecture,particularly with regards to it's capacity in the following areas.

JAX-RS API and its implementations 

Developing Restful Web services that seamlessly support exposing your data in a variety of representation media types and abstract away the low-level details of the client-server communication is not an easy task without a good toolkit. In order to simplify development of Restful Web services and their clients in Java, a standard and portable JAX-RS API has been designed. Jersey Restful Web Services framework is open source,production quality,framework for developing Restful Web Services in Java that provides support for JAX-RS APIs and serves as a JAX-RS (JSR 311 & JSR 339) Reference Implementation.
Jersey framework is more than the JAX-RS Reference Implementation. Jersey provides it’s own API that extend the JAX-RS toolkit with additional features and utilities to further simplify Restful service and client development. Jersey also exposes numerous extension SPIs so that developers may extend Jersey to best suit their needs.
Goals of Jersey project can be summarised in the following points
  • Track the JAX-RS API and provide regular releases of production quality Reference Implementations that ships with Glass Fish;
  • Provide APIs to extend Jersey & Build a community of users and developers; and finally
  • Make it easy to build Restful Web services utilising Java and the Java Virtual Machine.
  • Apache CXF, an open source Web service framework
  • Jersey, the reference implementation from Sun (now Oracle)
  • Rest easy, J Boss's implementation
  • Rest let
  • WebSphere Application Server from IBM




Identify the annotations in JAX-RS, explaining their use 

Annotations in the JAX-RS API are used to provide meta-data around the web resource. A typical example is to use the @GET annotation with the @Path annotation to identify the method that should handle a GET request to the specified URI in the @Path annotation.
What follows is a very quick overview of the annotations available to mark the methods and classes used to construct web resources. This is not an exhaustive list, there are a few more annotations in the JAR-RS arsenal, however, as the majority of the work of JAX-RS is in configuration and handling web resources, this is where you will find the majority of the API's annotations put to use.
This is the first in a three-part series looking at JAX-RS annotations.

@GETimport javax.ws.rs.GET;
@Producesimport javax.ws.rs.Produces;
@Pathimport javax.ws.rs.Path;
@PathParamimport javax.ws.rs.PathParam;
@QueryParamimport javax.ws.rs.QueryParam;
@POSTimport javax.ws.rs.POST;
@Consumesimport javax.ws.rs.Consumes;
@FormParamimport javax.ws.rs.FormParam;
@PUTimport javax.ws.rs.PUT;
@DELETEimport javax.ws.rs.DELETE;









Friday, March 15, 2019

Web services and SOAP

 web applications with web services, indicating the need for web services

Web services achieve this task with the help of XML, SOAP, WSDL and UDDI open standards. web services do not necessarily have a user interface since it is used as a component in an application. An application that the users access over the internet is called a web application.


There are three types of operations:
1. One way
2. Request response
3. Notification
Web Services vs Web Applications
  • Web Services can be used to transfer data between Web Applications.
  • Web Services can be accessed from any languages or platform.
  • A Web Application is meant for humans to read, while a Web Service is meant for computers to read.
  • Web Application is a complete Application with a Graphical User Interface (GUI), however, web services do not necessarily have a user interface since it is used as a component in an application.
  • Web Application can be access through browsers.


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

WSDL Web Services Description Language is an XML-based standard for describing a web service. A WSDL document (often itself just called a WSDL) describes the available functions of a web service, their expected arguments, and the data types for their return values. WSDLs are used by developers of client applications that consume XML-based web services.

Fundamental properties of a WSDL document and the use of WSDL document in web services and client development 

A WSDL document is a document that is used to describe a web service. This is key for any client application to know where the web service is located. It also allows the client application to understand the methods available in the web service. '
At an abstract level, WSDL 2.0 describes a Web service in terms of the messages it sends and receives; messages are described independent of a specific wire format using a type system, typically XML Schema. An operation associates a message exchange pattern with one or more messages.

structure of the WSDL document, explaining the elements in WSDL

WSDL Document Elements. A WSDL document has a definitions element that contains the other five elements, types, message, port Type, binding and service. The following sections describe the features of the generated client code. WSDL supports the XML Schema specification (XSD) as its type system. 
A WSDL document contains the following elements −
  • Definition − It is the root element of all WSDL documents. It defines the name of the web service, declares multiple namespaces used throughout the remainder of the document, and contains all the service elements described here.
  • Data types − The data types to be used in the messages are in the form of XML schema.
  • Message − It is an abstract definition of the data, in the form of a message presented either as an entire document or as arguments to be mapped to a method invocation.
  • Operation − It is the abstract definition of the operation for a message, such as naming a method, message queue, or business process, that will accept and process the message.
  • Port type − It is an abstract set of operations mapped to one or more end-points, defining the collection of operations for a binding; the collection of operations, as it is abstract, can be mapped to multiple transports through various bindings.
  • Binding − It is the concrete protocol and data formats for the operations and messages defined for a particular port type.
  • Port − It is a combination of a binding and a network address, providing the target address of the service communication.
  • Service − It is a collection of related end-points encompassing the service definitions in the file; the services map the binding to the port and include any extensible definitions.
More details you can follow this link:-


PortType and operation elements in WSDL with the java equivalences

Service providers and consumers are free to implement their ends of the exchange in any way they want, as long as the actual messages they send match the service definition. The use of service definitions specifying XML message exchanges is what sets web services apart from earlier technologies for distributed programming.

Binding and service elements in WSDL 


WSDL Elements Definition − It is the root element of all WSDL documents.Binding − It is the concrete protocol and data formats for the operations and messages defined for a particular port type. Port − It is a combination of a binding and a network address, providing the target address of the service communication. 


Explain how SOAP is used with HTTP

SOAP is a protocol which is used to interchange data between applications which are built on different programming languages.SOAP is built upon the XML specification and works with the HTTP protocol.This makes it a perfect for usage within web applications. The SOAP building blocks consist of a SOAP Message.



Discuss how SOAP can be used for functional oriented communication?


SOAP ( Simple Object Access Protocol) is a message protocol that allows distributed elements of an application to communicate. SOAP can be carried over a variety of lower-level protocols, including the web-related Hypertext Transfer Protocol (HTTP). SOAP defines a header structure that identifies the actions that various SOAP nodes are expected to take on the message, in addition to a payload structure for carrying information.SOAP is a protocol which is used to interchange data between applications which are built on different programming languages.SOAP is built upon the XML specification and works with the HTTP protocol. This makes it a perfect for usage within web applications.
The SOAP building blocks consist of a SOAP Message.The concept of routing a message through a string of nodes that perform different functions is how SOAP supports things like addressing, security and format-independence. Essentially, the headers identify roles, which in turn provide the SOA features which SOAP then routes to. Stringing messages through a sequence of steps is uncommon in today’s microservice-centric development environments. 

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

The SOAP specification establishes a standard message format that consists of an XML document capable of hosting RPC and document-centric data (see Figure 3.19). This facilitates synchronous (request and response) as well as asynchronous (process-driven) data exchange models.SOAP is a communication protocol designed to communicate via Internet. 
The envelope element is the mandatory element in the SOAP message and is used to encapsulate all of the data in the SOAP message. The header element can be used to contain information such as authentication information or the definition of complex data types.


Importance of the SOAP attachments, explaining the MIME header

This document defines a SOAP feature that represents an abstract model for SOAP attachments.It provides the basis for the creation of SOAP bindings that transmit such attachments along with a SOAP envelope, and provides for reference of those attachments from the envelope. 
The MIME stands for Multi-Purpose Internet Mail Extensions. As the name indicates, it is an extension to the Internet email protocol that allows it’s users to exchange different kinds of data files over the Internet such as images, audio, and video. The MIME is required if text in character sets other than ASCII. Virtually all human-written Internet email and a fairly large proportion of automated email is transmitted via SMTP in MIME format. Actually, MIME was designed mainly for SMTP, but the content types defined by MIME standards are important also in communication protocols outside of email, such as HTTP. In 1991, Nathan Borenstein of Bell core proposed to the IETF that SMTP be extended so that Internet (but mainly Web) clients and servers could recognize and handle other kinds of data than ASCII text. As a result, new file types were added to "mail" as a supported Internet Protocol file type.

more details :-


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


JAX-WS Annotations (JSR 224). 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.

There are two types of web services:
  1. SOAP Web Services
  2. Restful Web Services




How a web service can be tested using different approaches

What is the testing approach towards web services?Testing of web services is one of the important type of software testing approach, which is mainly used to determine the expectations for reliability, functionality, performance.
As these days Automated testing is considered as one of the most trending methodology in the field of software testing, hence testing web apps based on Restful APIs through automation will provide effective test results. Some of the best & popular tools for web services testing are:
  1. Soap UI,
  2. Testing-whiz,
  3. Softest
  4. Test Maker,
  5. Postman, 











Thursday, March 7, 2019

Explain the term 'distributed systems', contrasting it from 'distributed computing'


 A distributed system is a network that consists of autonomous computers that are connected using a distribution middle ware. They help in sharing different resources and capabilities to provide users with a single and integrated coherent network.
Distributed computing is a computing concept that, in its most general sense, refers to multiple computer systems working on a single problem. In distributed computing, a single problem is divided into many parts, and each part is solved by different computers.





Compare and contrast the standalone systems with distributed systems, providing examples for advantageous use of both

 Operating system is developed to ease people daily life. For user benefits and needs the operating system may be single user or distributed. In distributed systems, many computers connected to each other and share their resources with each other. There are some advantages and disadvantages of distributed operating system that we will discuss.


Advantages of distributed operating systems:-
  • Give more performance than single system
  • If one pc in distributed system malfunction or corrupts then other node or pc will take care of
  • More resources can be added easily
  • Resources like printers can be shared on multiple pc’s
Disadvantages of distributed operating systems:-
  • Security problem due to sharing
  • Some messages can be lost in the network system
  • Bandwidth is another problem if there is large data then all network wires to be replaced which tends to become expensive
  • Overloading is another problem in distributed operating systems
  • If there is a database connected on local system and many users accessing that database through remote or distributed way then performance become slow
  • The databases in network operating is difficult to administrate then single user system



Discuss the elements of distributed systems


A 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 interact with one another in order to achieve a common goal.



Identify different types of services, which can be gained from distributed systems, specifying the protocols used for them 


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




Identify examples for both browser-based and non-browser-

based clients of distributed systems  


A browser-based (or web-based) tool, application, program, or app is software that runs on your web browser. Browser-based applications only require an internet connection and an installed web browser on your computer to function. Most web-based applications are installed and run on a remote server that you access with your web browser.
A client does not share any of its resources, but requests a server's content or service function.Clients therefore initiate communication sessions with servers which await incoming requests. Examples of computer applications that use the client–server model are Email, network printing, and the World Wide Web.
 


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



  • Type 1: server-side HTML web application.
  • Type 2: JS generation widgets (AJAX)
  • Type 3: service-oriented single-page web apps 

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

A distributed system is a software system that interconnects a collection of heterogeneous independent computers, where coordination and communication between computers only happen through message passing, with the intention of working towards a common goal. The idea behind distributed systems is to provide a viewpoint of being a single coherent system, to the outside world. So, the set of independent computers or nodes are interconnected through a Local Area Network (LAN) or a Wide Area Network (WAN).
In this blog, I would like to talk about the available Distributed System architectures that we see today and how they are being utilised in our day to day applications. Distributed system architectures are bundled up with components and connectors. Components can be individual nodes or important components in the architecture whereas connectors are the ones that connect each of these components. 

  • Component: A modular unit with well-defined interfaces; replaceable; reusable
  • Connector: A communication link between modules which mediates coordination or cooperation among components
 So the idea behind distributed architectures is to have these components presented on different platforms, where components can communicate with each other over a communication network in order to achieve specifics objectives.

Architectural Styles

There are four different architectural styles, plus the hybrid architecture, when it comes to distributed systems.  The basic idea is to organise logically different components, and distribute those computers over the various machines.

  • Layered Architecture
  • Object Based Architecture
  • Data-centred Architecture
  • Event Based Architecture
  • Hybrid Architecture

Layered Architecture

The layered architecture separates layers of components from each other, giving it a much more modular approach. A well known example for this is the OSI model that incorporates a layered architecture when interacting with each of the components. Each interaction is sequential where a layer will contact the adjacent layer and this process continues, until the request is been catered to. But in certain cases, the implementation can be made so that some layers will be skipped, which is called cross-layer coordination. Through cross-layer coordination, one can obtain better results due to performance increase.

 Object Based Architecture

This architecture style is based on loosely coupled arrangement of objects. This has no specific architecture like layers. Like in layers, this does not have a sequential set of steps that needs to be carried out for a given call. Each of the components are referred to as objects, where each object can interact with other objects through a given connector or interface. These are much more direct where all the different components can interact directly with other components through a direct method call.

Compare and contrast the micro-service architecture from 

monolithic architecture

Micro services Architecture. The idea is to split your application into a set of smaller, interconnected services instead of building a single monolithic application. Each micro service is a small application that has its own hexagonal architecture consisting of business logic along with various adaptors.


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

Design Patterns - MVC Pattern. 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. 

As consumers continue to migrate online to do their shopping, it’s natural that companies follow suit by moving their customer service options to Web-based platforms. Doing so can take care of issues quickly, linking customers to relevant policies and forms to expedite solutions. However, this capability comes with disadvantages as well.


Compare and contrast RPC with RMI


RPC and RMI are the mechanisms which enable a client to invoke the procedure or method from the server through establishing communication between client and server. The common difference between RPC and RMI is that RPC only supports procedural programming whereas RMI supports object-oriented programming.
nother major difference between the two is that the parameters passed to remote procedures call consist of ordinary data structures. On the other hand, the parameters passed to remote method consist of objects.
  1. Comparison Chart
  2. Definition
  3. Key Differences
  4. Conclusion





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

systems 

The Common Object Request Broker Architecture (CORBA) is a standard developed by the Object Management Group (OMg) to provide inseparability among distributed objects. CORBA is the world's leading middle ware solution enabling the exchange of information, independent of hardware platforms, programming languages, and operating systems. CORBA is essentially a design specification for an Object Request Broker (ORB), where an ORB provides the mechanism required for distributed objects to communicate with one another, whether locally or on remote devices, written in different languages, or at different locations on a network.
The CORBA Interface Definition Language, or IDL, allows the development of language and location-independent interfaces to distributed objects. Using CORBA, application components can communicate with one another no matter where they are located, or who has designed them. CORBA provides the location transparency to be able to execute these applications.
CORBA is often described as a "software bus" because it is a software-based communications interface through which objects are located and accessed. The illustration below identifies the primary components seen within a CORBA implementation.



 Discuss the XML specification


XML code, a formal recommendation from the World Wide Web Consortium (W3C), is similar to Hypertext Markup Language (HTML). Both XML and HTML contain markup symbols to describe page or file contents. HTML code describes Web page content (mainly text and graphic images) only in terms of how it is to be displayed and interacted with.




 Compare and contrast XML and JSON, indicating the pros and 

cons of both 


JSONXML
JSON strengths
Fully automated way of DE-serialising/serialising JavaScript objects, minimum to no codingDevelopers have to write JavaScript code to serialise/DE-serialise to/from XML
Very good support by all browsersWhile XML parser are built-in into all modern browsers, cross-browser XML parsing can be tricky, e.g., see this article
Concise format thanks to name/value pair -based approachVerbose format because of tags and namespaces
Fast object DE-serialisation in JavaScript (based on anecdotal evidence )Slower DE-serialisation in JavaScript (based on anecdotal evidence )
Supported by many AJAX toolkit and JavaScript librariesNot very well supported by AJAX toolkit
Simple API (available for JavaScript and many other languages)More complex APIs
JSON weaknesses
No support for formal grammar definition, hence interface contracts are hard to communicate and enforceXML Schema or DTD can be used to define grammars
No namespace support, hence poor extensibleGood namespace support, many different extensible options in Schema
Limited development tools supportSupported by wide array of development and other (e.g., transformation) tools
Narrow focus, used for RPC only, primarily with JavaScript clients (although one can argue that it's one of the strengths)Broad focus - can be used for RPC, EDI, metadata, you name it
No support in Web services -related products (application servers, ESBs, etc), at least not yetSupported by all Web services products