我收到了Salesforce的合作伙伴令牌,需要附加在SOAP标头中,我使用以下代码验证有效会话,但我不确定在哪里需要附加合作伙伴令牌。以下是我在Java中的代码。
ConnectorConfig config = new ConnectorConfig(); config.setAuthEndpoint( “https://login.salesforce.com/services/Soap/c/24.0/”); config.setServiceEndpoint(salesforceUserCredentials.getServerURL()); config.setSessionId(salesforceUserCredentials.getSessionId()); connection = new EnterpriseConnection(config); logger.info(“连接状态:”+连接);
GetUserInfoResult userInfo = connection.getUserInfo();
答案 0 :(得分:1)
合作伙伴令牌设置在CallOption.client
字段中。
根据您的示例代码猜测:
connection = new EnterpriseConnection(config);
connection.CallOptionsValue = new CallOptions();
connection.CallOptionsValue.client = "YourPartnerToken/";
logger.info("Connection Status: "+connection);
GetUserInfoResult userInfo = connection.getUserInfo();