I need to get some info via SOAP calls and I stick with one error. Right now I need to support two ways of sending SOAP calls:
- making a call with username-password params
- making a request with permanent token within the SOAP header (without providing user name and password)
The first case is working fine. Here is a sample:
ConnectorConfig partnerConfig = new ConnectorConfig();
partnerConfig.setUsername(userName);
partnerConfig.setPassword(password);
partnerConfig.setAuthEndpoint("https://" + instanceUri + "/services/Soap/u/27.0");
partnerConfig.setRestEndpoint("https://" + instanceUri + "/services/data/v27.0");
partnerConfig.setPrettyPrintXml(true);
PartnerConnection partnerConnection = new PartnerConnection(partnerConfig);
DescribeGlobalResult global = partnerConnection.describeGlobal();
global object is returned successfully.
Then I tried to do this via SOAP headers. Here is my code:
ConnectorConfig partnerConfig = new ConnectorConfig();
partnerConfig.setServiceEndpoint("https://" + instanceUri + "/services/Soap/u/27.0");
partnerConfig.setSessionId(soapToken);
partnerConfig.setManualLogin(true);//to prevent login() for partnerConnection
partnerConfig.setAuthEndpoint("https://" + instanceUri + "/services/Soap/u/27.0");
partnerConfig.setRestEndpoint("https://" + instanceUri + "/services/data/v27.0");
partnerConfig.setPrettyPrintXml(true);
PartnerConnection partnerConnection = new PartnerConnection(partnerConfig);
partnerConnection.setCallOptions(soapToken, null);
DescribeGlobalResult global = partnerConnection.describeGlobal();
in this case I'm getting
UnexpectedErrorFault [ApiFault exceptionCode='INVALID_SESSION_ID' exceptionMessage='Invalid Session ID found in SessionHeader: Illegal Session'
error after partnerConnection.describeGlobal();
Can someone help me in this question? Maybe I missed something.
Regards, Eugene