本文整理汇总了Java中com.sforce.ws.ConnectorConfig.setAuthEndpoint方法的典型用法代码示例。如果您正苦于以下问题:Java ConnectorConfig.setAuthEndpoint方法的具体用法?Java ConnectorConfig.setAuthEndpoint怎么用?Java ConnectorConfig.setAuthEndpoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sforce.ws.ConnectorConfig
的用法示例。
在下文中一共展示了ConnectorConfig.setAuthEndpoint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPartnerConnection
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private PartnerConnection createPartnerConnection() throws Exception {
ConnectorConfig config = new ConnectorConfig();
LOG.debug("Connecting SF Partner Connection using " + username);
config.setUsername(username);
config.setPassword(password);
String authEndpoint = getAuthEndpoint(loginURL);
LOG.info("loginURL : " + authEndpoint);
config.setAuthEndpoint(authEndpoint);
config.setServiceEndpoint(authEndpoint);
try {
return Connector.newConnection(config);
} catch (ConnectionException ce) {
LOG.error("Exception while creating connection", ce);
throw new Exception(ce);
}
}
示例2: fetchSFDCinfo
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
/**
* Fetching the Salesforce UserInfo along with session id.
* @return
*/
public static SFDCInfo fetchSFDCinfo() {
App.logInfo("Fetching SalesForce Data");
if(App.sfdcInfo.getSessionId() != null) return App.sfdcInfo;
try {
ConnectorConfig config = new ConnectorConfig();
config.setUsername(App.getUserName());
config.setPassword(App.getUserPassword() + App.getSecurityToken());
config.setAuthEndpoint(App.getPartnerUrl());
partnerConnection = Connector.newConnection(config);
GetUserInfoResult userInfo = partnerConnection.getUserInfo();
App.sfdcInfo.setOrg(userInfo.getOrganizationId());
App.sfdcInfo.setUserId(userInfo.getUserId());
App.sfdcInfo.setSessionId(config.getSessionId());
String sept = config.getServiceEndpoint();
sept = sept.substring(0, sept.indexOf(".com") + 4);
App.sfdcInfo.setEndpoint(sept);
App.logInfo("SDCF Info:\n" + App.sfdcInfo.toString());
return App.sfdcInfo;
} catch (ConnectionException ce) {
ce.printStackTrace();
return null;
}
}
示例3: initializeConnectorConfig
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private void initializeConnectorConfig(ConnectorConfig connectorConfig) {
if (forceProject == null) {
throw new IllegalArgumentException("Object containing connection details cannot be null");
}
connectorConfig.setCompression(true);
if (Utils.isEmpty(forceProject.getSessionId())) {
connectorConfig.setManualLogin(true);
connectorConfig.setUsername(forceProject.getUserName());
connectorConfig.setPassword(forceProject.getPassword() + forceProject.getToken());
} else {
connectorConfig.setManualLogin(false);
connectorConfig.setSessionId(forceProject.getSessionId());
}
connectorConfig.setReadTimeout(forceProject.getReadTimeoutMillis());
connectorConfig.setConnectionTimeout(forceProject.getReadTimeoutMillis());
if (Utils.isNotEmpty(forceProject.getEndpointServer())) {
final String endpointUrl =
salesforceEndpoints.getFullEndpointUrl(forceProject.getEndpointServer(),
forceProject.isHttpsProtocol());
connectorConfig.setAuthEndpoint(endpointUrl);
connectorConfig.setServiceEndpoint(connectorConfig.getAuthEndpoint());
}
}
示例4: login
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public boolean login(String username, String password, String endpoint) {
boolean success = false;
String authEndPoint = (endpoint != null) ? endpoint : DEFAULT_ENDPOINT;
try {
ConnectorConfig config = new ConnectorConfig();
config.setUsername(username);
config.setPassword(password);
config.setAuthEndpoint(authEndPoint);
config.setTraceMessage(true);
config.setPrettyPrintXml(true);
conn = new PartnerConnection(config);
success = true;
} catch (ConnectionException ce) {
logger.log(Level.SEVERE, null, ce);
}
return success;
}
示例5: loginToSalesforce
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private static LoginResult loginToSalesforce(
final String username,
final String password,
final String loginUrl) throws ConnectionException {
final ConnectorConfig config = new ConnectorConfig();
config.setAuthEndpoint(loginUrl);
config.setServiceEndpoint(loginUrl);
config.setManualLogin(true);
return (new PartnerConnection(config)).login(username, password);
}
示例6: loginToSalesforce
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private static LoginResult loginToSalesforce(final String username, final String password, final String authEndPoint)
throws ConnectionException {
final ConnectorConfig config = new ConnectorConfig();
config.setAuthEndpoint(authEndPoint);
config.setServiceEndpoint(authEndPoint);
config.setManualLogin(true);
final PartnerConnection partnerConnection = new PartnerConnection(config);
return partnerConnection.login(username, password);
}
示例7: getPartnerConnection
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public static PartnerConnection getPartnerConnection(SalesforceConfig config) throws ConnectionException {
ConnectorConfig cc = new ConnectorConfig();
cc.setUsername(config.getUsername());
cc.setPassword(config.getPassword());
cc.setManualLogin(false);
String authEndpoint = String.format(ENDPOINT_SOAP, config.getServerUrl(), config.getApiVersion());
cc.setAuthEndpoint(authEndpoint);
PartnerConnection partnerConnection = com.sforce.soap.partner.Connector.newConnection(cc);
partnerConnection.login(config.getUsername(), config.getPassword());
return partnerConnection;
}
示例8: createPartnerConnection
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private PartnerConnection createPartnerConnection(
String endpointUrl,
String userName,
String password)
throws ConnectionException {
ConnectorConfig partnerConfig = new ConnectorConfig();
partnerConfig.setUsername(userName);
partnerConfig.setPassword(password);
partnerConfig.setAuthEndpoint(endpointUrl);
return new PartnerConnection(partnerConfig);
}
示例9: getPartnerConfig
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public static ConnectorConfig getPartnerConfig(ForceConfigBean conf, SessionRenewer sessionRenewer) throws StageException {
ConnectorConfig config = new ConnectorConfig();
config.setUsername(conf.username.get());
config.setPassword(conf.password.get());
config.setAuthEndpoint("https://"+conf.authEndpoint+"/services/Soap/u/"+conf.apiVersion);
config.setCompression(conf.useCompression);
config.setTraceMessage(conf.showTrace);
config.setSessionRenewer(sessionRenewer);
setProxyConfig(conf, config);
return config;
}
示例10: createConfig
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public ConnectorConfig createConfig() {
CommonConnectorConfig commonConnConfig = new CommonConnectorConfig();
ConnectorConfig config = commonConnConfig.createConfig();
config.setAuthEndpoint(
CommandLineArguments.getOrgUrl() + "/services/Soap/u/" + ConnectionHandler.SUPPORTED_VERSION);
config.setSessionRenewer(new SFDCSessionRenewer());
LOG.info("Default connection time out value is: " + config.getConnectionTimeout());
config.setConnectionTimeout(ConnectionHandler.MAX_TIME_OUT_IN_MS_INT);
LOG.info("Updated connection time out value(from config.properties file): " + config.getConnectionTimeout());
return config;
}
示例11: login
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private void login(String endpoint) throws ConnectionException {
ConnectorConfig config = new ConnectorConfig();
config.setAuthEndpoint(endpoint);
config.setUsername(username);
config.setPassword(password + securityKey);
config.setConnectionTimeout(60000);
config.setUseChunkedPost(true);
partnerConnection = new PartnerConnection(config);
}
示例12: doConnection
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
/**
* Create a connection with specified connector configuration
*
* @param config connector configuration with endpoint/userId/password
* @param openNewSession whether need to create new session
* @return PartnerConnection object with correct session id
* @throws ConnectionException create connection fails
*/
protected PartnerConnection doConnection(ConnectorConfig config, boolean openNewSession) throws ConnectionException {
if (!openNewSession) {
config.setSessionId(this.sessionId);
config.setServiceEndpoint(this.serviceEndPoint);
} else {
SalesforceConnectionProperties connProps = getConnectionProperties();
String endpoint = connProps.endpoint.getStringValue();
endpoint = StringUtils.strip(endpoint, "\"");
if (SalesforceConnectionProperties.LoginType.OAuth.equals(connProps.loginType.getValue())) {
SalesforceOAuthConnection oauthConnection = new SalesforceOAuthConnection(connProps, endpoint,
connProps.apiVersion.getValue());
oauthConnection.login(config);
} else {
config.setAuthEndpoint(endpoint);
}
}
config.setManualLogin(true);
// Creating connection and not login there.
PartnerConnection connection = new PartnerConnection(config);
// Need to discard manual login parameter in configs to avoid execution errors.
config.setManualLogin(false);
if (null == config.getSessionId()) {
performLogin(config, connection);
}
if (openNewSession && isReuseSession()) {
this.sessionId = config.getSessionId();
this.serviceEndPoint = config.getServiceEndpoint();
if (this.sessionId != null && this.serviceEndPoint != null) {
// update session file with current sessionId/serviceEndPoint
setupSessionProperties(connection);
}
}
return connection;
}
示例13: login
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public MetadataConnection login() throws ConnectionException {
ConnectorConfig partnerConfig = new ConnectorConfig();
partnerConfig.setAuthEndpoint(URL);
partnerConfig.setServiceEndpoint(URL);
partnerConfig.setUsername(USERNAME);
partnerConfig.setPassword(PASSWORD);
partnerConnection = com.sforce.soap.partner.Connector.newConnection(partnerConfig);
LoginResult lr = partnerConnection.login(USERNAME,PASSWORD);
ConnectorConfig metadataConfig = new ConnectorConfig();
metadataConfig.setServiceEndpoint(lr.getMetadataServerUrl());
metadataConfig.setSessionId(lr.getSessionId());
metadataConnection = com.sforce.soap.metadata.Connector.newConnection(metadataConfig);
return metadataConnection;
}
示例14: loginToSalesforce
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private static LoginResult loginToSalesforce() throws ConnectionException {
if(App.sfdcInfo.getLoginResult() == null) {
ConnectorConfig config = new ConnectorConfig();
config.setAuthEndpoint(App.getPartnerUrl());
config.setUsername(App.getUserName());
config.setPassword(App.getUserPassword() + App.getSecurityToken());
partnerConnection = Connector.newConnection(config);
return partnerConnection.login(App.getUserName(), App.getUserPassword() + App.getSecurityToken());
}
else
return App.sfdcInfo.getLoginResult();
}
示例15: createConnectorConfig
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private ConnectorConfig createConnectorConfig(@NotNull InstanceCredentials instanceCredentials, boolean traceMessages) {
ConnectorConfig config = new ConnectorConfig();
// TODO: set proxy!
config.setTraceMessage(traceMessages);
config.setUsername(instanceCredentials.getUsername());
config.setPassword(instanceCredentials.getPassword() + instanceCredentials.getSecurityToken());
config.setAuthEndpoint(InstanceUtils.getSoapLoginUrlForEnvironment(instanceCredentials.getEnvironment()));
return config;
}