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
dragon123dragon123 

How to connect sfdc to sap/PI

Hi,

 

   I want to connect SFDC to SAP/PI . My scenrio is , if i create a data in sfdc , xml will be display in SAP/PI. Do u have any idea.

please give a solution. I tried generate WSDL file in PI. set PI end point in Apex code(http request) that also not worked.

 

I tried following way

 

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);
       req.setHeader('Content-Type','application/json');
        
         //Set Method and Endpoint and Body
        req.setMethod('POST');
        req.setEndpoint('http://ca-in02:520/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_SFDCTEST&receiverParty=&receiverService=&interface=SI_SFDC_OUT&interfaceNamespace=urn:intrigo.soap.sforce.com');
        
        req.setBody('{"EmployeeNo":"'+EmployeeNo+'","ename":"'+ename+'","Salary":"'+Salary+'"}');
        System.debug('EmployeeNo -->' + EmployeeNo); 
        try {
           //Send endpoint to JIRA
           res = http.send(req);
            
        } catch(System.CalloutException e) {
            System.debug(res.toString());
        }
    }

 

    
    public static testMethod void testMe() {
        WebServiceCallout123.sendNotification('aza','aza','aza');
    }
 
}

 

trigger:

 

trigger InsertEcc on Employee__c (after Insert) {

for(Employee__c s:Trigger.New)
{
   
     WebServiceCallout123.sendNotification(s.Name,s.Ename__c,s.Salary__c);
     System.debug('Emp data -->' + s);

 

}

}

 

please give a solution...

 

very urgent....

 

 

SurpriseSurprise

Move this code to the Webservice section ,you have better chances of getting some results.

 

 

dragon123dragon123

can u share ur code? my problem is not reaching in SAP/PI