You need to sign in to do that
Don't have an account?

Webservice class real time example
Hi All,
Why do we write webservice classes when there is enterprise and partner wsdl? I would like to know in what scenario we write webservice classes instead of enterprise and partner wsdl. Can anyone explain me with real time example.
Why do we write webservice classes when there is enterprise and partner wsdl? I would like to know in what scenario we write webservice classes instead of enterprise and partner wsdl. Can anyone explain me with real time example.
salesforce provides enterprise and partner wsdl for integration. But you have to write your own web service class when we need to expose a business logic that can be called by the other system.
For ex: consider you wrote a class for adding two numbers in apex and now this method should be called by an external system. so in that you will make it as a web service.
and another scenario where you need to send the customized response to the caller rather than what is provided by using standard salesforce wsdl and sometimes you need to access multiple objects to do the calculations which is not provided by standard WSDL.
Hope it gives you an idea about why we are wrtiting custom webservices.
Thanks
Nag
All Answers
Apex Integration Services
https://developer.salesforce.com/trailhead/module/apex_integration_services?utm_campaign=trailhead&utm_source=sfdc&utm_medium=chatter-success
Apex Integration Overview
https://developer.salesforce.com/trailhead/apex_integration_services/apex_integration_callouts
This module will Describe the differences between web service and HTTP callouts and Authorize an external site with remote site settings
Apex REST Callouts
https://developer.salesforce.com/trailhead/apex_integration_services/apex_integration_rest_callouts
This module will describe about Perform a callout to receive data from an external service and Test callouts by using mock callouts
Apex SOAP Callouts
https://developer.salesforce.com/trailhead/apex_integration_services/apex_integration_soap_callouts
This module will describe you about Generate Apex classes using WSDL2Apex and Perform a callout to send data to an external service using SOAP with Test callouts by using mock callouts
Apex Web Services
https://developer.salesforce.com/trailhead/apex_integration_services/apex_integration_webservices
This module will Describe the two types of Apex web services and provide a high-level overview of these services. Create an Apex REST class that contains methods for each HTTP method and Invoke a custom Apex REST method with an endpoint
Let us know if this will help you
Thanks for the quick reply.
I have already gone through all those trailhead modules. In these they have explained how to do only. but, my doubt is why we should write Apex webservice calsses when there is enterprise/partner wsdl?
salesforce provides enterprise and partner wsdl for integration. But you have to write your own web service class when we need to expose a business logic that can be called by the other system.
For ex: consider you wrote a class for adding two numbers in apex and now this method should be called by an external system. so in that you will make it as a web service.
and another scenario where you need to send the customized response to the caller rather than what is provided by using standard salesforce wsdl and sometimes you need to access multiple objects to do the calculations which is not provided by standard WSDL.
Hope it gives you an idea about why we are wrtiting custom webservices.
Thanks
Nag
This gives me clear idea when to write webservice classes. So if we need any standard operations like update, delete, insert... sharing standard wsdl is enough?
Please correct me, if i am wrong. Otherwise, please explain me with example, where only sharing standard wsdl is enough for integration?