Salesforce.com : Create a webservice in salesforce/apex

Many times we have a requirement to create webservices which we want other systems to access. So there are a few things to be kept in mind while developing a webservice.
1.) Create a global class as a webservice class has be to globally accessible.
global class MyWebService {
}
2.) Create a Object for your webservice which will be used to hold data for your webservice as
     global class innerItems{
         webservice string name;
         webservice string DataId;
         webservice string DataClass;         
         public innerItems(){
         
         }
     }
 3.) All functions which you want to declare or expose in webservice must use webservice keyword
   and have to be static.
 4.) Now you can save the class and export the wsdl using the Generate Wsdl button on top of class
 
 

Comments

Popular posts from this blog

Salesforce.com: Expression Operators in Salesforce lightning Components

Custom Calendar on VisualForce Page

Salesforce.com: Scheduled Apex