function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Saurav Roy 15Saurav Roy 15 

Line: 1343, Column: 1 System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element Id

Hi Everyone,
Can you please help me out, I am new to Integration. Trying to create a record from one Salesforce Org to another Org (SOAP).
The WSDL file that I have generated for the apex class is more than 1MB. So I have removed some of the code from WSDL file to be able to generate wsdl2apex.
Error: System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element Id

Apex Class in Org1:
global class BookPlanner { 
    global class BookPlan{
        webservice String bookName;
        webservice Decimal price;
        webservice String bookId;
    }
    webservice static Book__c createBook(BookPlan Bk){
        Book__c book = new Book__c();
        book.Name = Bk.bookName;
        book.Price__c = Bk.price;
        insert Book;
        //Bk.bookId = book.Id;
        return Book;
    }
}
Call out Class of Org2:
public class Org2Integration {
    
    String Username = '*************************';
    String Password = '**************************';
	partnerSoapSforceCom_IntegratedOrg.Soap Obj = new partnerSoapSforceCom_IntegratedOrg.Soap();
    partnerSoapSforceCom_IntegratedOrg.LoginResult loginResult =  Obj.Login(Username,Password);
    System.debug('Successfull Login ------------------------------- '+loginResult);
    String Org2SessionId = loginResult.sessionId;
    System.debug('Session ID Org2 '+ Org2SessionId);
    
    // Get the sessionId from loginResult and use it into the sessionHeader_element
    BookPlannerSfdcIntegration.BookPlanner Org2CreateBook = new BookPlannerSfdcIntegration.BookPlanner();
    BookPlannerSfdcIntegration.SessionHeader_element sessionHeader = new BookPlannerSfdcIntegration.SessionHeader_element();
    sessionHeader.sessionId = Org2SessionId;
    System.debug('sessionHeader: '+ sessionHeader.sessionId);
    
    Org2CreateBook.SessionHeader = sessionHeader;
    //Org2CreateBook.URL = loginResult.serverURL;
    
    //Creating Book Record
    BookPlannerSfdcIntegration.BookPlan Book = new BookPlannerSfdcIntegration.BookPlan();
    Book.bookName = 'Integration Book Version 1';
    Book.price = 3000.00;
    
    //XML Headers
    Map<String,String> inputHeaderMap = new Map<String,String>();
    inputHeaderMap.put('Content-Type', 'text/xml');
    inputHeaderMap.put('Accept', 'text/xml');
    inputHeaderMap.put('SoapAction','');
    Org2CreateBook.inputHttpHeaders_x = inputHeaderMap;
    
    BookPlannerSfdcIntegration.Book_xc result = Org2CreateBook.createBook(Book);  
    
}


 
AnudeepAnudeep (Salesforce Developers) 
Hi Saurav, 

It appears that you have to add the missing Id element to resolve the issue

The size of any WSDL document can be at most 1MB. If you are hitting the maximum upload limit, you have to extract the elements from the WSDL that you don't need carefully. You can try using the tool listed here : https://salesforce.stackexchange.com/questions/153455/uploaded-wsdl-size-exceeded-the-maximum-upload-limit to select the web menthods you need access to and opt to comment out or exclude and unnessacary parts of the code not required by the selected methods. 

Anudeep