Loading

'Unexpected element' error from web service callout

Publiseringsdato: May 23, 2026
Beskrivelse

When making a web service callout from Salesforce Apex code, you may receive the following error:
"Web service callout failed: Unexpected element. Parser was expecting element <REDACTED> but found :HTML`."
This error indicates that Salesforce received an HTML response from the external web service instead of the expected SOAP XML envelope. This typically occurs due to a connectivity issue, misconfigured endpoint, firewall restriction, or the external service being temporarily unavailable.

Løsning

Troubleshooting Steps

Use the following steps to identify and resolve the cause of the error:

  1. Verify that the external web service is available and responding correctly to SOAP requests.
  2. Confirm that Salesforce IP addresses are included in the allowlist on the firewall of the network where the external web service is hosted. Refer to Salesforce's published IP ranges for the appropriate environment.
  3. Validate the endpoint address configured in the Salesforce Apex callout or Named Credential.
  4. Confirm that the endpoint is enabled as a Remote Site in Salesforce. Navigate to Setup > Security > Remote Site Settings and verify the endpoint URL is listed and active.
  5. Ensure that the external web service is accessible via a public and valid IP address on the internet. Services hosted on private or intranet-only networks cannot be reached by Salesforce platform callouts.
Knowledge-artikkelnummer

000385914

 
Laster
Salesforce Help | Article