WebServiceMock Interface
Enables sending fake responses when testing Web service callouts of a class auto-generated from a WSDL.
For an implementation example, see Test Web Service Callouts.
The following are methods for WebServiceMock.
-
The implementation of this method is called by the Apex runtime to send a fake response when a Web service callout is made after
Test.setMockhas been called.
The implementation of this method is called by the Apex runtime to send a fake response when a Web service callout is made after Test.setMock has been called.
public Void doInvoke(Object stub, Object soapRequest, Map<String,Object> responseMap, String endpoint, String soapAction, String requestName, String responseNamespace, String responseName, String responseType)
-
stub:
Type:
Object An instance of the auto-generated class.
-
soapRequest:
Type:
Object The SOAP Web service request being invoked.
-
responseMap:
A collection of key/value pairs representing the response to send for the request. When implementing this interface, set the responseMap argument to a key/value pair representing the response desired.
-
endpoint:
Type: String
The endpoint URL for the request.
-
soapAction:
Type: String
The requested SOAP operation.
-
requestName:
Type: String
The requested SOAP operation name.
-
responseNamespace:
Type: String
The response namespace.
-
responseName:
Type: String
The name of the response element as defined in the WSDL.
-
responseType:
Type: String
The class for the response as defined in the auto-generated class.
Type: Void