This document describes us about the SKYVVA SAP CPI Adapter
SAP CPI Adapter is used to communicate with SAP CPI system. We use SAP CPI Adapter only in the outbound direction. It is used to communicate and inter-operate with each other over the Web.
Inside the SAP CPI Adapter, inside CPI adapter we have only HTTP protocol
1. HTTP Protocol
If we want to create the SAP CPI Adapter. First we have to go to Integration tab and then select SAP Control Board.
First Lets discuss about the HTTP protocol inside the SAP CPI Adapter.
HTTP adapter is used for data processing of both directions. I,e Inbound and outbound.
HTTP request-> Outbound interface
As we have three elements in Request:
- HTTP Header
- URL Query Parameter
- URL Path Parameter
For HTTP Protocol we use REST V3 message type template in skyvva as explained below.
REST V3 message type template:
{
“Google REST Service”:{
“Request”:{
“URL”:{
“PATH Param”:{
//Flat Strture..
},
“Query Param”:{
//Flat Strture..
}
},
“Header”:{
//Flate Strture..
},
“Body”:{
//Custom Buisness Messagetype
}
}
}
}
What is Rest response?
When an JSON String is sent to a REST service, you must set Content-Type HTTP header to be “application/JSON”. The REST service converts the XML input data to the JSON format that is accepted by REST services.
Response Structure:
{
//Custom Buisness Message Type like Account,Contact,Asset,Opportunity,Case
}
Resource Methods:
Other important thing associated with REST is resource methods to be used to perform the desired transition. A large number of people wrongly relate resource methods to HTTP GET/PUT/POST/DELETE methods.
Authentication Section:
Here we make authentication three-way like
1) Basic Authentication
2) Certificate Authentication
3) OAuth2.0 Authentication
1) If the authentication type is Basic then the following properties required.
Authentication Type: Basic,
API Service Endpoint URL,
Operation:GET|POST|PUT|UPDATE|DELETE,
Request Format,
Response Format,
username,
password,
REST URL Path Parameter(optional)
2)If the authentication type is Certificate then the following properties required.
Authentication Type: Certificate,
API Service Endpoint URL,
Operation:GET|POST|PUT|UPDATE|DELETE,
Request Format,
Response Format,
clientCertName,
clientCertPasswd,
REST URL Path Parameter(optional)
3)If the authentication type is Oauth2.0 then the following properties required.
Authentication Type: Oauth2.0,
API Service Endpoint URL,
Token Endpoint URL,
Operation:GET|POST|PUT|UPDATE|DELETE,
Request Format,
Response Format,
REST URL Path Parameter(optional)
OAuth 2.0 Flow: Username-Password Credential
//Below properties required for access service
OAuth 2.0 client-id
OAuth 2.0 client-secret
OAuth 2.0 access-token
OAuth 2.0 Flow: Client Credential
//Below properties required for access service
OAuth 2.0 client-id
OAuth 2.0 client-secret
OAuth 2.0 access-token
OAuth 2.0 refresh-token
OAuth 2.0 Flow: OAuth 20 refresh-token
//Below properties required for access service
OAuth 2.0 client-id
OAuth 2.0 client-secret
OAuth 2.0 access-token
OAuth 2.0 refresh-token
Message Type Template:
Rest Adapter Template
Rest Adapter Template
“Rest Service”:{
“Request”:{
“URL”:{
“PATH Parameter”:{
//flat Structure
},
“QUERY Parameter”:{
//flat Structure
}
},
“Header”:{
//flat Structure
},
“Body”:{
//flat Structure
//Custom Hierarchical Business Message type
}
}
}
}
Step1: Create Adapter
First Insert Adapter Record By giving prefer Name and select Type = SAP CPI
Now Insert Properties If Need Authorization.
API Service Endpoint URL : Insert Endpoint URL where Request will direct
Username : Your Endservice UserName
Password : Your Endservice Password
Authentication : “BASIC”
REST Operation : “POST”
Protocol: HTTP
Creation of Outbound CPI Adapter:
To create SAP CPI Adapter we have to go to Integration details tab and then select “SAP Control board” as shown
Select Adapter tab and then click on new to create Adapter
Provide the details as shown belo
Select Adapter tab and then click on new to create Adapter
Provide the details as shown below:
Use this adapter in the skyvva outbound request interface.
- Create Outbound parent request interface
If we use the message type defined in skyvva then we have to do mapping in skyvva as shown.
Now save the mapping and the outbound parent interface.
- Create an inbound parent response interface
Do the mapping for inbound parent response interface
Save the mapping and the inbound response interface.
Download the inbound and outbound parent interface WSDL’s and upload it into SAP PO for mapping.
- Testing the Outbound synchronous Interface.
Callout from skyvva from developer console using the below apex code
skyvvasolutions.CallOutControl c=new skyvvasolutions.CallOutControl();
c.returnXml=true;
c.returnListRecord=true;
c.isCreateMessage=true;
c.actionDoIntegrate=true;
String[] ids=new String[]{‘0Q03N000000HZYbSAO’};
skyvvasolutions.Iservices.invokeCalloutV3(‘SAP CPI Content App V1′,’REST_Quote_Out’,ids,’SYNC’, c);
We can see the message status in the message monitor
Quote Id is updated in salesforce