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
LBSLBS 

WebService returned a SOAP Fault: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session hash:

Hi There,

I'm integerating two salesforce instences via metadata api with access token, with reference to following github project.
https://github.com/financialforcedev/apex-mdapi

So i updated the createService() code as follows to retrieve the acess token as the session ID. But ended up getting mentioned error. Can someone suggest me a workaround for this?
MetadataService.MetadataPort service = new MetadataService.MetadataPort(); service.SessionHeader = new MetadataService.SessionHeader_element();

//service.SessionHeader.sessionId = UserInfo.getSessionId();  
service.SessionHeader.sessionId = clientAccessToken; 
        
//I tried setting following as the endpoint_x. But was getting separate error
//service.endpoint_x = 'https://login.salesforce.com';
Thanks