---
schema_version: "1"
id: 5476056aa2f45b858ac1e4798e436e29126a47bc78d97c68a699f07a9273c1c8
title: WebServiceCallout Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_System_WebServiceCallout.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_WebServiceCallout.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 25bd5fc84ceb246497cc5868ed6a241674bb9621cca58e0a5e57ef14eb87277e
description: Enables making callouts to SOAP operations on an external Web service. This class is used in the Apex stub class that is auto-generated from a WSDL.Invokes an external SOAP web service operation based on an Apex class that is auto-generated from a WSDL.
---
# WebServiceCallout Class

Enables making callouts to SOAP operations on an external Web service. This class is used in the Apex stub class that is auto-generated from a WSDL.

## Namespace

[System](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_System.htm "The System namespace provides classes and methods for core Apex functionality.")

- **[WebServiceCallout Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_WebServiceCallout.htm#apex_System_WebServiceCallout_methods)**

#### See Also

- [_Apex Developer Guide_: SOAP Services: Defining a Class from a WSDL Document](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/apex_callouts_wsdl2apex.htm "Apex Developer Guide: SOAP Services: Defining a Class from a WSDL Document - HTML (New Window)")

## WebServiceCallout Methods

The following is the static method for WebServiceCallout.

- **[invoke(stub, request, response, infoArray)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_WebServiceCallout.htm#apex_System_WebServiceCallout_toString)**  
    Invokes an external SOAP web service operation based on an Apex class that is auto-generated from a WSDL.

### invoke(stub, request, response, infoArray)

Invokes an external SOAP web service operation based on an Apex class that is auto-generated from a WSDL.

#### Signature

public static void invoke(Object stub, Object request, Map<String,Object\> response, List<String\> infoArray)

#### Parameters

- **stub**:
    
    Type:
    
    Object An instance of the Apex class that is auto-generated from a WSDL (the stub class).
- **request**:
    
    Type:
    
    Object The request to the external service. The request is an instance of a type that is created as part of the auto-generated stub class.
- **response**:
    
    Type: [Map](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_map.htm#apex_methods_system_map "Contains methods for the Map collection type.")<[String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type."), Object>
    
    A map of key-value pairs that represent the response that the external service sends after receiving the request. In each pair, the key is a response identifier. The value is the response object, which is an instance of a type that is created as part of the auto-generated stub class.
- **infoArray**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")\[\]
    
    An array of strings that contains information about the callout—web service endpoint, SOAP action, request, and response. The order of the elements in the array matters.
    
    - Element at index 0 (\[0\]): One of the following options for identifying the URL of the external web service.
        - Endpoint URL. For example: 'http://YourServer/YourService'
        - Named credential URL, which contains the scheme callout, the name of the named credential, and optionally, an appended path. For example: 'callout:MyNamedCredential/some/path'
    - Element at index 1 (\[1\]): The SOAP action. For example: 'urn:dotnet.callouttest.soap.sforce.com/EchoString'
    - Element at index 2 (\[2\]): The request namespace. For example: 'http://doc.sample.com/docSample'
    - Element at index 3 (\[3\]): The request name. For example: 'EchoString'
    - Element at index 4 (\[4\]): The response namespace. For example: 'http://doc.sample.com/docSample'
    - Element at index 5 (\[5\]): The response name. For example: 'EchoStringResponse'
    - Element at index 6 (\[6\]): The response type. For example: 'docSample.EchoStringResponse\_element'

#### Return Value

Type: Void

#### See Also

- [_Apex Developer Guide_: Named Credentials as Callout Endpoints](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/apex_callouts_named_credentials.htm "Apex Developer Guide: Named Credentials as Callout Endpoints - HTML (New Window)")