The Salesforce Apex error System.CalloutException: Callout loop not allowed occurs when a web service callout is initiated from within another active inbound callout. In Salesforce, you can make a callout from one Salesforce org (Org A) to another Salesforce org (Org B) or to an external web service. However, if Org B then makes its own outbound callout (for example, to a third-party web service) while still processing the inbound callout from Org A, Salesforce throws this error.
In plain terms: Org A sends a callout to Org B. Org B tries to call an external web service as part of handling that request. This chaining of callouts is not allowed. Salesforce does not permit a callout that is itself triggered by an active inbound callout.
@RestResource(urlMapping='/createAccountPlan/*')
global with sharing class CallAccountPlan{
@HttpGet
global static String doGet(){
soapSforceComSchemasClassAccplan.AccountPlan stub = new soapSforceComSchemasClassAccplan.AccountPlan();
stub.SessionHeader = new soapSforceComSchemasClassAccplan.SessionHeader_element();
stub.SessionHeader.sessionId = Session Id;
return stub.createAccountPlan();
}
}
System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: System.CalloutException: Callout loop not allowed. This confirms that the exception originated in Org B's callout attempt and was returned to Org A as a SOAP fault.000387966

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.