function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Problem in integrate sfdc to sap/pi

Hi ,


  My scenario is , if i create a employee details record in in salesforce , It will be Display in SAP/PI. 


  Employee objects


  Fields - Name,Ename__c & Salary__c



1) generate Apex class from sap/pi WSDL

2) create a new apex class (future methods ) and set enerated class end point.

3) write a trigger , to call future methods apex class


Generated Apex class from SAP PI system


public class intrigoSoapSforceCom456 {
    public class HTTPS_Port {
        public String endpoint_x = 'http://ca-in02:520/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_SFDCTEST&receiverParty=&receiverService=&interface=SI_SFDC_OUT&';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'', 'intrigoSoapSforceCom456'};
        public intrigoSoapSforceCom456.Response_element[] SI_SFDC_OUT(intrigoSoapSforceCom456.Employee_element[] Employee) {
            intrigoSoapSforceCom456.SfdcTest_Request request_x = new intrigoSoapSforceCom456.SfdcTest_Request();
            intrigoSoapSforceCom456.SFDCResponse response_x;
            request_x.Employee = Employee;
            Map<String, intrigoSoapSforceCom456.SFDCResponse> response_map_x = new Map<String, intrigoSoapSforceCom456.SFDCResponse>();
            response_map_x.put('response_x', response_x);
              new String[]{endpoint_x,
            response_x = response_map_x.get('response_x');
            return response_x.Response;
    public class Response_element {
        public String sapno;
        private String[] sapno_type_info = new String[]{'sapno','','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'','false','false'};
        private String[] field_order_type_info = new String[]{'sapno'};
    public class SFDCResponse {
        public intrigoSoapSforceCom456.Response_element[] Response;
        private String[] Response_type_info = new String[]{'Response','','Response_element','1','-1','false'};
        private String[] apex_schema_type_info = new String[]{'','false','false'};
        private String[] field_order_type_info = new String[]{'Response'};
    public class Employee_element {
        public String EmployeeNo;
        public String Ename;
        public String Salary;
        private String[] EmployeeNo_type_info = new String[]{'EmployeeNo','','string','0','1','false'};
        private String[] Ename_type_info = new String[]{'Ename','','string','0','1','false'};
        private String[] Salary_type_info = new String[]{'Salary','','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'','false','false'};
        private String[] field_order_type_info = new String[]{'EmployeeNo','Ename','Salary'};
    public class SfdcTest_Request {
        public intrigoSoapSforceCom456.Employee_element[] Employee;
        private String[] Employee_type_info = new String[]{'Employee','','Employee_element','1','-1','false'};
        private String[] apex_schema_type_info = new String[]{'','false','false'};
        private String[] field_order_type_info = new String[]{'Employee'};



Apex class :


global class WebServiceCallout123 {
    @future (callout=true)
    WebService static void sendNotification(String EmployeeNo ,String Ename, String Salary) {
     //Set your username and password here
        String username = 'nreddy';
        String password = 'sappi123';
        //Construct HTTP request and response
        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
         //Construct Authorization and Content header
        Blob headerValue = Blob.valueOf(username+':'+password);
        String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
        req.setHeader('Authorization', authorizationHeader);
         //Set Method and Endpoint and Body
        System.debug('EmployeeNo -->' + EmployeeNo); 
        try {
           //Send endpoint to JIRA
           res = http.send(req);
        } catch(System.CalloutException e) {


    public static testMethod void testMe() {




trigger InsertEcc on Employee__c (after Insert) {

for(Employee__c s:Trigger.New)
     System.debug('Emp data -->' + s);





The problem is it is not affected in sap /pi. Any body have a idea. what wrong i done? please help me

steps look fine
i believe you add the end point URL in remote site setting

did you check with sap team are they get any calls form Salesforce

Also what was the response you get in salesforce when you call the sap service



   I add endpoint url in remote setting also. I checked with SAP Team, nothing can hit in SAP. for response URL is not properly retrieved(forbidden) and Access denied. if u have any code plz share me. 


The following steps I done.


a) generate WSDL in SAP/PI(soap adapter)

b) call endpoint url in http class and called the apex class in trigger


Hi SRK, I set Endpoint url in remote settings. but it is not hitting in SAP/PI.


  Debug log


System.HttpResponse[Status=Forbidden, StatusCode=403]

<H2>The requested URL could not be retrieved</H2>
<HR noshade size="1px">

The following error was encountered:
Access Denied.
Access control configuration prevents your request from
being allowed at this time.  Please contact your service provider if
you feel this is incorrect.
<P>Your cache administrator is <A HREF=""></A>. 

<BR clear="all">
<HR noshade size="1px">
Generated Tue, 02 Apr 2013 04:33:02 GMT by (squid)

Hi Dragon,


I have to work on the same thing.Have u got this resolved ,can u please help? 


Same code is work perfectly... set correct endpoint URL


Hi Dragon,


Thanks a lot for your reply.


On thing which confuses me about your code is that ,You have geenrated classes from wsdl fille and then you are using Rest based web services,


You are combining soap based structure as well as rest based in which you specify end point URL and then send data using HTTP etc.Which makes me believe you  are actually using rest based mechanism using json mechanism not using wsdl to apex generated classes.Am I correct.?


As far as my knowledge is concerned about soap,which is not much?


When we use soap based web services,We extract wsdl to apex and then we call functions from the generarted classes.I mean we make callout's in which we specify parameters and then we get response back from the webservcies and we display that to the user.When I look at your code I do not see that you are calling any function from wsdl generated classes.?Am I missing something ? 


Can u please clarify whether you have used soap or rest based web servcies?.Please help if I am missing something,Please correct or advise.


Moreover,Are u not making use of the External id's?



Thanks once again for your help.












Hi Dragon,


What kind of authetication mechanism you followed for connecting salesforce with sap.Since you have specified username and password of sap in the code.Did that allow you to establish connection with the sap.


Another question ,So basically from sap generated wsdl files in salesforce you are only using sap endpoint in saleforce.IS that correct?


Can u please help be answering these questions?

Mitesh SuraMitesh Sura
Although this is old post, for me the issue was "Profile not having access to Apex class" Once I did that , I got 
StatusCode=200 message. Hope it helps someone. 
Gaurav AgnihotriGaurav Agnihotri
what could be the possible reason of getting status code 403?
CALLOUT_RESPONSE [34]|System.HttpResponse[Status=Forbidden, StatusCode=403]
bow bharath 1bow bharath 1
Thank you @Mitesh Sura . It helped me.