You need to sign in to do that
Don't have an account?
Doctor
Newbie - Query Causing Invalid Session ID error
I am new to working with SOAP.
I am using a cut down version of the Partner WSDL to integratre two salesforce Orgs.
I have successfully logged in and ssigned a session Id to the SessionHeader, but when I add a query into the mix, I get an Invalid Session ID error.
At the moment I am just playing around to make sure I understand the concepts, so the code isn't as complete as it could be with respect to exception handling and the like.
Any ideas where I am going wrong?
public with sharing class orgConnectionTest { public static partnerSoapSforceCom.Soap doLogin(){ partnerSoapSforceCom.Soap myPartnerSoap = new partnerSoapSforceCom.Soap(); partnerSoapSforceCom.LoginResult LoginResult = myPartnerSoap.login('user@domain.com', 'XXXXXXXXXXX'); partnerSoapSforceCom.QueryResult QueryResult = myPartnerSoap.query('SELECT Id from Account LIMIT 1'); myPartnerSoap.endpoint_x = LoginResult.serverUrl; partnerSoapSforceCom.SessionHeader_element sh = new partnerSoapSforceCom.SessionHeader_element(); sh.sessionId = LoginResult.sessionId; return null; }