Activity Forums Salesforce® Discussions what is the use of webservice method in Salesforce?

  • Aman

    Member
    July 19, 2017 at 1:09 pm

    Hello Saloni,

    Apex class methods can be exposed as custom SOAP Web service calls. This allows an external application to invoke an Apex Web service to perform an action in Salesforce. Use the webService keyword to define these methods. For example:

    global class MyWebService {
    webService static Id makeContact(String lastName, Account a) {
    Contact c = new Contact(lastName = 'Weissman', AccountId = a.Id);
    insert c;
    return c.id;
    }
    }

    A developer of an external application can integrate with an Apex class containing webService methods by generating a WSDL for the class. To generate a WSDL from an Apex class detail page:
    1. In the application from Setup, enter “Apex Classes” in the Quick Find box, then select Apex Classes.
    2. Click the name of a class that contains webService methods.
    3. Click Generate WSDL.

     

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos