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


Java ConnectorConfig.setServiceEndpoint方法代码示例

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


在下文中一共展示了ConnectorConfig.setServiceEndpoint方法的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);
    }
}
 
开发者ID:springml,项目名称:salesforce-wave-api,代码行数:18,代码来源:SFConfig.java

示例2: login

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public void login(ConnectorConfig connect) {

        switch (connection.oauth2FlowType.getValue()) {
        case JWT_Flow:
            JsonNode accessToken = new SalesforceJwtConnection(connection.oauth2JwtFlow, url).getAccessToken();
            connect.setServiceEndpoint(getSOAPEndpoint(accessToken.get(Oauth2JwtClient.KEY_ID).asText(), //
                    accessToken.get(Oauth2JwtClient.KEY_TOKEN_TYPE).asText(), //
                    accessToken.get(Oauth2JwtClient.KEY_ACCESS_TOKEN).asText(), //
                    apiVersion));
            connect.setSessionId(accessToken.get(Oauth2JwtClient.KEY_ACCESS_TOKEN).asText());
            break;
        case Implicit_Flow:
            SalesforceOAuthAccessTokenResponse token = new SalesforceImplicitConnection(connection.oauth, url).getToken();
            connect.setServiceEndpoint(getSOAPEndpoint(token.getID(), token.getTokenType(), token.getAccessToken(), apiVersion));
            connect.setSessionId(token.getAccessToken());
            break;
        default:
            break;
        }

    }
 
开发者ID:Talend,项目名称:components,代码行数:22,代码来源:SalesforceOAuthConnection.java

示例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());
    } 
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:27,代码来源:Connection.java

示例4: login

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public void login(@NotNull InstanceCredentials instanceCredentials, boolean traceMessages) {
    clearAllConnections();
    ConnectorConfig loginConfig = createConnectorConfig(instanceCredentials, traceMessages);
    try {
        // Create the Enterprise Connection which will log into Salesforce
        enterpriseConnection = Connector.newConnection(loginConfig);

        // Setup the Metadata Connection which will use the session Id from the Enterprise Connection
        ConnectorConfig metadataConfig = createConnectorConfig(instanceCredentials, traceMessages);
        metadataConfig.setSessionId(enterpriseConnection.getConfig().getSessionId());
        metadataConfig.setServiceEndpoint(enterpriseConnection.getConfig().getServiceEndpoint().replace("services/Soap/c", "services/Soap/m"));
        metadataConnection = com.sforce.soap.metadata.Connector.newConnection(metadataConfig);

        // Setup the Apex Connection which will use the session Id from the Enterprise Connection
        ConnectorConfig apexConfig = createConnectorConfig(instanceCredentials, traceMessages);
        apexConfig.setSessionId(enterpriseConnection.getConfig().getSessionId());
        apexConfig.setServiceEndpoint(enterpriseConnection.getConfig().getServiceEndpoint().replace("services/Soap/c", "services/Soap/s"));
        apexConnection = com.sforce.soap.apex.Connector.newConnection(apexConfig);
    } catch (ConnectionException e) {
        logger.error("Unable to login to Salesforce", e);
    }
}
 
开发者ID:polyglot-mark,项目名称:salesforce-plugin,代码行数:23,代码来源:SoapClient.java

示例5: getConnectorConfig

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private static ConnectorConfig getConnectorConfig(String serverUrl, String sessionId)
{
    ConnectorConfig config = new ConnectorConfig();
    config.setServiceEndpoint(serverUrl);
    config.setSessionId(sessionId);
    config.setCompression(true);
    return config;
}
 
开发者ID:forcedotcom,项目名称:scmt-server,代码行数:9,代码来源:SalesforceService.java

示例6: createMetadataConnection

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private void createMetadataConnection()
    throws ConnectionException, AsyncApiException
{
    Utils.log("SalesforceService::createMetadataConnection() entered");
    // check if connection has already been created
    if (getMetadataConnection() != null)
    {
        // connection already created
        return;
    }

    ConnectorConfig config = getConnectorConfig(getServerUrl(), getSessionId());
    config.setServiceEndpoint(getMetadataUrl());

    // check if tracing is enabled
    if (getenv(SALESFORCE_TRACE_METADATA) != null && getenv(SALESFORCE_TRACE_METADATA).equalsIgnoreCase("1"))
    {
        // set this to true to see HTTP requests and responses on stdout
        config.setTraceMessage(true);
        config.setPrettyPrintXml(true);

        // this should only be false when doing debugging.
        config.setCompression(false);
    }

    setMetadataConnection(new MetadataConnection(config));

    // allow partial success
    getMetadataConnection().setAllOrNoneHeader(false);

    // print the endpoint
    Utils.log(
        "\n\tSession ID:            " + getSessionId() +
        "\n\tEndpoint:              " + getServerUrl() +
        "\n\tConnection Session ID: " + _mConn.getConfig().getSessionId() +
        "\n\tAuth Endpoint:         " + _mConn.getConfig().getAuthEndpoint());
}
 
开发者ID:forcedotcom,项目名称:scmt-server,代码行数:38,代码来源:SalesforceService.java

示例7: createMetadataConnection

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private static MetadataConnection createMetadataConnection(
    final LoginResult loginResult) throws ConnectionException {
    final ConnectorConfig config = new ConnectorConfig();
    config.setServiceEndpoint(loginResult.getMetadataServerUrl());
    config.setSessionId(loginResult.getSessionId());
    return new MetadataConnection(config);
}
 
开发者ID:shankar-ray,项目名称:mload,代码行数:8,代码来源:PartnerLogin.java

示例8: 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);
}
 
开发者ID:shankar-ray,项目名称:mload,代码行数:11,代码来源:PartnerLogin.java

示例9: 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);
}
 
开发者ID:takahitomiyamoto,项目名称:salesforce-manifest-generator,代码行数:11,代码来源:LoginUtils.java

示例10: createMetadataConnection

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private static MetadataConnection createMetadataConnection(final LoginResult loginResult)
  throws ConnectionException {
    final ConnectorConfig config = new ConnectorConfig();
    config.setServiceEndpoint(loginResult.getMetadataServerUrl());
    config.setSessionId(loginResult.getSessionId());

    final MetadataConnection metadataConnection = new MetadataConnection(config);
    return metadataConnection;
}
 
开发者ID:takahitomiyamoto,项目名称:salesforce-manifest-generator,代码行数:10,代码来源:LoginUtils.java

示例11: getMetadataConnection

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public static MetadataConnection getMetadataConnection(PartnerConnection pc, SalesforceConfig config) throws ConnectionException {
	LoginResult lr = pc.login(config.getUsername(), config.getPassword());
	ConnectorConfig cc = new ConnectorConfig();
	cc.setUsername(config.getUsername());
	cc.setPassword(config.getPassword());
	cc.setSessionId(lr.getSessionId());
	cc.setServiceEndpoint(lr.getMetadataServerUrl());
	cc.setManualLogin(false);
	MetadataConnection connection = com.sforce.soap.metadata.Connector.newConnection(cc);
	return connection;
}
 
开发者ID:eroispaziali,项目名称:ForceFlow,代码行数:12,代码来源:ConnectionFactory.java

示例12: getToolingConnection

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public static SoapConnection getToolingConnection(PartnerConnection pc, SalesforceConfig config) throws ConnectionException {
	LoginResult lr = pc.login(config.getUsername(), config.getPassword());
	ConnectorConfig toolingConfig = new ConnectorConfig();
	toolingConfig.setSessionId(pc.getSessionHeader().getSessionId());
	toolingConfig.setServiceEndpoint(lr.getServerUrl().replace("Soap/u/", "Soap/s/"));
	toolingConfig.setManualLogin(false);
	SoapConnection soapConnection = Connector.newConnection(toolingConfig);
	return soapConnection;
}
 
开发者ID:eroispaziali,项目名称:ForceFlow,代码行数:10,代码来源:ConnectionFactory.java

示例13: getInstance

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public static PartnerConnectionExt getInstance() throws ConnectionException {
    ConnectorConfig config = new ConnectorConfig();
    config.setUsername("dummy_sf_user");
    config.setPassword("dummy_sf_password");
    config.setManualLogin(true);
    // Salesforce SOAP API checks for /services/Soap/c/
    config.setServiceEndpoint("http://dummysgendpoint/services/Soap/u/");

    return new PartnerConnectionExt(config);
}
 
开发者ID:springml,项目名称:salesforce-wave-api,代码行数:11,代码来源:BaseAPITest.java

示例14: 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

示例15: 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


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