1

I have a REST access token and would like to use that access token in my PartnerConnection ConnectionConfig to make a Bulk API call. It does not seem to work as I get an message to set my Service Endpoint. Please assist if it is possible to make a SOAP call from a REST access token?And how I can do it.

  • I noticed you unaccepted my answer, is there something I can do to improve it? It would be useful at least to know what the issue was that made the answer incorrect for you if you can share please? Thanks. :-) – Andrew Fawcett Sep 5 '13 at 2:03
5

Yes you need to provide the service end point, if you logged in with Salesforce WSC (Web Service Connector) this is usually handled for you or returned in the LoginResult if you took the manual login route. If not you can set it manually like so.

ConnectorConfig partnerConfig = new ConnectorConfig();              
partnerConfig.setServiceEndpoint("https://yourinstance.salesforce.com");
partnerConfig.setSessionId(yourSessionId);
ParnterConnection partnerConnection = Connector.newConnection(partnerConfig);

Note: Its not usually a good idea to hard code your instance name. I assume when forming the REST URL's you've already resolved this in a way that is satisfactory for your situation.

1

thanks for your advice here is the code the worked for me:

   
ConnectorConfig partnerConfig = new ConnectorConfig();  
partnerConfig.setAuthEndpoint("https://test.salesforce.com/services/Soap/u/27.0"); 
partnerConfig.setServiceEndpoint("https://cs17.salesforce.com/services/Soap/u/"); 
partnerConfig.setSessionId(sessionProvider.getAccessToken()); 
new PartnerConnection(partnerConfig);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.