Integration Methods:
It consists of five types of integration
1. SOAP
2. REST API
3. HTTP Callouts
4. Future Callouts
5. Batch Callouts
these are the major areas in salesforce where an integration involves most of the time.
1.SOAP(Simple object access protocal) -
handle with heavy/bulk data, heavy weight protocol - it is used in standalone systems like SQL SERVER, SAP, MYSQL
2.REST(Representational state transfer) API(Application program interface) -
handle with lesser data, light weight protocol - generally we are using in mobile related applications we can use this
REST API intergration
3.HTTP Callouts - which is the part of REST integrations, as we send request to third party systems we will get response from
third party systems which we will use HTTP callouts without authentication parameters but in REST API we will use both
(HTTP allouts + authentication parameters).
SOAP :
->In this above example, we consider two systems one is source/ service systems and another one is client or target system.
->So this target system can be any system assume that it can be SQL server, My sql, SAP, DB2 etc, but we are the force.com developers that's why i consider both the systems as a salesforce org.
-> My requirement is when i create a record in target org then same record must be created in source org.
Key areas:
1. Apex webservices
2. WSDL - webservice description language
3. partner WSDL and enterprise WSDL
WSDL - webservice description language :- If integration is done between two systems using an WSDL file then it is SAOP integration, in salesforce we use partner WSDL and enterprise WSDL
Steps in source :
1. Generate the partner WSDL.
2. To call this organization as a source we have to write the apex webservice class, where we can pass the parameters after the connection.
3. We need to pass the user credentials like username, password and security token for connection
Syntax to declare apex web services :
Global class classname {
webservice static returntype methodname(parameters){
//logic
}
}
-> My requirement is when i create a record in target org then same record must be created in source org. so we need to create apex web service class, we will declare the parameters in source org and assign values to that paramaeters in target org. so that we will create the same record in source org as well
Global class Accountservice{
webservice static string createcustomer(String Name, String Phone, String City){
Account acc = new Account();
acc.name = Name;
acc.phone = Phone;
acc.Billingcity = City;
Insert acc;
if(acc.id !=null)
{
return 'success';
}
else{
return 'failure';
}
}
}
so we can not use directly this web service class, we have to convert this webservice to WSDL, for this we have to click on generate WSDL button on apex class in salesforce.
After converting into WSDL from webservice class we will get a XML format file, from this we will get class name, URL, Operation(method name), parameters.
Steps in Target :
1. Consume both partner WSDL and webservice WSDL/ Generate apex classes for both partner WSDL and webservice WSDL, from this classes we can take the end point URL from both WSDL's
2. Remote site settings configuration - we can take the end point URL from both the apex classes generate from partner WSDL and webservice WSDL and save these URL's in remote site settings.
-> partner WSDL - Generate apex class gives - end point URL which will helps you for connection to source org.
-> webservice WSDL - Generate apex class gives - end point URL which will helps you for connection to webservice apex class.
It consists of five types of integration
1. SOAP
2. REST API
3. HTTP Callouts
4. Future Callouts
5. Batch Callouts
these are the major areas in salesforce where an integration involves most of the time.
1.SOAP(Simple object access protocal) -
handle with heavy/bulk data, heavy weight protocol - it is used in standalone systems like SQL SERVER, SAP, MYSQL
2.REST(Representational state transfer) API(Application program interface) -
handle with lesser data, light weight protocol - generally we are using in mobile related applications we can use this
REST API intergration
3.HTTP Callouts - which is the part of REST integrations, as we send request to third party systems we will get response from
third party systems which we will use HTTP callouts without authentication parameters but in REST API we will use both
(HTTP allouts + authentication parameters).
SOAP :
->In this above example, we consider two systems one is source/ service systems and another one is client or target system.
->So this target system can be any system assume that it can be SQL server, My sql, SAP, DB2 etc, but we are the force.com developers that's why i consider both the systems as a salesforce org.
-> My requirement is when i create a record in target org then same record must be created in source org.
Key areas:
1. Apex webservices
2. WSDL - webservice description language
3. partner WSDL and enterprise WSDL
WSDL - webservice description language :- If integration is done between two systems using an WSDL file then it is SAOP integration, in salesforce we use partner WSDL and enterprise WSDL
Enterprise WSDL
A strongly typed WSDL for customers who want to build an integration with their salesforce.com organization only.
It is a strongly typed WSDL which means its depends on the schema, schema is nothing but metadata that is it always depends on the structure of the data in it like objects, records, fields etc, when we use the enterprise WSDL as connection for integration between two systems and it is static WSDL, if in future if we want to change or modify the data like objects, records , fields in salesforce, this new data will not add to the enterprise WSDL, so we need to again create enterprise WSDL and connection b/w two systems for integration.for this drawback 90% of systems uses partner WSDL for integration
Partner WSDL
A loosely typed WSDL for customers, partners, and ISVs who are building client applications for multiple organizations. It can be used to access data within any organization.
partner WSDL is a dynamic WSDL it doesn't depends on schema/metadata, it always uses the authentication parameters for connection b/w two systems for integration.
Steps in source :
1. Generate the partner WSDL.
2. To call this organization as a source we have to write the apex webservice class, where we can pass the parameters after the connection.
3. We need to pass the user credentials like username, password and security token for connection
Syntax to declare apex web services :
Global class classname {
webservice static returntype methodname(parameters){
//logic
}
}
-> My requirement is when i create a record in target org then same record must be created in source org. so we need to create apex web service class, we will declare the parameters in source org and assign values to that paramaeters in target org. so that we will create the same record in source org as well
Global class Accountservice{
webservice static string createcustomer(String Name, String Phone, String City){
Account acc = new Account();
acc.name = Name;
acc.phone = Phone;
acc.Billingcity = City;
Insert acc;
if(acc.id !=null)
{
return 'success';
}
else{
return 'failure';
}
}
}
so we can not use directly this web service class, we have to convert this webservice to WSDL, for this we have to click on generate WSDL button on apex class in salesforce.
After converting into WSDL from webservice class we will get a XML format file, from this we will get class name, URL, Operation(method name), parameters.
Steps in Target :
1. Consume both partner WSDL and webservice WSDL/ Generate apex classes for both partner WSDL and webservice WSDL, from this classes we can take the end point URL from both WSDL's
2. Remote site settings configuration - we can take the end point URL from both the apex classes generate from partner WSDL and webservice WSDL and save these URL's in remote site settings.
-> partner WSDL - Generate apex class gives - end point URL which will helps you for connection to source org.
-> webservice WSDL - Generate apex class gives - end point URL which will helps you for connection to webservice apex class.
No comments:
Post a Comment