SalesForce API in Cloud Computing and Integration

Integration

Exchanging data between distinct applications in a heterogeneous environment ?

Distinct applications

Integrate With Anything
Force.com dramatically reduces the effort to integrate with either on–premises applications like Microsoft, ORACLE, SAP or other third–party solutions and external cloud services such as Amazon web services, Facebook, Google app engine, and twitter. More than half of the traffic on the force.com platform is system–to–system integration, making it the most trusted and successful enterprise API in the market.

Integration can be done in two ways:
1.Tight coupling
2.Loose coupling
APP1 < === IF 1 2 === > APP2}

APP1 < === IF 1 3 = = = > APP3}
For every integration , an explicit interface is developed

N( N-1 )/2

Eg: 10 APP’s à 10 (10-1) /2 = 45 interfaces are developed

Loose Coupling:
One interface –> Connected to the all applications
1 interface n spoke architecture N applications
For this, there are various exclusive s/s’s

TIBCO
WEB METHOD
XI
PEGA
–>Exclusive s/w’s are very expressive

We use web services —> (less expressive)
Tight Coupling

Web services are set of standards that are used to implement interoperability
Interoperability means app’s which are working on one flat form

Web services will set standards
App’s will follow standards, they will communicate with each other
Web services ? no server here
? To define standards, there are three ways
1.UDDI : Universal Descriptions Discovery & Integrations
2.SOAP : Simple Object Access Protocol
3.WSDL : Web Service Description Language

  1. UDDI

It is a place of storage
Similar to URL
2) SOAP

An object which carries the data across the app’s and also has well defined rules, which are present in the protocol
3) WSDL

To access the Force.com web service , you need a Web Service Description Language File (WSDL)
The structure of the data is defined in the WSDL
Web services are transported over HTTP
Even if WSDL is missing data directory can be transported over HTTP

Live Ex:
UDDI → shop (recharge)

WSDL → give explanation about the services it offers

SOAP → performs the service

Java → J2EE specification (Sun Microsystems)

J2EE server API → EJB

JVM specification → J2EE API

.Net → frame work
Web service → specification à API
Salesforce API
Provides access to web services ,
Web services have to support 3 API

→ SOAP API is used for cross platform to integrate organization’s data with other applications

→ Restful API is used for a small amount of data

→ Bulk API is used for large volumes of data (unlimited)

Data loader → implemented through the bulk API
In APEX we will be using SOAP API
DML → list → sending (or) putting data
List = SOQL → retrieving
Class
{
Data members
Web service static methods () {
DML list
List = SOQL
}
Global class WS test {
Integer NUM 1;
Integer NUM 2;
Web service void set values (integer n1, integer n2) {
Integer NUM 1 = n1;
Integer NUM 2 = n2;
}
Web service static integer getnum1 ()
{
Return NUM 1;
}
Web service static integer gets NUM 2 ()
{
Return num2;
}
→ Click on generate WSDL
→ Save it in the XML format on the desktop
→ Then go to Apex classes , click on generate from WSDL
→ Click on parse WSDL
→ Now, you can change the name as follows:

Eg: WS test Inbound.Test
→ Generate Apex code
→ Then click on system log
→ Click on execute inner class
→ WS test In bound. Ws test. Stub = new

To level class Ws test Inbound. WS test ();

Stub. Getnum1 ();

System.debug(‘num1 is ‘ + num1);

Stub.getnum2 ();

System.debug(‘num2 is ‘ +num2);

}

→ Apex web services are of two kinds

Inbound
Outbound
Inbound means it accepts data and places it in the DB
Outbound means sending data from the DB

Apex → generate WSDL → Export
WSDL contains something called meta data which gives complete information about the class and also helps in associating S objects
There are two more WSDL’s associated with SFDC

Enterprise WSDL:
This contains complete information about the SFDC data model

All S objects
Strongly typed
There are 3 fields say integer, decimal, string in EWSDL
Partner WSDL :

Same as enterprise WSDL
Loosely typed
PWSDL has only one string
Whenever a data model is modified while changing the structure of S object, partner WSDL will get updated automatically, whereas EWSDL has to be generated again.
We can generate directory PWSDL & EWSDL
Parse XML:

Checking the structure (verification)

Parse XML is used to verify a WSDL, whether it is properly structured or not.
Render XML:

Creating the structure (generate)

Render xml creates an XML file against the speared structure
(Structure → structure of the data model)
SF has something called meta data which describes the structure of the force.com
→ There exist 6 categories of classes in the force.com

Wrapper class
Collection class -->list → set → map
Exception class
Enum class
System class
Primitive class → Blob
Wrapper Classes:
Classes which can be used as data types

They hold only a single value
‘Subject’ is not a wrapper class

Enum Classes:
Enum status = (married, unmarried, divorced, widow)

Programmers have to define and assign data type whole variables which were declared by Enum only.
Winter’12:

We generally have a property called JASON
JASON is a format in which we shall store the objects
Serializable → converting object into file storage
DeSerializable