Case 1: When we have to do Callout



The above diagram shows how data flow from Salesforce to any other system. Where as what we want from system B to integrate with our Salesforce system.


Case 2: When we have to receive data from System B and exposing our web service class and URL





The above diagram represents when data is coming from any other system in the form of JSON/XML and where salesforce is the target/receiver. In this we have to create connected app and needs to provide the credentials, username, passwords etc to System B.