Integration consists of 11% of total score in Salesforce Platform Dev II Exam. This chapter basically revolves around Apex with these two famous web services: SOAP and REST.
NOTE: This post is written in July 2019 and content might be changed/updated overtime. The content is inspired by focusonforce.com.
Callout to Web Services
Named credentialcan be setup in order to make a callout to external site.- NOTE: if using
named credential,remote site settingwill not be required. - Create
name credentialby navigating toSetup > Named Credentials:

- Create
remote site settingsby navigating toSetup > Remote Site Settings:

REST Web Service
Apexclass can be defined as global and global static for its method in order to use asRESTweb service.- The class should be annotated with
@RestResourceandurlMappingvalue should be specified. - URL mapping is case-sensitive and is appended to the base endpoint.
- Global Static keywords are required for exposing HTTP method and it should be annotated:
@HttpGet- read or retrieve records@HttpPost- create records@HttpDelete- delete records@HttpPut- upsert records@HttpPatch- update fields in existing records
- Example of
RESTweb service:
@RestResource(urlMapping='/Account/*')
global with sharing class AccountRest{
@HttpGet
global static String getAccName(){
String name;
// retrieve name
return name;
}
}Http, HttpRequest, and HttpResponse class
Httpclass is used to initiate an HTTP request and response usingsend()methodHttpRequestclass is used to instantiate aHTTPrequest and it can set necessary parts of the request before sending the request:setEndpoint()- set endpoint urlsetMethod()- set the type of method, such asGET,POST,PUT,DELETE,HEADandTRACEsetHeader()- set the content of request header (allow setting different name-value pairs)setBody()- set the content of request bodysetTimeout()- set timeout in milliseconds (default is 10 seconds, max is 120 seconds)
HttpResponseclass is used to assign with the response:getBody()- get the response bodygetStatus()- get the response status messagegetStatusCode()- get the response status code (200, 400, 500…)
- Sample callout to external service using HTTP:
HttpRequest request = new HttpRequest();
request.setEndpoint('https://test.com/api');
request.setMethod('GET');
request.setBody('hello=world');
Http http = new Http();
HttpResponse response = http.send(request);
System.debug(response.getStatus() + ', ' + response.getBody());JSON, JSONGenerator, and JSONParser class
JSONclass can be used to serialize and deserialize standard and custom objects,Apexclasses, primitive and collection types, and database method return types such asSaveResult.- Sample of returning
SaveResultsthrough updating metadata(s):SaveResult [] srs = metabinding.upateMetadata(Metadata [] metadatas);
JSONclass methods:createParser()- creator JSON parserserialize()- serializationdeserialize()- deserialization- NOTE: please refer to the official documentation here.
JSONGeneratorclass can be used to generate standardJSON-encodedcontent and that JSON content can be constructed element by element.JSONGeneratorclass methods:getAsString()- return JSON content in StringwriteBlob(blobValue)writeBlobField(fieldName, blobValue)writeBoolean(booleanValue)writeBooleanField(fieldName, booleanValue)writeDate(dateValue)writeDateField(fieldName, dateValue)writeDateTime(dateTimeValue)writeDateTimeField(fieldName, dateTimeValue)writeId(idValue)writeIdField(fieldName, idValue)writeNumber(numValue)writeNumberField(fieldName, numValue)writeObject(object)writeObjectField(fieldName, object)writeString(stringValue)writeStringField(fieldName, stringValue)writeTime(timeValue)writeTimeField(fieldName, timeValue)writeNull()writeNullField(fieldName)writeFieldName(fieldName)writeStartArray()- write'['writeEndArray()- write']'writeStartObject()- write'{'writeEndObject()- write'}'
public class Test{
String grade;
public Test(String grade){
this.grade = grade;
}
}
String name = 'hello';
String value = 'world';
List<String> list = new List<String>();
list.add('a');
list.add('b');
list.add('c');
Test test = new Test('A');
JSONGenerator gen = JSON.createGenerator(true);
gen.writeStartObject();
gen.writeStringField(name, value);
gen.writeFieldName('array');
gen.writeStartArray();
gen.writeStartObject() ;
gen.writeNumberField('number', 1);
gen.writeBooleanField('boolean', false);
gen.writeEndObject();
gen.writeEndArray();
gen.writeFieldName('list');
gen.writeStartObject();
gen.writeObjectField('list', list);
gen.writeEndObject();
gen.writeFieldName('test');
gen.writeObject(test);
gen.writeEndObject();
gen.writeEndObject();
String jsonStr = gen.getAsString();
System.debug(jsonStr);JSONParserclass can be used to parseJSON-encodedcontent, mostly used in the JSON response from web service callout.JSONParserclass methods:getBlobValue()getBooleanValue()getDateValue()getDatetimeValue()getDecimalValue()getIdValue()getIntegerValue()getLongValue()getTimeValue()getText()- return the textual representation of current token, null if no current tokenhasCurrentToken()- return true if parser points to a tokennextToken()- return next tokennextValue()- return next token value
- Example of parsing
JSONformatted content:
JSONParser parser = JSON.createParser(response.getBody());
String temp;
while(parser.nextToken() != null){
temp = parser.getText();
System.debug(temp);
}- Something about
JSON:nullmust be in all lowercase,NULLis not a valid keyword inJSON- double quote ‘
"’ is the standard forJSON
SOAP Web Service
Apexclass can be defined as global and keyword static for its method in in order to use asSOAPweb service.- You can use the
webservicemodifier to define top-level, outer class methods and variables, and member variables of an inner class. - NOTE:
webservicecannot be used on a class itself, or an interface or interface methods or variables. - NOTE: Only
staticmethod can be marked withwebservicekeyword and that exposed methods and variables must havewebservicekeyword. WSDLfile forApexcan be generated fromApexclass page inSetupif yourApexclass supportswebservicemethods.

- Methods in
Apexclass will be called from external application by consuming the classWSDLfile.
global with sharing class TestingSoapClass {
webservice static String getAccountName(String id){
return [SELECT Id FROM Account WHERE Id = :id LIMIT 1].Name;
}
}WSDL2Apexutility can generateApexclass fromWSDLfile by navigating toApex ClassesinSetup.- Download and upload
WSDLfile (1MB max)
- Generate
Apexcode

- Done! You can find calculatorServices (synchronous) and AsyncCalculatorServices (asynchronous)
Apexclass.

- Download and upload
- Link to this calculator example can be found in Salesforce Trailhead. Source files can be found in Appendix (all the way to the bottom).
- An instance of the stub can be created in
Apexcode to invoke an external service usingWSDL.
calculatorServices.CalculatorImplPort calc = new calculatorServices.CalculatorImplPort();
Double a = 13.0;
Double b = 7.0;
Double c = calc.doMultiply(a, b);- NOTE: each complex type in
WSDLbecomes a class while each element becomes public field in the class. - NOTE: Each
WSDLoperation is mapped to aApexclass method. - NOTE: Define any method that uses the
webservicekeyword as static, but not on the variables (justwebserviceonly for variables). - Methods defined with the
webservicekeyword cannot take the following elements as parameters nor returned values:- Map
- Set
- Pattern, Matcher and Exception objects
Metadata API
Metadata APIcan be used to retrieve, deploy, create, update, or delete customization information, such as custom object definition, page layout and etc.- Typical use cases of
Metadata API:- export metadata information as
XMLmetadata files - use
retrieve()anddeploy()to moveXMLmetadata files between orgs. - modify existing customizations
- CRUD setup and configuration components
- useful for ISVs as it allows app configuration and streamlines the upgrade process with a user-friendly interface
- export metadata information as
Streaming API
Streaming APIis used to push notifications from server to client based on defined criteria.- Benefits of using
Streaming API:- reduce the need for constant polling by applications, hence reducing API calls and processing time
- sync data with Salesforce
- process business logic in an external system instead of in Salesforce
Streaming APIuses Bayuex protocol and CometD for long polling:- Bayuex protocol - transport message via HTTP asynchronously
- CometD - scalable HTTP-based event routing bus that implements the Bayuex protocol and uses
AJAXpush technology pattern known as Comet
- Long polling process:
- Client sends request to server
- Server holds request until information is available
- Server sends response back to client when information is available
- Client sends request to server again
- Client maintains connection to server and always wait to receive response.
- PushTopic channel can be created (channel created automatically when PushTopic is created) to setup subscription with the following properties:
- Name - name in the channel element of event notice (full channel name will be “
/topic/channelName”) - Query - SOQL string query
- API Version - version 37 and above can retrieve events published in previous 24 hours.
- Name - name in the channel element of event notice (full channel name will be “
- NOTE: for API 37 and above, the
replayIdsetting has the possible options:- specific
replayIdvalue - retrieve events with thereplayId - -1 - receive new events since the subscription began
- -2 - receive new events and any events from the past 24 hours
- specific
- NOTE: PushTopic can be set to notify all by setting
pushTopicNotifyForFields = 'All'; - With PushTopic, it is possible to generate notifications for Create, Update, Delete and Undelete.
PushTopic p = new PushTopic();
p.Name = 'OpportunityNotification';
p.Query = 'SELECT Id, Name, StageName FROM Opportunity WHERE StageName = \'Closed Won\'';
p.ApiVersion = 37.0;
insert p;- Generic streaming can be setup for sending and receiving custom notifications for events that are external to Salesforce, using
Streaming APIto send notifications of general events that are not tied to Salesforce data change. - With all that, a
StreamingChannelneeds to be created ( channel name will be like “/u/channelName”). - Steps to use Generic Streaming:
- Create a Streaming Channel
- Clients subscribe to channel
Streaming Channel Push REST APIresources to send notifications
Analytics API
Analytics APIallows programmatic access to feature such as datasets, dashboards and lenses.- NOTE:
Analytics APIis actually based onChatter REST API, allowing create, update and retrieve Analytics dashboards usingAnalytics API. SAQL(Salesforce Analytics Query Language) can be used to pull data from Analytics datasets.Analytics SDKtools allow building and sending Analytics queries:Wave.QueryBuildercan be used to constructSAQLquery string- Statements can be sued with
Wave.QueryBuilder:- load dataset
- foreach
- group
- order
- limit
- filter
- min, max, count, avg, unique, as, sum
Wave.ProjectionNodeandWave.QueryNodecan be used to build a more advanced query ifWave.QueryBuilderis not enough.ConnectApi.Wave.executeQuery()passes aSAQLquery fromApexto Analytics and receive a JSON-formatted response.
<!-- display report chart in visualforce -->
<apex:page>
<apex:pageBlock title="Account">
<apex:pageBlockSection>
<analytics:reportChart reportId="00O3900000KJK" size="small" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>Appendix
WSDLfile:calculator.xml:
<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://calculator.services/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="CalculatorImplService" targetNamespace="http://calculator.services/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://calculator.services/" elementFormDefault="unqualified" targetNamespace="http://calculator.services/" version="1.0">
<xs:element name="doAdd" type="tns:doAdd"/>
<xs:element name="doAddResponse" type="tns:doAddResponse"/>
<xs:element name="doDivide" type="tns:doDivide"/>
<xs:element name="doDivideResponse" type="tns:doDivideResponse"/>
<xs:element name="doMultiply" type="tns:doMultiply"/>
<xs:element name="doMultiplyResponse" type="tns:doMultiplyResponse"/>
<xs:element name="doSubtract" type="tns:doSubtract"/>
<xs:element name="doSubtractResponse" type="tns:doSubtractResponse"/>
<xs:complexType name="doDivide">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="xs:double"/>
<xs:element minOccurs="0" name="arg1" type="xs:double"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="doDivideResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:double"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="doSubtract">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="xs:double"/>
<xs:element minOccurs="0" name="arg1" type="xs:double"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="doSubtractResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:double"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="doMultiply">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="xs:double"/>
<xs:element minOccurs="0" name="arg1" type="xs:double"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="doMultiplyResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:double"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="doAdd">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="xs:double"/>
<xs:element minOccurs="0" name="arg1" type="xs:double"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="doAddResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:double"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="doSubtractResponse">
<wsdl:part element="tns:doSubtractResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="doMultiplyResponse">
<wsdl:part element="tns:doMultiplyResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="doAddResponse">
<wsdl:part element="tns:doAddResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="doDivide">
<wsdl:part element="tns:doDivide" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="doSubtract">
<wsdl:part element="tns:doSubtract" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="doDivideResponse">
<wsdl:part element="tns:doDivideResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="doMultiply">
<wsdl:part element="tns:doMultiply" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="doAdd">
<wsdl:part element="tns:doAdd" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="Calculator">
<wsdl:operation name="doDivide">
<wsdl:input message="tns:doDivide" name="doDivide">
</wsdl:input>
<wsdl:output message="tns:doDivideResponse" name="doDivideResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="doSubtract">
<wsdl:input message="tns:doSubtract" name="doSubtract">
</wsdl:input>
<wsdl:output message="tns:doSubtractResponse" name="doSubtractResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="doMultiply">
<wsdl:input message="tns:doMultiply" name="doMultiply">
</wsdl:input>
<wsdl:output message="tns:doMultiplyResponse" name="doMultiplyResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="doAdd">
<wsdl:input message="tns:doAdd" name="doAdd">
</wsdl:input>
<wsdl:output message="tns:doAddResponse" name="doAddResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CalculatorImplServiceSoapBinding" type="tns:Calculator">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="doDivide">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="doDivide">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="doDivideResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="doSubtract">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="doSubtract">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="doSubtractResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="doMultiply">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="doMultiply">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="doMultiplyResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="doAdd">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="doAdd">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="doAddResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CalculatorImplService">
<wsdl:port binding="tns:CalculatorImplServiceSoapBinding" name="CalculatorImplPort">
<soap:address location="https://th-apex-soap-service.herokuapp.com/service/calculator"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>Apexclass:calculatorSevices.cls:
//Generated by wsdl2apex
public class calculatorServices {
public class doDivideResponse {
public Double return_x;
private String[] return_x_type_info = new String[]{'return','http://calculator.services/',null,'0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://calculator.services/','false','false'};
private String[] field_order_type_info = new String[]{'return_x'};
}
public class doMultiply {
public Double arg0;
public Double arg1;
private String[] arg0_type_info = new String[]{'arg0','http://calculator.services/',null,'0','1','false'};
private String[] arg1_type_info = new String[]{'arg1','http://calculator.services/',null,'0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://calculator.services/','false','false'};
private String[] field_order_type_info = new String[]{'arg0','arg1'};
}
public class doAdd {
public Double arg0;
public Double arg1;
private String[] arg0_type_info = new String[]{'arg0','http://calculator.services/',null,'0','1','false'};
private String[] arg1_type_info = new String[]{'arg1','http://calculator.services/',null,'0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://calculator.services/','false','false'};
private String[] field_order_type_info = new String[]{'arg0','arg1'};
}
public class doAddResponse {
public Double return_x;
private String[] return_x_type_info = new String[]{'return','http://calculator.services/',null,'0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://calculator.services/','false','false'};
private String[] field_order_type_info = new String[]{'return_x'};
}
public class doDivide {
public Double arg0;
public Double arg1;
private String[] arg0_type_info = new String[]{'arg0','http://calculator.services/',null,'0','1','false'};
private String[] arg1_type_info = new String[]{'arg1','http://calculator.services/',null,'0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://calculator.services/','false','false'};
private String[] field_order_type_info = new String[]{'arg0','arg1'};
}
public class doSubtract {
public Double arg0;
public Double arg1;
private String[] arg0_type_info = new String[]{'arg0','http://calculator.services/',null,'0','1','false'};
private String[] arg1_type_info = new String[]{'arg1','http://calculator.services/',null,'0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://calculator.services/','false','false'};
private String[] field_order_type_info = new String[]{'arg0','arg1'};
}
public class doSubtractResponse {
public Double return_x;
private String[] return_x_type_info = new String[]{'return','http://calculator.services/',null,'0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://calculator.services/','false','false'};
private String[] field_order_type_info = new String[]{'return_x'};
}
public class doMultiplyResponse {
public Double return_x;
private String[] return_x_type_info = new String[]{'return','http://calculator.services/',null,'0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://calculator.services/','false','false'};
private String[] field_order_type_info = new String[]{'return_x'};
}
public class CalculatorImplPort {
public String endpoint_x = 'https://th-apex-soap-service.herokuapp.com/service/calculator';
public Map<String,String> inputHttpHeaders_x;
public Map<String,String> outputHttpHeaders_x;
public String clientCertName_x;
public String clientCert_x;
public String clientCertPasswd_x;
public Integer timeout_x;
private String[] ns_map_type_info = new String[]{'http://calculator.services/', 'calculatorServices'};
public Double doDivide(Double arg0,Double arg1) {
calculatorServices.doDivide request_x = new calculatorServices.doDivide();
request_x.arg0 = arg0;
request_x.arg1 = arg1;
calculatorServices.doDivideResponse response_x;
Map<String, calculatorServices.doDivideResponse> response_map_x = new Map<String, calculatorServices.doDivideResponse>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'',
'http://calculator.services/',
'doDivide',
'http://calculator.services/',
'doDivideResponse',
'calculatorServices.doDivideResponse'}
);
response_x = response_map_x.get('response_x');
return response_x.return_x;
}
public Double doSubtract(Double arg0,Double arg1) {
calculatorServices.doSubtract request_x = new calculatorServices.doSubtract();
request_x.arg0 = arg0;
request_x.arg1 = arg1;
calculatorServices.doSubtractResponse response_x;
Map<String, calculatorServices.doSubtractResponse> response_map_x = new Map<String, calculatorServices.doSubtractResponse>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'',
'http://calculator.services/',
'doSubtract',
'http://calculator.services/',
'doSubtractResponse',
'calculatorServices.doSubtractResponse'}
);
response_x = response_map_x.get('response_x');
return response_x.return_x;
}
public Double doMultiply(Double arg0,Double arg1) {
calculatorServices.doMultiply request_x = new calculatorServices.doMultiply();
request_x.arg0 = arg0;
request_x.arg1 = arg1;
calculatorServices.doMultiplyResponse response_x;
Map<String, calculatorServices.doMultiplyResponse> response_map_x = new Map<String, calculatorServices.doMultiplyResponse>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'',
'http://calculator.services/',
'doMultiply',
'http://calculator.services/',
'doMultiplyResponse',
'calculatorServices.doMultiplyResponse'}
);
response_x = response_map_x.get('response_x');
return response_x.return_x;
}
public Double doAdd(Double arg0,Double arg1) {
calculatorServices.doAdd request_x = new calculatorServices.doAdd();
request_x.arg0 = arg0;
request_x.arg1 = arg1;
calculatorServices.doAddResponse response_x;
Map<String, calculatorServices.doAddResponse> response_map_x = new Map<String, calculatorServices.doAddResponse>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'',
'http://calculator.services/',
'doAdd',
'http://calculator.services/',
'doAddResponse',
'calculatorServices.doAddResponse'}
);
response_x = response_map_x.get('response_x');
return response_x.return_x;
}
}
}Apexclass:AsyncCalculatorSevices.cls:
//Generated by wsdl2apex
public class AsyncCalculatorServices {
public class doDivideResponseFuture extends System.WebServiceCalloutFuture {
public Double getValue() {
calculatorServices.doDivideResponse response = (calculatorServices.doDivideResponse)System.WebServiceCallout.endInvoke(this);
return response.return_x;
}
}
public class doSubtractResponseFuture extends System.WebServiceCalloutFuture {
public Double getValue() {
calculatorServices.doSubtractResponse response = (calculatorServices.doSubtractResponse)System.WebServiceCallout.endInvoke(this);
return response.return_x;
}
}
public class doMultiplyResponseFuture extends System.WebServiceCalloutFuture {
public Double getValue() {
calculatorServices.doMultiplyResponse response = (calculatorServices.doMultiplyResponse)System.WebServiceCallout.endInvoke(this);
return response.return_x;
}
}
public class doAddResponseFuture extends System.WebServiceCalloutFuture {
public Double getValue() {
calculatorServices.doAddResponse response = (calculatorServices.doAddResponse)System.WebServiceCallout.endInvoke(this);
return response.return_x;
}
}
public class AsyncCalculatorImplPort {
public String endpoint_x = 'https://th-apex-soap-service.herokuapp.com/service/calculator';
public Map<String,String> inputHttpHeaders_x;
public String clientCertName_x;
public Integer timeout_x;
private String[] ns_map_type_info = new String[]{'http://calculator.services/', 'calculatorServices'};
public AsyncCalculatorServices.doDivideResponseFuture beginDoDivide(System.Continuation continuation,Double arg0,Double arg1) {
calculatorServices.doDivide request_x = new calculatorServices.doDivide();
request_x.arg0 = arg0;
request_x.arg1 = arg1;
return (AsyncCalculatorServices.doDivideResponseFuture) System.WebServiceCallout.beginInvoke(
this,
request_x,
AsyncCalculatorServices.doDivideResponseFuture.class,
continuation,
new String[]{endpoint_x,
'',
'http://calculator.services/',
'doDivide',
'http://calculator.services/',
'doDivideResponse',
'calculatorServices.doDivideResponse'}
);
}
public AsyncCalculatorServices.doSubtractResponseFuture beginDoSubtract(System.Continuation continuation,Double arg0,Double arg1) {
calculatorServices.doSubtract request_x = new calculatorServices.doSubtract();
request_x.arg0 = arg0;
request_x.arg1 = arg1;
return (AsyncCalculatorServices.doSubtractResponseFuture) System.WebServiceCallout.beginInvoke(
this,
request_x,
AsyncCalculatorServices.doSubtractResponseFuture.class,
continuation,
new String[]{endpoint_x,
'',
'http://calculator.services/',
'doSubtract',
'http://calculator.services/',
'doSubtractResponse',
'calculatorServices.doSubtractResponse'}
);
}
public AsyncCalculatorServices.doMultiplyResponseFuture beginDoMultiply(System.Continuation continuation,Double arg0,Double arg1) {
calculatorServices.doMultiply request_x = new calculatorServices.doMultiply();
request_x.arg0 = arg0;
request_x.arg1 = arg1;
return (AsyncCalculatorServices.doMultiplyResponseFuture) System.WebServiceCallout.beginInvoke(
this,
request_x,
AsyncCalculatorServices.doMultiplyResponseFuture.class,
continuation,
new String[]{endpoint_x,
'',
'http://calculator.services/',
'doMultiply',
'http://calculator.services/',
'doMultiplyResponse',
'calculatorServices.doMultiplyResponse'}
);
}
public AsyncCalculatorServices.doAddResponseFuture beginDoAdd(System.Continuation continuation,Double arg0,Double arg1) {
calculatorServices.doAdd request_x = new calculatorServices.doAdd();
request_x.arg0 = arg0;
request_x.arg1 = arg1;
return (AsyncCalculatorServices.doAddResponseFuture) System.WebServiceCallout.beginInvoke(
this,
request_x,
AsyncCalculatorServices.doAddResponseFuture.class,
continuation,
new String[]{endpoint_x,
'',
'http://calculator.services/',
'doAdd',
'http://calculator.services/',
'doAddResponse',
'calculatorServices.doAddResponse'}
);
}
}
}Well, that’s all for now. Content will be updated regularly. Thanks for reading!