Skip to main content

NeedOfWebservice Usecase


àNeed Of Distibuted Tech UseCase:
àCredicard issuing and bill generation process:
-Assume after issueing the the credit cards bill generation will be at 2-dates either at 10nth or 22nd irrespective of the payment date by the customer.
-Assume there are 1-million credit card customers are there for a bank. If the bank wants to generate the bill for all the customers at 12 A.M of each and every term/cycle of the month.
-Assume for one customer bill generation time will be 1-sec.
For 1-mmilon customers = 1-million sec
i.e approximately 278 hours = 12 days. Which is time taking process due to which another cycle/term will come due to this there is a sevieor loss for bank. Hence inorder to coplete the bill generation before specified time we need to go for distributed tech, which makes the bill generation much faster.
-Hence distribute the task among multiple 15-resources by dividing into multiple independent tasks we can complete this bill generation with in 8-hors of time.


àNeed Of WebService(UseCase):
-There is a website called irctc.co.in which developed an application allows to book tickets through online, and it allows to book tickets by including partners as a part of business. So the tickets can booked not only in the irctc, we can even book tickets either one of three sites.
-But here makemytrip.com and yatra.com are not the original business owners they just partners.
-If a person books a ticket using either makemytrip / yatra all the details should store in irctc-DB bcz it is the owner of the business.
I.     Hence in order to store the details in irctc-DB table, irctc need to provide the DB-environment details driver, URL, username, password.
Problems if irctc provides DB-details to business partners:
-Security will not there /Encounter with Security Bridge /lack of security.
-These business partners may misuse the data of irctc.
Hence we should not give the DB-environment details to business partners.
II.     If application developed by irctc then if irctc allows to all the partners also need to implement the same application by their own as per the conditions that are given by irctc, which is complicated hence business people will not show interest to do this.
III.     Always business is not a static and it may changes from time to time.
I.e. assume we are booking a ticket on exactly 3-days before of exact journey.
At later point of time it may reduce to 1-day before hence we need add/change the code in irctc.co.in due to which business partners also need to change the business logic as per the irctc
-which making business partner to spend more cost on developing rather than getting the profits.
-If implemented also there is no guarantee that code is written by the business people is valid/ suites for the business of irctc, hence irctc need to involve in developing / testing time to educate the business people about  the business and schema-model which is more complicated and there will be an security bridge.
-Hence we should not allow to write the code by all the business partners.
IV.     In order to stop to others create / develop the code by their own implementations we need give the source/class files to the business people to read and to book the ticket.
If we provide the source /class file data to business people there also security problems will may raise bcz we are providing entire source/class file due to which irctc may go into distraction.
Hence in order to avoid these problems we need write business logic and its related DB-details with constraints (security conditions) with in the method and by to share the same obj over the n/w which is called as distribute tech.
Distributed tech obj can expose and communicate with java obj only. i.e by using either Rmi /Ejb.
In order to communicate irrespective of platform /language we need interoperable distributed tech called as Web Services.
-Without giving the DB-details and source code to the business patrners (makemytrip / yatra.com) we can reserve the tickets by calling the method reserve (...) through the reference. But to get the reference of the obj we didn’t provided any class for to create the obj. hence we need to share the obj to all the business peoples to communicate and to access the methods. But obj life will be active state within the JVM-only, once if it is comes out from JVM-its will not live. But we need this obj even outside of the JVM-also which is possible by distributed tech only by exposing the obj over the n/w and with this obj any one can call methods. If we reserve the tickets by calling the reserve (...) then this method will be executed within the itctc machine but not in the partners machine bcz partners machine doesn’t contains any contain logic / method and it calling the irctc methods hence these methods will executed within the irctc JVM and connects with irctc DB. Note that here method is already talking to the DB in irctc hence it will store the details easily without any url / username /password.
And it can fetch the data by calling corresponding methods through the obj.
Hence if any business logic changes in the irctc it will not effects the makemytrip / yatra.com.

Examples:
-Smart Refrigerators:
Which will detects weight/threshold level of the items in the Refrigerator and it can sends a req to the super market asking to deliver the things which are over/less quantity. Here may be source and destination appl may be any platform or any language hence we use web services here.
-Car Fuel Guiding by Showing petrol Bunks which are near:
Here a Car fuel based web service which is running in the car will detects the fuel quantity and alerts the car driver there is limited fuel you need fill the fuel immediately, and it shows near petrol bunks which are highly rated.

World Clock Timer:
Every timer will talks to the world clock timer to identify the time-zone and timing standards of corresponding countries.
Web Services:
Connecting two/more desperate heterogeneous systems which meant for performing same operation (task) over the n/w and integrating their responses using Interoperable distributed tech called as Web Services.
àDifference b/w the Web Service and the Web Appl /Servlet:
-Web Appl will gives/expose the data in the form Web-semantics (web page format) but not in the obj format. Web Appl is not a distributed tech it is a web tech where it can accessed by anywhere around the world.
-Web Services is distributed tech which can expose the data in the form of complicated business obj over the n/w but not in the form of web-semantics.
Use Case:
-Let us assume Flipkart doing the business all over the India very successfully, they wanted to explore the business throughout the geographical area/ world.
-Let us take flip-kart wants to explore the business in china but in china there is an popular site like flip-kart is present which is 'eBuy'. Hence china people will never trust the flip-kart bcz it as an new site for the chinies. But flip-kart wants to their products in china then they will talk with 'eBuy' to do business as a partner. But 'eBuy' will not accept this bcz it is alredy popular in china. Then Flip-kart said to 'eBuy' you don’t sell my goods with my name, you can sell my goods with your name so, that people will feel goods are belongs to your site only, in this way I can explore my business in china and take 50% profit on solded goods so, that both we can benifited. So 'eBuy' accepted for this terms and conditions to do business to gether. Now flipkart will need to give the business obj but not the webpage of the flip-kart. Hence in order to expose the goods details of the flip-kart that are requested by the 'eBuy', flip-kart need to give the business obj (product name, price, quantity, warrantee etc details) to the 'eBuy'.
-Now 'eBuy' will takes that product details and may add additional things like increasing price etc then they will display on their own 'eBuy' site page then it will be solded.
So, in order to expose the business obj over the n/w we need an interoperable distributed tech called as "Web Services" bcz here 'eBuy' or filp-kart may develops the appl using different languages/ different platforms.

Comments

Popular posts from this blog

Mockito interview Questions

1.       Question 1. What Is Mockito? Answer : Mockito allows creation of mock object for the purpose of Test Driven Development and Behavior Driven development. Unlike creating actual object, Mockito allows creation of fake object (external dependencies) which allows it to give consistent results to a given invocation. 2.       Question 2. Why Do We Need Mockito? What Are The Advantages? Answer : Mockito differentiates itself from the other testing framework by removing the expectation beforehand. So, by doing this, it reduces the coupling. Most of the testing framework works on the "expect-run-verify". Mockito allows it to make it "run-verify" framework. Mockito also provides annotation which allows to reduce the boilerplate code. 3.       Question 3. Can You Explain A Mockito Framework? Answer : In Mockito, you always check a particular class. The dependency in that class is injected using m...

JAVA Expert Interview Questions Answers 2017

Java Basics ::  Interview Questions and Answers Home  »  Interview Questions  »  Technical Interview  »  Java Basics  » Interview Questions 1.     What is the difference between a constructor and a method? A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator. A method is an ordinary member function of a class. It has its own name, a return type (which may be void), and is invoked using the dot operator. 2.     What is the purpose of garbage collection in Java, and when is it used? The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused. A Java object is subject to garbage collection when it becomes unreachable to the program in which it is used. 3.  ...

Java Example Program to Convert List to Set

import java.util.ArrayList; import java.util.HashSet; import java.util.Set; public class ListToSet {  /**   * @author Amarjit Kumar   * @category interview questions   *   * Description: Convert List to set in java with example program   *   */  public static void main(String[] args) {   ArrayList<String> arrList= new ArrayList<>();   arrList.add("Java");   arrList.add("Java");   arrList.add("List to String");   arrList.add("Example Program");   Set<String> strSet = new HashSet<String>(arrList);   System.out.println(strSet);   System.out.println(arrList);  } } /*  * Java program to convert list to set. Convert ArrayList of string to HashSet  * in java example program How to convert List to Set in java Set<String> strSet  * = new HashSet<String>(arrList); HashSet having a constructor which will take  * list as an ar...