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
navneet damaninavneet damani 

Calling a Web Service residing in SAP from SFDC

Hello Friends,

 

We are trying to call a web service which is residing in SAP. To do this we have created an Apex Class using 'Generate from WSDL' and trying to call it from Apex Triggers using following code. However, this is not working.

------------------------------------------------------------------------------------

trigger Oppurtunitycreate on Opportunity (after update) {

    SAPWS.binding BI = new SAPWS.binding();
    BI.ZasEsTest();
   
   System.debug('Price before inserting new book'); 
}

------------------------------------------------------------------------------------

Could you please suggest if this is correct? Or please suggest us the possible ways to do this integration.

 

If someone can share a sample code, that would be of great help!

 

Best regards,

Navneet.

eric.luiseric.luis
navneet damaninavneet damani

Hi Eric,

 

Yes, we did the remote site settings, but still its not working.

 

We have called the Generated Apex class from the trigger for Oppurtunity object.

 

It is also not giving any errors, however Webservice on the SAP side is not getting executed.

 

Regards,

Navneet

eric.luiseric.luis

Yes it will not generate any error because when you call the class from a trigger, it must be asynchronous.

 

You should use system.debug on the result of the call, so you can trace what happened with the debug log.

 

Other option is use the developer console and recreate the situation, then you can see what is happening.