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


Java ConnectorConfig.setPrettyPrintXml方法代码示例

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


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

示例1: 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;
}
 
开发者ID:PDI-DGS-Protolab,项目名称:esper-salesforce,代码行数:25,代码来源:SalesforceClient.java

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

示例3: createPartnerConnection

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private void createPartnerConnection() throws ConnectionException
{
    // check if connection has already been created
    if (getPartnerConnection() != null)
    {
        // connection already created
        return;
    }

    // print the info we will use to build the connection
    Utils.log("SalesforceService::createPartnerConnection() entered" + "\n\tSession ID:       "
        + getSessionId() + "\n\tPartner Endpoint: " + getServerUrl());

    // create partner connector configuration
    ConnectorConfig partnerConfig = getConnectorConfig(getServerUrl(), getSessionId());

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

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

    setPartnerConnection(new PartnerConnection(partnerConfig));

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

    // truncate fields that are too long
    getPartnerConnection().setAllowFieldTruncationHeader(true);
}
 
开发者ID:forcedotcom,项目名称:scmt-server,代码行数:36,代码来源:SalesforceService.java

示例4: createBulkConnection

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private void createBulkConnection() throws AsyncApiException
{
    // check if connection has already been created
    if (getBulkConnection() != null)
    {
        // connection already created
        return;
    }

    // print the info we will use to build the connection
    Utils.log("SalesforceService::createBulkConnection() entered" + "\n\tSession ID:    " + getSessionId()
        + "\n\tBulk Endpoint: " + getBulkEndpoint());

    // create partner connector configuration
    ConnectorConfig bulkConfig = getConnectorConfig(getServerUrl(), getSessionId());
    bulkConfig.setSessionId(getSessionId());
    bulkConfig.setRestEndpoint(getBulkEndpoint());
    bulkConfig.setCompression(true);

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

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

    setBulkConnection(new BulkConnection(bulkConfig));
}
 
开发者ID:forcedotcom,项目名称:scmt-server,代码行数:33,代码来源:SalesforceService.java

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

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

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