+ Start a Discussion

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.

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';