当前位置: 首页>>代码示例>>Java>>正文


Java ConnectorConfig.getServiceEndpoint方法代码示例

本文整理汇总了Java中com.sforce.ws.ConnectorConfig.getServiceEndpoint方法的典型用法代码示例。如果您正苦于以下问题:Java ConnectorConfig.getServiceEndpoint方法的具体用法?Java ConnectorConfig.getServiceEndpoint怎么用?Java ConnectorConfig.getServiceEndpoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sforce.ws.ConnectorConfig的用法示例。


在下文中一共展示了ConnectorConfig.getServiceEndpoint方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createBulkConnection

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private BulkConnection createBulkConnection(ConnectorConfig partnerConfig)
        throws AsyncApiException {

    ConnectorConfig config = new ConnectorConfig();
    config.setSessionId(partnerConfig.getSessionId());

    String soapEndpoint = partnerConfig.getServiceEndpoint();
    String restEndpoint = soapEndpoint.substring(
            0, soapEndpoint.indexOf("Soap/")) + "async/" + API_VERSION;
    config.setRestEndpoint(restEndpoint);
    config.setCompression(isCompression);

    config.setTraceMessage(false);

    return new BulkConnection(config);
}
 
开发者ID:mikoto2000,项目名称:embulk-input-salesforce_bulk,代码行数:17,代码来源:SalesforceBulkWrapper.java

示例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;
	}
}
 
开发者ID:sunand85,项目名称:DF14_Demo,代码行数:30,代码来源:SFDCUtil.java

示例3: getBulkConnection

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public static BulkConnection getBulkConnection(
    ConnectorConfig partnerConfig,
    ForceConfigBean conf
) throws ConnectionException, AsyncApiException, StageException, URISyntaxException {
  // When PartnerConnection is instantiated, a login is implicitly
  // executed and, if successful,
  // a valid session is stored in the ConnectorConfig instance.
  // Use this key to initialize a BulkConnection:
  ConnectorConfig config = conf.mutualAuth.useMutualAuth
      ? new MutualAuthConnectorConfig(conf.mutualAuth.getUnderlyingConfig().getSslContext())
      : new ConnectorConfig();
  config.setSessionId(partnerConfig.getSessionId());

  // The endpoint for the Bulk API service is the same as for the normal
  // SOAP uri until the /Soap/ part. From here it's '/async/versionNumber'
  String soapEndpoint = partnerConfig.getServiceEndpoint();
  String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/"))
      + "async/" + conf.apiVersion;
  config.setRestEndpoint(restEndpoint);
  config.setCompression(conf.useCompression);
  config.setTraceMessage(conf.showTrace);
  config.setSessionRenewer(partnerConfig.getSessionRenewer());

  setProxyConfig(conf, config);

  BulkConnection bulkConnection = new BulkConnection(config);

  if (conf.mutualAuth.useMutualAuth) {
    setupMutualAuthBulk(config, conf.mutualAuth);
  }

  return bulkConnection;
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:34,代码来源:ForceUtils.java

示例4: setupMutualAuth

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public static void setupMutualAuth(ConnectorConfig config, MutualAuthConfigBean mutualAuth) throws
    URISyntaxException {
  String serviceEndpoint = config.getServiceEndpoint();
  config.setTransportFactory(new ClientSSLTransportFactory(mutualAuth.getUnderlyingConfig().getSslContext()));
  config.setServiceEndpoint(changePort(serviceEndpoint, MUTUAL_AUTHENTICATION_PORT));

  LOG.debug("Set Service Endpoint to {} for Mutual Authentication", config.getServiceEndpoint());
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:9,代码来源:ForceUtils.java

示例5: connectBulk

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
protected BulkConnection connectBulk(ConnectorConfig config) throws ComponentException {
    /*
     * When PartnerConnection is instantiated, a login is implicitly executed and, if successful, a valid session is
     * stored in the ConnectorConfig instance. Use this key to initialize a BulkConnection:
     */
    ConnectorConfig bulkConfig = new ConnectorConfig();
    bulkConfig.setSessionId(config.getSessionId());
    // For session renew
    bulkConfig.setSessionRenewer(config.getSessionRenewer());
    bulkConfig.setUsername(config.getUsername());
    bulkConfig.setPassword(config.getPassword());
    /*
     * The endpoint for the Bulk API service is the same as for the normal SOAP uri until the /Soap/ part. From here
     * it's '/async/versionNumber'
     */
    String soapEndpoint = config.getServiceEndpoint();
    // set it by a default property file
    String api_version = "34.0";
    String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/")) + "async/" + api_version;
    bulkConfig.setRestEndpoint(restEndpoint);
    bulkConfig.setCompression(true);// This should only be false when doing debugging.
    bulkConfig.setTraceMessage(false);
    bulkConfig.setValidateSchema(false);
    try {
        return new BulkConnection(bulkConfig);
    } catch (AsyncApiException e) {
        throw new ComponentException(e);
    }
}
 
开发者ID:Talend,项目名称:components,代码行数:30,代码来源:SalesforceDataprepSource.java

示例6: connectBulk

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
protected BulkConnection connectBulk(ConnectorConfig config) throws ComponentException {
    final SalesforceConnectionProperties connProps = getConnectionProperties();
    /*
     * When PartnerConnection is instantiated, a login is implicitly executed and, if successful, a valid session id is
     * stored in the ConnectorConfig instance. Use this key to initialize a BulkConnection:
     */
    ConnectorConfig bulkConfig = new ConnectorConfig();
    setProxy(bulkConfig);
    bulkConfig.setSessionId(config.getSessionId());
    // For session renew
    bulkConfig.setSessionRenewer(config.getSessionRenewer());
    bulkConfig.setUsername(config.getUsername());
    bulkConfig.setPassword(config.getPassword());
    /*
     * The endpoint for the Bulk API service is the same as for the normal SOAP uri until the /Soap/ part. From here
     * it's '/async/versionNumber'
     */
    String soapEndpoint = config.getServiceEndpoint();
    // Service endpoint should be like this:
    // https://ap1.salesforce.com/services/Soap/u/37.0/00D90000000eSq3
    String apiVersion = soapEndpoint.substring(soapEndpoint.lastIndexOf("/services/Soap/u/") + 17);
    apiVersion = apiVersion.substring(0, apiVersion.indexOf("/"));
    String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/")) + "async/" + apiVersion;
    bulkConfig.setRestEndpoint(restEndpoint);
    // This should only be false when doing debugging.
    bulkConfig.setCompression(connProps.needCompression.getValue());
    bulkConfig.setTraceMessage(connProps.httpTraceMessage.getValue());
    bulkConfig.setValidateSchema(false);
    try {
        return new BulkConnection(bulkConfig);
    } catch (AsyncApiException e) {
        throw new ComponentException(e);
    }
}
 
开发者ID:Talend,项目名称:components,代码行数:35,代码来源:SalesforceSourceOrSink.java

示例7: 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;
}
 
开发者ID:Talend,项目名称:components,代码行数:45,代码来源:SalesforceSourceOrSink.java

示例8: executeAnonymous

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public ExecuteAnonymousResultExt executeAnonymous(String code, LogInfo[] logInfo, Connection connection,
        int readTimeout) {
    ConnectorConfig connectorConfig = connection.getConnectorConfig();
    
    boolean orig_traceMsg = connectorConfig.isTraceMessage();
    boolean orig_prettyPrintXml = connectorConfig.isPrettyPrintXml();
    String orig_sessionId = connectorConfig.getSessionId();
    String orig_serviceEndpoint = connectorConfig.getServiceEndpoint();
    int orig_readTimeout = connectorConfig.getReadTimeout();
    
    connectorConfig.setTraceMessage(true);
    connectorConfig.setPrettyPrintXml(true);
    connectorConfig.setSessionId(connection.getSessionId());
    connectorConfig.setServiceEndpoint(connection.getApexServiceEndpoint(connection.getServiceEndpoint()));
    connectorConfig.setReadTimeout(readTimeout);
    
    SoapConnection apex = null;
    try {
        apex = Connector.newConnection(connectorConfig);
        apex.setDebuggingHeader(logInfo, LogType.None);
        return new ExecuteAnonymousResultExt(apex.executeAnonymous(code), apex.getDebuggingInfo());
    } catch (ConnectionException e) {
        ExecuteAnonymousResult er = errorExecuteAnonymousResult(connectorConfig, e);
        ExecuteAnonymousResultExt erx = new ExecuteAnonymousResultExt(er, null == apex ? null : apex.getDebuggingInfo());
        DebuggingInfo_element dbi = new DebuggingInfo_element();
        dbi.setDebugLog(e.getMessage());
        erx.setDebugInfo(dbi);
        return erx;
    } finally {
        connectorConfig.setTraceMessage(orig_traceMsg);
        connectorConfig.setPrettyPrintXml(orig_prettyPrintXml);
        connectorConfig.setSessionId(orig_sessionId);
        connectorConfig.setServiceEndpoint(orig_serviceEndpoint);
        connectorConfig.setReadTimeout(orig_readTimeout);
    }
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:37,代码来源:ApexService.java

示例9: getBulkConnection

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
/**
 * Create the BulkConnection used to call Bulk API operations.
 */
private BulkConnection getBulkConnection(String userName, String password)
    throws ConnectionException, AsyncApiException {
    ConnectorConfig partnerConfig = new ConnectorConfig();
    partnerConfig.setUsername(userName);
    partnerConfig.setPassword(password);
    partnerConfig.setAuthEndpoint("https://login.salesforce.com/services/Soap/u/34.0");
    // Creating the connection automatically handles login and stores
    // the session in partnerConfig
    partnerConnection = new PartnerConnection(partnerConfig);
    // When PartnerConnection is instantiated, a login is implicitly
    // executed and, if successful,
    // a valid session is stored in the ConnectorConfig instance.
    // Use this key to initialize a BulkConnection:
    ConnectorConfig config = new ConnectorConfig();
    config.setSessionId(partnerConfig.getSessionId());
    // The endpoint for the Bulk API service is the same as for the normal
    // SOAP uri until the /Soap/ part. From here it's '/async/versionNumber'
    String soapEndpoint = partnerConfig.getServiceEndpoint();
    String apiVersion = "34.0";
    String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/"))
        + "async/" + apiVersion;
    config.setRestEndpoint(restEndpoint);
    // This should only be false when doing debugging.
    config.setCompression(true);
    // Set this to true to see HTTP requests and responses on stdout
    config.setTraceMessage(false);
    BulkConnection connection = new BulkConnection(config);
    return connection;
}
 
开发者ID:mikoto2000,项目名称:MiscellaneousStudy,代码行数:33,代码来源:BulkInsertMain.java

示例10: initSalesforceConnection

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
protected void initSalesforceConnection() {
	try {
		long startTime = System.nanoTime();
		String username = getProject().getProperty(SF_USER_PROPERTY_NAME);
		String password = getProject().getProperty(SF_PASSWORD_PROPERTY_NAME);
		String serverUrl = getProject().getProperty(SF_SERVER_URL_PROPERTY_NAME);

		if (username == null || username.length() < 1) {
			throw new BuildException("The " + SF_USER_PROPERTY_NAME + " Salesforce username property is not set.");
		}
		if (password == null || password.length() < 1) {
			throw new BuildException("The " + SF_PASSWORD_PROPERTY_NAME + " Salesforce password property is not set.");
		}
		if (serverUrl == null || serverUrl.length() < 1) {
			throw new BuildException("The " + SF_SERVER_URL_PROPERTY_NAME + " Salesforce server url property is not set.");
		}

		ConnectorConfig config = new ConnectorConfig();
		config.setUsername(username);
		config.setPassword(password);
		config.setAuthEndpoint(serverUrl);

		partnerConnection = new PartnerConnection(config);
		
		String serviceEndpoint = config.getServiceEndpoint();
		
		ConnectorConfig metadataConfig = new ConnectorConfig();
		metadataConfig.setSessionId(partnerConnection.getSessionHeader().getSessionId());
		String metaEndpoint = serviceEndpoint.replace("/u/", "/m/");
		metadataConfig.setServiceEndpoint(metaEndpoint);

		metadataConnection = new MetadataConnection(metadataConfig);

		ConnectorConfig toolingConfig = new ConnectorConfig();
		toolingConfig.setSessionId(partnerConnection.getSessionHeader().getSessionId());
		String toolingEndpoint = serviceEndpoint.replace("/u/", "/T/");
		toolingConfig.setServiceEndpoint(toolingEndpoint);

		toolingConnection = new ToolingConnection(toolingConfig);
		
		int lastSlash = serverUrl.lastIndexOf("/");
		if (lastSlash > 0) {
			String asOfVersionString = serverUrl.substring(lastSlash + 1);
			asOfVersion = Double.parseDouble(asOfVersionString);
		}
		long elapsedTime = System.nanoTime() - startTime;
		log("Connected to Salesforce [" + TimeUnit.NANOSECONDS.toMillis(elapsedTime) + " ms]");
	} catch (Exception ex) {
		ex.printStackTrace();
		throw new BuildException("Error trying to connect to Salesforce.");
	}
}
 
开发者ID:YBS,项目名称:YBS-SFDC-Build,代码行数:53,代码来源:SalesforceTask.java

示例11: bulkApiLogin

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
/**
 * Login to salesforce
   * @return login status
 */
public boolean bulkApiLogin() throws Exception {
  this.log.info("Authenticating salesforce bulk api");
  boolean success = false;
  String hostName = this.workUnit.getProp(ConfigurationKeys.SOURCE_CONN_HOST_NAME);
  String apiVersion = this.workUnit.getProp(ConfigurationKeys.SOURCE_CONN_VERSION);
  if (Strings.isNullOrEmpty(apiVersion)) {
    apiVersion = "29.0";
  }

  String soapAuthEndPoint = hostName + SALESFORCE_SOAP_AUTH_SERVICE + "/" + apiVersion;
  try {
    ConnectorConfig partnerConfig = new ConnectorConfig();
    if (super.workUnitState.contains(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL)
        && !super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL).isEmpty()) {
      partnerConfig.setProxy(super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL),
          super.workUnitState.getPropAsInt(ConfigurationKeys.SOURCE_CONN_USE_PROXY_PORT));
    }

    partnerConfig.setUsername(this.workUnit.getProp(ConfigurationKeys.SOURCE_CONN_USERNAME));
    partnerConfig.setPassword(PasswordManager.getInstance(this.workUnit)
        .readPassword(this.workUnit.getProp(ConfigurationKeys.SOURCE_CONN_PASSWORD)));
    partnerConfig.setAuthEndpoint(soapAuthEndPoint);
    PartnerConnection connection = new PartnerConnection(partnerConfig);
    String soapEndpoint = partnerConfig.getServiceEndpoint();
    String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/")) + "async/" + apiVersion;

    ConnectorConfig config = new ConnectorConfig();
    config.setSessionId(partnerConfig.getSessionId());
    config.setRestEndpoint(restEndpoint);
    config.setCompression(true);
    config.setTraceFile("traceLogs.txt");
    config.setTraceMessage(false);
    config.setPrettyPrintXml(true);

    if (super.workUnitState.contains(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL)
        && !super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL).isEmpty()) {
      config.setProxy(super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL),
          super.workUnitState.getPropAsInt(ConfigurationKeys.SOURCE_CONN_USE_PROXY_PORT));
    }

    this.bulkConnection = new BulkConnection(config);
    success = true;
  } catch (Exception e) {
    throw new Exception("Failed to connect to salesforce bulk api; error - " + e.getMessage(), e);
  }
  return success;
}
 
开发者ID:Hanmourang,项目名称:Gobblin,代码行数:52,代码来源:SalesforceExtractor.java

示例12: bulkApiLogin

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
/**
 * Login to salesforce
 * @return login status
 */
public boolean bulkApiLogin() throws Exception {
  log.info("Authenticating salesforce bulk api");
  boolean success = false;
  String hostName = this.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_HOST_NAME);
  String apiVersion = this.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_VERSION);
  if (Strings.isNullOrEmpty(apiVersion)) {
    apiVersion = "29.0";
  }

  String soapAuthEndPoint = hostName + SALESFORCE_SOAP_AUTH_SERVICE + "/" + apiVersion;
  try {
    ConnectorConfig partnerConfig = new ConnectorConfig();
    if (super.workUnitState.contains(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL)
        && !super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL).isEmpty()) {
      partnerConfig.setProxy(super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL),
          super.workUnitState.getPropAsInt(ConfigurationKeys.SOURCE_CONN_USE_PROXY_PORT));
    }

    String securityToken = this.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_SECURITY_TOKEN);
    String password = PasswordManager.getInstance(this.workUnitState)
        .readPassword(this.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_PASSWORD));
    partnerConfig.setUsername(this.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USERNAME));
    partnerConfig.setPassword(password + securityToken);
    partnerConfig.setAuthEndpoint(soapAuthEndPoint);
    new PartnerConnection(partnerConfig);
    String soapEndpoint = partnerConfig.getServiceEndpoint();
    String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/")) + "async/" + apiVersion;

    ConnectorConfig config = new ConnectorConfig();
    config.setSessionId(partnerConfig.getSessionId());
    config.setRestEndpoint(restEndpoint);
    config.setCompression(true);
    config.setTraceFile("traceLogs.txt");
    config.setTraceMessage(false);
    config.setPrettyPrintXml(true);

    if (super.workUnitState.contains(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL)
        && !super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL).isEmpty()) {
      config.setProxy(super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL),
          super.workUnitState.getPropAsInt(ConfigurationKeys.SOURCE_CONN_USE_PROXY_PORT));
    }

    this.bulkConnection = new BulkConnection(config);
    success = true;
  } catch (RuntimeException e) {
    throw new RuntimeException("Failed to connect to salesforce bulk api; error - " + e, e);
  }
  return success;
}
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:54,代码来源:SalesforceExtractor.java


注:本文中的com.sforce.ws.ConnectorConfig.getServiceEndpoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。