Friday, June 29, 2012

Webservices Technologies


  • The Twelve Factor App
The software is increasingly delivered over the Internet as a service. Originally called Software as a Service (SaaS), similar software – with a much stronger emphasis on mobile interaction – is now usually referred to as web apps.
    The Twelve‑Factor App is a praiseworthy effort by Heroku, a platform as a service (PaaS) provider, to establish general principles for creating useful web apps. However, the original principles are somewhat specific to Heroku’s PaaS platform. They aren’t an exact fit for a microservices architecture.

        In implementing the NGINX MRA, we’ve extended the Twelve‑Factor App with our own additions and microservices‑specific modifications.

            Our principles adapt the core ideas in The Twelve‑Factor App to a general‑purpose microservices architecture that is optimized for continuous delivery.

                The Twelve Factors Applied to Microservices
                  1 – Codebase
                    One codebase per service, tracked in revision control; many deploys
                      The Twelve‑Factor App recommends one codebase per app. In a microservices architecture, the correct approach is actually one codebase per service.

                          2 – Dependencies
                            Explicitly declare and isolate dependencies
                              As suggested in The Twelve‑Factor App, regardless of what platform your application is running on, use the dependency manager included with your language or framework. How you install operating system or platform dependencies depends on the platform:
                                In noncontainerized environments, use a configuration management tool (Chef, Puppet, Ansible) to install system dependencies.
                                  In a containerized environment, do this in the Dockerfile

                                      3 – Config
                                        Store configuration in the environment
                                          Anything that varies between deployments can be considered configuration.
                                            The Twelve‑Factor App guidelines recommend storing all configuration in the environment, rather than committing it to the repository.

                                                We recommend the following specific practices:
                                                  Use non‑version controlled .env files for local development. Docker supports the loading of these files at runtime.
                                                    Keep all .env files in a secure storage system, such as Vault, to keep the files available to the development teams, but not commited to Git.
                                                      Use an environment variable for anything that can change at runtime, and for any secrets that should not be committed to the shared repository.
                                                        Once you have deployed your application to a delivery platform, use the delivery platform’s mechanism for managing environment variables.

                                                            4 – Backing Services
                                                              Treat backing services as attached resources
                                                                The Twelve‑Factor App guidelines define a backing service as “any service the app consumes over the network as part of its normal operation.” The implication for microservices is that anything external to a service is treated as an attached resource, including other services. This ensures that every service is completely portable and loosely coupled to the other resources in the system
                                                                  5 – Build, Release, Run
                                                                    Strictly separate build and run stages
                                                                      we recommend the use of a continuous integration/continuous delivery (CI/CD) tool to automate builds. Docker images make it easy to separate the build and run stages. Ideally, images are created from every commit and treated as deployment artifacts.

                                                                          6 – Processes
                                                                            Execute the app in one or more stateless processes
                                                                              For microservices, the important point in the Processes factor is that your application needs to be stateless. This makes it easy to scale a service horizontally by simply adding more instances of that service. Store any stateful data, or data that needs to be shared between instances, in a backing service.

                                                                                  7 – Data Isolation
                                                                                    Each service manages its own data
                                                                                      As a modification to make the Port binding factor more useful for microservices, we recommend that you allow access to the persistent data owned by a service only via the service’s API. This prevents implicit service contracts between microservices and ensures that microservices can’t become tightly coupled. Data isolation also allows the developer to choose, for each service, the type of data store that best suits its needs.

                                                                                          8 – Concurrency
                                                                                            Scale-out via the process model
                                                                                              The Unix process model is largely a predecessor to a true microservices architecture, insofar as it allows specialization and resource sharing for different tasks within a monolithic application. In a microservices architecture, you can horizontally scale each service independently, to the extent supported by the underlying infrastructure. With containerized services, you further get the concurrency recommended in the Twelve‑Factor App, for free.

                                                                                                  9 – Disposability
                                                                                                    Maximize robustness with fast startup and graceful shutdown
                                                                                                      Instances of a service need to be disposable so they can be started, stopped, and redeployed quickly, and with no loss of data. Services deployed in Docker containers satisfy this requirement automatically, as it’s an inherent feature of containers that they can be stopped and started instantly. Storing state or session data in queues or other backing services ensures that a request is handled seamlessly in the event of a container crash

                                                                                                          10 – Dev/Prod Parity
                                                                                                            Keep development, staging, and production as similar as possible
                                                                                                              Keep all of your environments – development, staging, production, and so on – as identical as possible, to reduce the risk that bugs show up only in some environments. To support this principle, we recommend, again, the use of containers – a very powerful tool here, as they enable you to run exactly the same execution environment all the way from local development through production

                                                                                                                  11 – Logs
                                                                                                                    Treat logs as event streams
                                                                                                                      Instead of including code in a microservice for routing or storing logs, use one of the many good log‑management solutions

                                                                                                                          12 – Admin Processes
                                                                                                                            Run admin and management tasks as one‑off processes
                                                                                                                              In a production environment, run administrative and maintenance tasks separately from the app. Containers make this very easy, as you can spin up a container just to run a task and then shut it down.
                                                                                                                              https://www.nginx.com/blog/microservices-reference-architecture-nginx-twelve-factor-app/
                                                                                                                                • In the modern era, software is commonly delivered as a service: called web apps, or software-as-a-service. The twelve-factor app is a methodology for building software-as-a-service apps that:
                                                                                                                                •     Use declarative formats for setup automation, to minimize time and cost for new developers joining the project;
                                                                                                                                      Have a clean contract with the underlying operating system, offering maximum portability between execution environments;
                                                                                                                                      Are suitable for deployment on modern cloud platforms, obviating the need for servers and systems administration;
                                                                                                                                      Minimize divergence between development and production, enabling continuous deployment for maximum agility;
                                                                                                                                      And can scale up without significant changes to tooling, architecture, or development practices.
                                                                                                                                  The twelve-factor methodology can be applied to apps written in any programming language, and which use any combination of backing services (database, queue, memory cache, etc)
                                                                                                                                  https://12factor.net/

                                                                                                                                • The Twelve-Factor App methodology is a methodology for building software as a service application. These best practices are designed to enable applications to be built with portability and resilience when deployed to the web
                                                                                                                                • https://en.wikipedia.org/wiki/Twelve-Factor_App_methodology
                                                                                                                                • How to build 12-factor microservices applications on AWS with Containers
                                                                                                                                  • Microservices is an approach to application development in which a large application is built as a suite of modular services.
                                                                                                                                    To get the benefits of containers and microservices, look to a methodology known as the 12-factor app, a popular methodology for building “software-as-a-service apps.
                                                                                                                                    https://devops.com/build-12-factor-microservices-applications-aws-containers/

                                                                                                                                • The Twelve-Factor App A Successful Microservices Guideline
                                                                                                                                Heroku did a great job at defining what makes a solid baseline for standing up your architecture.
                                                                                                                                The Twelve-Factor App methodology for building software-as-a-service based 
                                                                                                                                It is technology and language agnostic but successfully compatible with Microservices, Containers and CI/CD Pipelines with a focus on DevOps
                                                                                                                                https://dev.to/simon_sugob/the-twelve-factor-appa-successful-microservices-guideline-3a1h
                                                                                                                                • The Process Model
                                                                                                                                The Unix process model is a simple and powerful abstraction for running server-side programs. It provides a helpful way to think about dividing a web app’s workloads and scaling it up over time.

                                                                                                                                    a simple illustration of the basics of the process model, using a well-known Unix daemon: memcached.
                                                                                                                                      Running a process manually in a terminal is fine for local development, but in a production deployment, your app’s processes should be managed. Managed processes should run automatically when the operating system starts up and should be restarted if the system fails for any reason.
                                                                                                                                        In traditional server-based deployments, the operating system provides a process manager. On macOS, launchd is the built-in process manager; on Ubuntu, systemd is the built-in process manager.

                                                                                                                                            A server daemon like memcached has a single entry point, meaning there’s only one command you run to invoke it.
                                                                                                                                              Web apps, on the other hand, typically have two or more entry points. Each of these entry points can be called a process type.
                                                                                                                                                Process types differ for each app.

                                                                                                                                                    A process type is a prototype from which one or more dynos are instantiated. This is similar to the way a class is a prototype from which one or more objects are instantiated in object-oriented programming.
                                                                                                                                                      https://devcenter.heroku.com/articles/process-model#mapping-the-unix-process-model-to-web-apps

                                                                                                                                                      • In software development, a codebase (or code base) refers to a whole collection of source code that is used to build a particular software system, application, or software component. Typically, a codebase includes only human-written source code files; thus, a codebase usually does not include source code files generated by tools (generated files) or binary library files (object files), as they can be built from the human-written source code.
                                                                                                                                                      https://en.wikipedia.org/wiki/Codebase

                                                                                                                                                      • Microservices

                                                                                                                                                      In short, the microservice architectural style [1] is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies.
                                                                                                                                                      http://martinfowler.com/articles/microservices.html

                                                                                                                                                      • Microservices - also known as the microservice architecture - is an architectural style that structures an application as a collection of loosely coupled services, which implement business capabilities. The microservice architecture enables the continuous delivery/deployment of large, complex applications. It also enables an organization to evolve its technology stack.

                                                                                                                                                      https://microservices.io/

                                                                                                                                                      • what is the difference between APIs and microservices?

                                                                                                                                                      The word “microservice” refers to the individual services in a microservice architecture.
                                                                                                                                                      Microservices are an example of Service-Oriented Architecture, or SOA, which has grown to be a popular alternative to the traditional approach of building singular, self-sufficient applications, which we call monoliths
                                                                                                                                                      What Is an API?
                                                                                                                                                      API stands for Application Programming Interface, where the keyword is interface. APIs are the doorways, so to speak, that allow developers to interact with an application.
                                                                                                                                                      https://nordicapis.com/what-is-the-difference-between-apis-and-microservices/


                                                                                                                                                      • RESTful API vs Microservice

                                                                                                                                                      Microservices is more about architectural whereas RESTful API focuses more on how to expose Microservices.Microservices is more about architectural and design style, and you may be able to implement a Microservices without RESTful API. However, RESTful API makes it easy to build a loosely coupled Microservices.
                                                                                                                                                      https://medium.com/@ericjwhuang/restful-api-vs-microservice-eea903ac3e73

                                                                                                                                                      • API vs. Microservices: A Microservice Is More Than Just an API

                                                                                                                                                      APIs are usually developed using a RESTful style. These APIs will have a series of verbs associating with HTTP actions, like the following:
                                                                                                                                                          GET (get a single item or a collection)
                                                                                                                                                          POST (add an item to a collection)
                                                                                                                                                          PUT (edit an item that already exists in a collection)
                                                                                                                                                          DELETE (delete an item in a collection)
                                                                                                                                                      What Is a Microservice?
                                                                                                                                                      Wikipedia defines a microservice as:
                                                                                                                                                          a software development technique—a variant of the service-oriented architecture (SOA) architectural style that structures an application as a collection of loosely coupled services. In a microservices architecture, services are fine-grained and the protocols are lightweight.

                                                                                                                                                      The Difference Between APIs and Microservices
                                                                                                                                                          An API is a contract that provides guidance for a consumer to use the underlying service.
                                                                                                                                                          A microservice is an architectural design that separates portions of a (usually monolithic) application into small, self-containing services.
                                                                                                                                                      https://www.scalyr.com/blog/api-vs-microservices

                                                                                                                                                      • The Difference Between Microservices and Web Services

                                                                                                                                                      your software can use both microservices and web services at the same time.
                                                                                                                                                      https://dzone.com/articles/the-difference-between-microservices-and-web-servi


                                                                                                                                                      • The Difference between Web Services and Micro Services

                                                                                                                                                      Micro Services and Web Services are two different concepts of Application Development Architecture, which can be differentiated from its layered architecture and development style
                                                                                                                                                      What is Web Service?
                                                                                                                                                      Web Service is a way to expose the functionality of an application to other application, without a user interface. It is a service which exposes an API over HTTP.Web Service is a connection technology, a way to connect services together into a Service Oriented Architecture (SOA).
                                                                                                                                                      What is Micro Service?
                                                                                                                                                      Micro Service is independently deployable service modeled around a business domain. It is a method of breaking large software applications into loosely coupled modules, in which each service runs a unique process and communicates through APIs. It can be developed using messaging or event-driven APIs, or using non-HTTP backed RPC mechanisms.
                                                                                                                                                      https://www.tatvasoft.com/blog/the-difference-between-micro-services-and-web-services/
                                                                                                                                                      • Microservices are an architectural and organizational approach to software development where software is composed of small independent services that communicate over well-defined APIs.
                                                                                                                                                      Microservices architectures make applications easier to scale and faster to develop, enabling innovation and accelerating time-to-market for new features.

                                                                                                                                                      Characteristics of Microservices
                                                                                                                                                      Autonomous
                                                                                                                                                      Each component service in a microservices architecture can be developed, deployed, operated, and scaled without affecting the functioning of other services. Services do not need to share any of their code or implementation with other services. Any communication between individual components happens via well-defined APIs.

                                                                                                                                                      Specialized
                                                                                                                                                      Each service is designed for a set of capabilities and focuses on solving a specific problem. If developers contribute more code to a service over time and the service becomes complex, it can be broken into smaller services.

                                                                                                                                                      Microservices are an architectural and organizational approach to software development where software is composed of small independent services that communicate over well-defined APIs. 


                                                                                                                                                      Monolithic vs. Microservices Architecture
                                                                                                                                                      With monolithic architectures, all processes are tightly coupled and run as a single service. This means that if one process of the application experiences a spike in demand, the entire architecture must be scaled
                                                                                                                                                      Monolithic architectures add risk for application availability because many dependent and tightly coupled processes increase the impact of a single process failure.
                                                                                                                                                      With a microservices architecture, an application is built as independent components that run each application process as a service.
                                                                                                                                                      These services communicate via a well-defined interface using lightweight APIs.

                                                                                                                                                      Containers
                                                                                                                                                      Amazon Elastic Container Service
                                                                                                                                                      A highly scalable, high-performance container management service that supports Docker containers and allows you to easily run applications on a managed cluster of Amazon EC2 instances.

                                                                                                                                                      Serverless
                                                                                                                                                      AWS Lambda
                                                                                                                                                      AWS Lambda lets you run code without provisioning or managing servers. Just upload your code and Lambda manages everything that is required to run and scale your code with high availability

                                                                                                                                                      https://aws.amazon.com/microservices/
                                                                                                                                                      • AWS Case Study: Coursera Moves to a Microservices-Based Architecture 
                                                                                                                                                      The Challenge
                                                                                                                                                      Coursera had a large monolithic application for processing batch jobs that was difficult to run, deploy, and scale.
                                                                                                                                                      A new thread was created whenever a new job needed to be completed, and each job took up different amounts of memory and CPU, continually creating inefficiencies.
                                                                                                                                                      A lack of resource isolation allowed memory-limit errors to bring down the entire application.
                                                                                                                                                      The infrastructure engineering team attempted to move to a microservices architecture using Docker containers, but they ran into problems as they tried to use Apache Mesos to manage the cluster and containers—Mesos was complicated to set up and Coursera didn’t have the expertise or time required to manage a Mesos cluster.

                                                                                                                                                      The Solution
                                                                                                                                                      Docker containers on Amazon EC2 Container Service (ECS) enabled Coursera to easily move to a microservices -based architecture.
                                                                                                                                                      Each job is created as a container and Amazon ECS schedules the container across the Amazon EC2 instance cluster.
                                                                                                                                                      Amazon ECS handles all the cluster management and container orchestration, and containers provide the necessary resource isolation.

                                                                                                                                                      The Benefits
                                                                                                                                                      Ease of use: Because Amazon ECS setup is straightforward and it manages all of the details of the cluster, the team had a prototype up and running in under two months.
                                                                                                                                                      Speed and agility: Time to deploy software changes went from hours to minutes, and each team can now develop and update its respective applications independently because the applications are resource isolated with no cross-dependencies.
                                                                                                                                                      Scalable capacity: Auto Scaling groups allow the compute capacity to scale up to handle dynamic job loads.
                                                                                                                                                      Operational efficiency: No extra infrastructure engineering time is spent installing software and maintaining a cluster—Amazon ECS handles everything from cluster management to container orchestration.

                                                                                                                                                      https://aws.amazon.com/solutions/case-studies/coursera-ecs/


                                                                                                                                                      • The Challenge
                                                                                                                                                      Supports pipeline with billions of data points uploaded every day from different mobile applications running Localytics analytics software.
                                                                                                                                                      Engineering team needed to access subsets of data for creating new services, but this led to additional capacity planning, utilization monitoring, and infrastructure management.
                                                                                                                                                      Platform team wanted to enable self-service for engineering teams.

                                                                                                                                                      The Solution
                                                                                                                                                      Uses AWS to send about 100 billion data points monthly through Elastic Load Balancing to Amazon Simple Queue Service, then to Amazon Elastic Compute Cloud, and finally into an Amazon Kinesis stream.
                                                                                                                                                      For each new feature of the marketing software, a new microservice using AWS Lambda is created to access the Amazon Kinesis data stream. Each microservice can access the data stream in parallel with others.

                                                                                                                                                      The Benefits
                                                                                                                                                      Decouples product engineering efforts from the platform analytics pipeline, enabling the creation of new microservices to access data stream without the need to be bundled with the main analytics application.
                                                                                                                                                      Eliminates the need to provision and manage infrastructure to run each microservice.
                                                                                                                                                      Lambda automatically scales up and down with load, processing tens of billions of data points monthly. 
                                                                                                                                                      Speeds time to market for new customer services, since each feature is a new microservice that can run and scale independently of every other microservice.
                                                                                                                                                      https://aws.amazon.com/solutions/case-studies/localytics/

                                                                                                                                                      • SOA
                                                                                                                                                      stands for Service Oriented Architecture -- refers to architectures designed with a focus on services
                                                                                                                                                      Web services
                                                                                                                                                      This accounts for the subset of SOA using web-related technologies. This typically involves HTTP and XML but it could also use FTP
                                                                                                                                                      REST(ful)
                                                                                                                                                      REST is a subset of web services -- and hence a SOA -- that revolves around using HTTP for communication
                                                                                                                                                      Microservices
                                                                                                                                                      promotes implementing applications as a set of simple independently deployable services.
                                                                                                                                                      https://stackoverflow.com/questions/27054162/what-are-rest-restful-soa-and-microservices-in-simple-terms

                                                                                                                                                      • What is Web Service?
                                                                                                                                                      Web Service is a way to expose the functionality of an application to other application, without a user interface. It is a service which exposes an API over HTTP.
                                                                                                                                                      Web Service is a connection technology, a way to connect services together into a Service Oriented Architecture (SOA).
                                                                                                                                                      What is Micro Service?
                                                                                                                                                      Micro Service is independently deployable service modeled around a business domain. It is a method of breaking large software applications into loosely coupled modules, in which each service runs a unique process and communicates through APIs. It can be developed using messaging or event-driven APIs, or using non-HTTP backed RPC mechanisms.
                                                                                                                                                      Micro Services are designed to cope with failure and breakdowns of large applications. Since multiple unique services are communicating together, it may happen that a particular service fails, but the overall larger applications remain unaffected by the failure of a single module.
                                                                                                                                                      https://www.tatvasoft.com/blog/the-difference-between-micro-services-and-web-services/



                                                                                                                                                      • Coarse-grained vs fine-grained
                                                                                                                                                      Granularity is the extent to which a system is broken down into small parts, either the system itself or its description or observation.
                                                                                                                                                      It is the extent to which a larger entity is subdivided.
                                                                                                                                                      For example, a yard broken into inches has finer granularity than a yard broken into feet.
                                                                                                                                                      1 Yard = 3 Feet=36 inches

                                                                                                                                                      Coarse-grained systems consist of fewer, larger components than fine-grained systems
                                                                                                                                                      Coarse-grained systems consist of fewer, larger components than fine-grained systems; a coarse-grained description of a system regards large subcomponents while a fine-grained description regards smaller components of which the larger ones are composed.

                                                                                                                                                      http://en.wikipedia.org/wiki/Granularity
                                                                                                                                                      An Introduction to Service-Oriented Architecture
                                                                                                                                                      SOA: approach to distributed software architecture(DSA) employing loosely coupled services

                                                                                                                                                      semantic web; web data which can be directly or indirectly processed by machines

                                                                                                                                                      cloud computing: internet computing which allows users on-demand access  to distributed services(on-demand means payable when requested or presented)

                                                                                                                                                      Enterprise Service Bus(ESB) is SOA implementation.
                                                                                                                                                      With ESB you can't make changes easily


                                                                                                                                                      what is service-oriented architecture SOA?
                                                                                                                                                      easy to assemble

                                                                                                                                                      easily reconfigurable
                                                                                                                                                      modularity, assemble the way you want by adding new blocks or old block or some else's blocks
                                                                                                                                                      make change easier
                                                                                                                                                      What is Service Oriented Architecture? SOA Introduction or Fundamentals
                                                                                                                                                      SOA is an architecture which defines links and integrates re-usable business services
                                                                                                                                                      • Oracle SOA Suite 11g, is an integrated, best-of-breed suite of products that helps you rapidly design and assemble, deploy and manage, highly agile and adaptable business applications.

                                                                                                                                                      http://www.oracle.com/us/technologies/soa/soa-suite/index.html
                                                                                                                                                      • What is a Web Service?

                                                                                                                                                      Java/J2EE interview questions:- What is Webservice?
                                                                                                                                                      1. To ensure interoperability, web service uses XML
                                                                                                                                                      2. Webservice is operating-system and programming language independent.
                                                                                                                                                      3. Webservice structure is divided into two parts: a service provider and service consumer
                                                                                                                                                      4. How does Webservice communicate? Service provider and service consumer communicates over SOAP protocol
                                                                                                                                                      5. UDDI is a directory service. To search available web services, UDDI is used.UDDI stores web service interfaces.
                                                                                                                                                      6. WSDL is used to locating and describing web service
                                                                                                                                                      • WS-Security
                                                                                                                                                      WS-Security (Web Services Security, short WSS) is a flexible and feature-rich extension to SOAP to apply security to web services
                                                                                                                                                      http://en.wikipedia.org/wiki/WS-Security

                                                                                                                                                      • Universal Description, Discovery, and Integration (UDDI) is a directory service where businesses can register and search for Web services.

                                                                                                                                                      UDDI is a platform-independent framework for describing services, discovering businesses, and integrating business services by using the Internet.

                                                                                                                                                      UDDI stands for Universal Description, Discovery, and Integration
                                                                                                                                                      UDDI is a directory for storing information about web services
                                                                                                                                                      UDDI is a directory of web service interfaces described by WSDL
                                                                                                                                                      UDDI communicates via SOAP
                                                                                                                                                      UDDI is built into the Microsoft .NET platform
                                                                                                                                                      http://www.w3schools.com/wsdl/wsdl_uddi.asp
                                                                                                                                                      In simple terms, a Web Service is an application or business logic that is accessible using standard Internet protocols.


                                                                                                                                                      • Web Service(WS) vs Remote Method Invocation(RMI) vs CORBA
                                                                                                                                                      1-Development
                                                                                                                                                      In fact the development processes are now very similar for all technologies.
                                                                                                                                                      One starts with an interface – such as IDL.
                                                                                                                                                      One generates a client stub and a base class for a server implementation.
                                                                                                                                                      There are slight differences in how the client stubs get generated – see rmi.
                                                                                                                                                      With WS, one actually has a choice –
                                                                                                                                                        define the WSDL and work down
                                                                                                                                                        start with a programmatic interface and generate WSDL and thence the client.

                                                                                                                                                      2-Coding
                                                                                                                                                      So there are no really differences in development costs, and other factors will determine which technology is picked.
                                                                                                                                                      Very similar for WS (JAXRPC), Java-RMI, CORBA (at least for stateless singleton server)
                                                                                                                                                      Client
                                                                                                                                                      Obtains proxy stub for remote service
                                                                                                                                                      ~6 lines of code, differing for implementation
                                                                                                                                                      Invokes operations via stub
                                                                                                                                                      Server
                                                                                                                                                      Implementation class
                                                                                                                                                      Instantiated in some “container”
                                                                                                                                                      Servlet engine, RMI-process, CORBA/POA framework


                                                                                                                                                      3-Tradeoffs
                                                                                                                                                      Interoperability is important for internet services where client organizations may choose a different technology.  Here, one might expect to choose web services
                                                                                                                                                      But what about in house intranet applications – could WS really compete with distributed objects.
                                                                                                                                                      Development mechanism, and code complexity essentially the same for all
                                                                                                                                                      Expected Tradeoffs
                                                                                                                                                      Supposed higher performance for RMI/CORBA
                                                                                                                                                      Greater interoperability for WebService

                                                                                                                                                      https://docs.google.com/presentation/d/1epMBZRc5DMdTmQLtaC6NHL6HKMQkg2HyIn-PWrMF4TM/edit#slide=id.p9
                                                                                                                                                      • The use of distributed computing technologies for problem-solving has been around for many years. The early paradigm of distributed computing has been that of remote procedure calls (RPC).
                                                                                                                                                      However, in recent years, this paradigm has shifted to the use of remote objects due to the acceptance of object-oriented programming practices.
                                                                                                                                                      Even today web services are built around the concept of messaging and frequently these messages take the form of request/response-type remote procedure calls on remote objects.

                                                                                                                                                      This paper focuses on three specific middleware standards for distributed computing, namely:
                                                                                                                                                      the Common Object Request Broker Architecture (CORBA),
                                                                                                                                                      Java’s Remote Method Invocation (RMI),
                                                                                                                                                      the more recent web services technology, frequently based on XML data encoding and SOAP -based messaging protocols.


                                                                                                                                                      The three middleware standards we have selected all have certain commonalities.
                                                                                                                                                      All are based on the concept of a client application using the services available on a remote machine, or server.
                                                                                                                                                      A remote executable object that implements one or more exposed interfaces provides these services.
                                                                                                                                                      The object’s interface represents a contract between the client and the server.
                                                                                                                                                      This interface is written as a Java interface for Java RMI, in IDL for CORBA, and in WSDL for web services.
                                                                                                                                                      In the latter two cases, the more generic descriptions can be translated into specific language implementations, although a standard
                                                                                                                                                      translation of WSDL into a wide variety of languages is still being developed.

                                                                                                                                                      All three technologies also contain the notion that a client application need not know the exact network
                                                                                                                                                      location of an object prior to runtime.
                                                                                                                                                      A ‘discovery’ process exists (with varying levels of sophistication) to enable the client to obtain a handle to an object that implements a particular desired interface.
                                                                                                                                                      This discovery takes the form of a Naming Registry or Service in Java RMI and CORBA, and WSDL repositories or UDDI in Web Services.


                                                                                                                                                      Due to Java’s inherent platform-independent capabilities, RMI-based applications are capable of running on a wide variety of computing platforms.
                                                                                                                                                      This represents both a strength and weakness of Java RMI, however.
                                                                                                                                                      The weakness is due to RMI’s the heavy reliance on Java and lack of direct support for other common languages, such as C or C++.

                                                                                                                                                      CORBA  chose a new interface description language, known as the IDL, for defining its object interfaces.
                                                                                                                                                      This intermediate language can then be used to translate to/from a variety of different languages, such as C, C++, and Java.
                                                                                                                                                      This makes CORBA more suited toward integration with legacy systems written in languages created before Java, in that it is
                                                                                                                                                      language agnostic.


                                                                                                                                                      The exact definition of a web service can be viewed as a collection of methods (with hidden implementations) that can be discovered and invoked by a client application.
                                                                                                                                                      The network wire protocols used in Web Services are typically XML-based and ride on a network protocol such as HTTP, HTTPS, SMTP, et al.
                                                                                                                                                      A protocol known as SOAP is currently in use for describing the messages sent to/from web services and is itself an application of XML.
                                                                                                                                                      Web services are language agnostic, much like CORBA, in that the interfaces are described in WSDL, which, like IDL, is independent of any one particular
                                                                                                                                                      computing language.

                                                                                                                                                      https://docs.google.com/viewer?a=v&q=cache:FsvUkZ8XqXcJ:www.ll.mit.edu/HPEC/agendas/proc02/abstracts/hanes.pdf+&hl=en&pid=bl&srcid=ADGEESg9WoUbszreHHLrlvYjXmDG29KUUYgCpf-GB3itTAFJnPjncZPLEjRzaGzFxCxjmd_CnBIb6iufB9z-kVQKCCon1gyND0uZE45UTaktK5ipa9IeUIJo7uv_lCRtim9zRtXqeRyd&sig=AHIEtbQa6pt6g-_q-fIVtIKSU5kwo3IRxA
                                                                                                                                                      • Between EJB and web services, web services would give you more portability if you want to be able to call them from non-java apps in the future. EJB again gives you things like transaction management and pooling that you might not get "out of the box" with web services
                                                                                                                                                      If you need the ability to call the objects from a non-java app, you can always front your EJBs with simple web service proxies as needed.


                                                                                                                                                      Web services are great in theory, but there are some gotchas that you need to watch out for:
                                                                                                                                                      Latency. Fowler's first law of distributed objects: "Don't!" An architecture consisting of lots of fine-grained distributed SOAP services will be elegant, beautiful, and slow as molasses. Think carefully before distributing.
                                                                                                                                                      Marshaling from XML to objects and back consumes CPU cycles that aren't providing any business value besides allowing your clients to speak a platform-agnostic protocol.
                                                                                                                                                      SOAP is a standard that is becoming more bloated and complex every day, but it has lots of tool support. Vendors like it because it helps drive sales of ESBs. REST is simple but not as well understood. It's not supported by tools.


                                                                                                                                                       If your backend servers are not going to be exposed publicly, then you are not getting any benefit from using platform independent web service interfaces such as SOAP/REST.

                                                                                                                                                      http://stackoverflow.com/questions/2013793/web-services-vs-ejb-vs-rmi-advantages-and-disadvantages
                                                                                                                                                      • the web services do allow a loosely coupled architecture. 

                                                                                                                                                      With RMI, you have to make sure that the objects stay in sync in all applications, which means that you always have to deploy both of them at the same time even if only one of them is changed (not necessarily, but it is required quite often because of serial UUIDs

                                                                                                                                                      http://stackoverflow.com/questions/100993/rmi-vs-web-services-whats-best-for-java2java-remoting


                                                                                                                                                      • In distributed computing, distributed objects are objects (in the sense of object-oriented programming) that are distributed across different address spaces, either in different processes on the same computer, or even in multiple computers connected via a network, but which work together by sharing data and invoking methods.
                                                                                                                                                      Examples
                                                                                                                                                      The RPC facilities of the cross-platform serialization protocol, Cap'n Proto amount to a distributed object protocol. Distributed object method calls can be executed(chained, in a single network request, if needs be) through interface references/capabilities

                                                                                                                                                      Distributed objects are implemented in Objective-C using the Cocoa API with the NSConnection class and supporting objects.
                                                                                                                                                      Distributed objects are used in Java RMI.
                                                                                                                                                      CORBA lets one build distributed mixed object systems.
                                                                                                                                                      DCOM is a framework for distributed objects on the Microsoft platform.
                                                                                                                                                      DDObjects is a framework for distributed objects using Borland Delphi.
                                                                                                                                                      Jt is a framework for distributed components using a messaging paradigm.
                                                                                                                                                      JavaSpaces is a Sun specification for a distributed, shared memory (space-based)
                                                                                                                                                      Pyro is a framework for distributed objects using the Python programming language.
                                                                                                                                                      Distributed Ruby (DRb) is a framework for distributed objects using the Ruby programming language.
                                                                                                                                                      https://en.wikipedia.org/wiki/Distributed_object
                                                                                                                                                      • Apache CXF™ is an open source services framework. CXF helps you build and develop services using frontend programming APIs, like JAX-WS and JAX-RS. These services can speak a variety of protocols such as SOAP, XML/HTTP, RESTful HTTP, or CORBA and work over a variety of transports such as HTTP, JMS or JBI.

                                                                                                                                                      http://cxf.apache.org/

                                                                                                                                                      Introduction to Web Services
                                                                                                                                                      Web service is an implementation of services oriented architecture(SOA)



                                                                                                                                                      Web services and its benefits
                                                                                                                                                      1. a standardized way of integrating web applications
                                                                                                                                                      2. XML based message communication
                                                                                                                                                      3. hardware platform independent
                                                                                                                                                      4. programming language independent
                                                                                                                                                      5. operating system independent
                                                                                                                                                      6. web service server(provider) code and web service client(consumer) code can be written in any programming language like PHP java c# etc
                                                                                                                                                      7. service provider publishes web service in WSDL into UDDI. service consumer issues a request into UDDI to locate web service WSDL.
                                                                                                                                                      8. Benefits:1-application and data integration 2-code re-use 3-cost savings 
                                                                                                                                                      9. web services are deployed on j2ee containers

                                                                                                                                                      • What is SOAP?


                                                                                                                                                      SOAP, originally defined as Simple Object Access Protocol, is a protocol specification for exchanging structured information in the implementation of Web Services in computer networks.
                                                                                                                                                      It relies on Extensible Markup Language (XML) for its message format, and usually relies on other Application Layer protocols, most notably Hypertext Transfer Protocol (HTTP) and Simple Mail Transfer Protocol (SMTP), for message negotiation and transmission


                                                                                                                                                      SOAP also has some advantages:

                                                                                                                                                      Easy to consume - sometimes
                                                                                                                                                      Rigid - type checking, adheres to a contract
                                                                                                                                                      Development tools

                                                                                                                                                      Reference:
                                                                                                                                                      http://www.coderanch.com/how-to/java/WebServicesFaq
                                                                                                                                                      http://www.petefreitag.com/item/431.cfm
                                                                                                                                                      http://en.wikipedia.org/wiki/SOAP
                                                                                                                                                      http://en.wikipedia.org/wiki/Representational_State_Transfer

                                                                                                                                                      The acronym REST stands for Representational State Transfer, this basically means that each unique URL is a representation of some object.

                                                                                                                                                      You can get the contents of that object using an HTTP GET, to delete it, you then might use a POST, PUT, or DELETE to modify the object (in practice most of the services use a POST for this).

                                                                                                                                                      Representational state transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web.

                                                                                                                                                      RESTful web services
                                                                                                                                                      A RESTful web service (also called a RESTful web API) is a simple web service implemented using HTTP and the principles of REST.

                                                                                                                                                      It is a collection of resources, with four defined aspects:
                                                                                                                                                      1. the base URI for the web service, such as http://example.com/resources/
                                                                                                                                                      2. the Internet media type of the data supported by the web service. This is often JSON, XML or YAML but can be any other valid Internet media type.
                                                                                                                                                      3. the set of operations supported by the web service using HTTP methods (e.g., GET, PUT, POST, or DELETE).
                                                                                                                                                      4. The API must be hypertext driven.
                                                                                                                                                      the main advantages of REST web services are

                                                                                                                                                        1. Lightweight - not a lot of extra xml markup
                                                                                                                                                        2. Human Readable Results
                                                                                                                                                        3. Easy to build - no toolkits required
                                                                                                                                                        What is REST Representational state transfer ) ?


                                                                                                                                                        Web fundamentals that REST uses
                                                                                                                                                        1-http protocol
                                                                                                                                                        2-http protocol has methods like get/post/delete
                                                                                                                                                        3-http protocol is stateless
                                                                                                                                                        4-URI,by which you can locate any source on the web

                                                                                                                                                        all web resources are shown by URIs
                                                                                                                                                        • SOAP vs REST
                                                                                                                                                        Compared to SOAP, REST is a lighter-weight and less feature-rich approach to building web services.
                                                                                                                                                        As such, it does not support the infrastructure built on top of SOAP (like WSDL, UDDI, and WS-Security).
                                                                                                                                                        JAX-WS supports a limited kind of REST API.


                                                                                                                                                        • RESTEasy
                                                                                                                                                        RESTEasy is a JBoss project that provides various frameworks to help you build RESTful Web Services and RESTful Java applications. It is a fully certified and portable implementation of the JAX-RS specification. JAX-RS is a new JCP specification that provides a Java API for RESTful Web Services over the HTTP protocol.
                                                                                                                                                        http://www.jboss.org/resteasy

                                                                                                                                                        • SOAP and REST are two API styles that approach the question of data transmission from a different point of view. 

                                                                                                                                                        What does REST stand for?
                                                                                                                                                        REST stands for Representational State Transfer. It’s an architectural style that defines a set of recommendations for designing loosely coupled applications that use the HTTP protocol for data transmission. REST doesn’t prescribe how to implement the principles at a lower level. Instead, the REST guidelines allow developers to implement the details according to their own needs. Web services built following the REST architectural style are called RESTful web services.
                                                                                                                                                        What’s the main reason to use REST?
                                                                                                                                                        In 2018, REST was the most popular choice of developers to build public APIs. You can find many examples all over the internet, especially since all big social media sites provide REST APIs so that developers can seamlessly integrate their apps with the platform.
                                                                                                                                                        REST and JSON
                                                                                                                                                        The REST architecture allows API providers to deliver data in multiple formats such as plain text, HTML, XML, YAML, and JSON, which is one of its most loved features.
                                                                                                                                                        JSON stands for JavaScript Object Notation. It’s an easy-to-parse and lightweight data-interchange format. In spite of its name, JSON is completely language-agnostic, so it can be used with any programming language, not just JavaScript
                                                                                                                                                        https://raygun.com/blog/soap-vs-rest-vs-json/
                                                                                                                                                        • SOAP vs REST



                                                                                                                                                        REST:

                                                                                                                                                        1. exposes RESOURCES which represent DATA
                                                                                                                                                        2. point-to-point communication over HTTP
                                                                                                                                                        3. supports multiple data formats(not just xml)
                                                                                                                                                        4. emphasizes stateless communication
                                                                                                                                                        5. uses HTTP GET/POST/DELETE


                                                                                                                                                        SOAP:

                                                                                                                                                        1. exposes OPERATIONS which represent LOGIC
                                                                                                                                                        2. loosely coupled distributed messaging
                                                                                                                                                        3. supports only XML
                                                                                                                                                        4. stateful and stateless/conversational communication
                                                                                                                                                        5. strong typing
                                                                                                                                                        6. supports asynchronous messaging
                                                                                                                                                        7. uses HTTP post



                                                                                                                                                        REST IS BETTER THAN SOAP

                                                                                                                                                        1. can be consumed by a web browser with javascript or ajax
                                                                                                                                                        2. lightweight(doesnot require xml parsing and SOAP header for every message thus requires less bandwidht)



                                                                                                                                                        SOAP IS BETTER THAN REST

                                                                                                                                                        1. rest only supports http/https thus there's no asynchronous messaging. Because HTTP is synchronous communication.
                                                                                                                                                        2. rest is not secure as parameters are part of URI
                                                                                                                                                        3. rest can't be governed as there is not service registry thus you have no idea who's consuming services



                                                                                                                                                        rest and soap can co-exist

                                                                                                                                                        REST GOOD FOR

                                                                                                                                                        1. webservices
                                                                                                                                                        2. exposing data over internet
                                                                                                                                                        3. limited bandwitdh(small sized data) and resources(no xml parsing)
                                                                                                                                                        4. combining content from many different sources on a web browser


                                                                                                                                                        SOAP GOOD FOR

                                                                                                                                                        1. enterprise services
                                                                                                                                                        2. asynchronous messaging
                                                                                                                                                        3. stateful/conversational operations
                                                                                                                                                        • What are the differences between JAX-RPC, JAX-WS, JAX-RS, Apache Axis, SAAJ, Apache SOAP, JWSDP, Metro, Jersey, and GlassFish?


                                                                                                                                                        JAX-RPC is a specification/API for Java developers to develop SOAP based interoperable web services. This API is now obsolete and may be dropped from the next JEEversion.

                                                                                                                                                        JAX-WS is the successor to JAX-RPC. It requires Java 5.0, and is not backward-compatible to JAX-RPC.

                                                                                                                                                        SAAJ is another specification/API for using SOAP envelopes with or without attachments. It operates on a lower level than JAX-RPC or JAX-WS, both of which will useSOAP envelopes based on SAAJ if needed.

                                                                                                                                                        Apache Axis is an open source implementation of the Java WS APIs for sending and receiving SOAP messages. Axis 1 supports JAX-RPC and SAAJ, while Axis 2 supports SAAJ and JAX-WS.

                                                                                                                                                        Apache SOAP was the first SOAP implementation. It is now obsolete. It's better to use Apache Axis to avail oneself of the latest features.

                                                                                                                                                        Sun JWSDP - Sun Java Webservices Developer Pack, is an implementation of JAX-RPC, SAAJ, and various other XML Java technologies. It is now deprecated in favor of the Metro stack.

                                                                                                                                                        GlassFish is the open source reference implementation of J2EE 5. As such, it contains an implementation of JAX-WS.

                                                                                                                                                        Metro is the web services stack used in GlassFish. It supports SAAJ, JAX-WS, WS-Security and other standards.

                                                                                                                                                        JAX-RS is a Java API for RESTful web services.

                                                                                                                                                        Jersey is the reference implementation of the JAX-RS API, as defined in the JSR-311 standard for RESTful web services.

                                                                                                                                                        • The WebSocket specification—developed as part of the HTML5 initiative—introduced the WebSocket JavaScript interface, which defines a full-duplex single socket connection over which messages can be sent between client and server. 
                                                                                                                                                        The WebSocket standard simplifies much of the complexity around bi-directional web communication and connection management.
                                                                                                                                                        http://www.websocket.org/

                                                                                                                                                        • Web Sockets
                                                                                                                                                        Web Sockets is a next-generation bidirectional communication technology for web applications which operates over a single socket and is exposed via a JavaScript interface in HTML 5 compliant browsers.
                                                                                                                                                        Once you get a Web Socket connection with the web server, you can send data from browser to server by calling a send() method, and receive data from server to browser by an onmessage event handler.
                                                                                                                                                        http://www.tutorialspoint.com/html5/html5_websocket.htm
                                                                                                                                                        WebSockets (using Socket.io) Tutorial #1 - What Are WebSockets?

                                                                                                                                                        What are WebSockets | How is it different from HTTP?
                                                                                                                                                        • Difference between WebSocket vs REST

                                                                                                                                                        WebSocket is a communication protocol over a TCP connection, which provides point-to-point communication system
                                                                                                                                                        REST i.e. Representational State Transfer, defines a set of constraints to be utilized for creating web services. It is one of the architectural styles, to create REST endpoints using HTTP in a web application. RESTful endpoints are being called, which would invoke APIs that too are RESTful in nature and giving an HTTP response. A request would originate from the client with the HTTP verbs i.e. Get, Post, Put, Delete. They react to the expected set of operations, receive the data, update the data or can delete the data depending upon the verb.
                                                                                                                                                        Operations with REST are standard, and stateless in nature, which actually makes any system which is RESTful, fast performer, reliable and at the same time, his ability to grow. REST can be cited as one of the standard ways of designing the APIs for the request.
                                                                                                                                                        https://www.educba.com/websocket-vs-rest/

                                                                                                                                                        • REST api vs REST Webservice vs RESTFul web service

                                                                                                                                                        REST API = RESTful API
                                                                                                                                                        REST Web service = RESTful Web service
                                                                                                                                                        A RESTful web service is the implementation of the REST API (Application Programmable Interface) or the REST spec.
                                                                                                                                                        https://stackoverflow.com/questions/33796975/rest-api-vs-rest-webservice-vs-restful-web-service


                                                                                                                                                        • Difference Between API and Web Service

                                                                                                                                                        API and Web service serve as a means of communication. The only difference is that a Web service facilitates interaction between two machines over a network. An API acts as an interface between two different applications so that they can communicate with each other
                                                                                                                                                        https://medium.com/@programmerasi/difference-between-api-and-web-service-73c873573c9d

                                                                                                                                                        8 comments: