Summary
In this chapter, we have seen how we can generate Apex code to allow us to integrate with a SOAP API, make callouts using that generated code, and test the code.
SOAP APIs have a far more verbose definition than RESTful APIs through the use of a WSDL file. We began the chapter by discussing what SOAP is and how WSDL files allow developers on different platforms to generate code they can use to integrate easily.
We used the in-built Apex generation feature within the Salesforce platform to generate both a synchronous and an asynchronous class for us to use, which makes integration from Apex simple. Firstly, we saw how to use the synchronous class to make real-time callouts and then an example of using continuations with the asynchronous class to display data on a Visualforce page.
To finish the chapter, we looked at testing these classes, firstly using the WebServiceMock
interface for direct testing of the generated classes, and then how to use continuation methods...