What Is SOAP API?
SOAP API is used to create, retrieve, update or delete records, such as accounts, leads, and custom objects. It supports data in the form of XML. Requires WSDL files for the integration.
What are the Steps?
- Navigate to setup -> Develop -> Apex Classes and create new class by clicking new button.
- Write a class with “global†access modifier with methods.
- Methods must be start with “Webservice†keyword.
- Save the above class. After saving the class you will see the button “Generate WSDLâ€. Click on that to get WSDL for web service. Save the WSDL file named as “SuryaDhruvsoftWebservice.wsdlâ€
- Now we will see how to access this WSDL file using JAVA
What are the steps for Java
- Create a Dynamic web project named as “ApexSOApCustomWS†in eclipse.
- Generate a Enterprise/Partner WSDL from your salesforce org which can be used to get a SessionId.
- Import Enterprise/Partner WSDL file into the project and generate client side stubs
- Import “SuryaDhruvsoftWebservice.wsdl†file into the project and generate client side stubs by right clicking on the WSDL file and click on “Generate Clientâ€
- The below image shows code generated for Partner WSDL in Blue color box and code for Custom Web Service (SuryaDhruvsoftWebservice.wsdl) in Red color box.
- Create Servlet named as “ HandleWebService†with following code in your eclipse project
- Run the above created JSP page and enter your name then click the submit button