本文整理汇总了Java中com.sforce.soap.apex.SoapConnection类的典型用法代码示例。如果您正苦于以下问题:Java SoapConnection类的具体用法?Java SoapConnection怎么用?Java SoapConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SoapConnection类属于com.sforce.soap.apex包,在下文中一共展示了SoapConnection类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.sforce.soap.apex.SoapConnection; //导入依赖的package包/类
@Override
public void execute() throws BuildException {
checkCronExpression();
checkScheduleName();
try {
SoapConnection tc = ConnectionFactory.getToolingConnection(getConfig());
String apexCode = String.format(SCHEDULE_APEX, className, className, scheduleName, cron);
executeApex(tc, apexCode);
log(String.format("%s has been scheduled",scheduleName));
} catch (ConnectionException e) {
handleException(e);
}
}
示例2: getToolingConnection
import com.sforce.soap.apex.SoapConnection; //导入依赖的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;
}
示例3: executeApex
import com.sforce.soap.apex.SoapConnection; //导入依赖的package包/类
protected void executeApex(SoapConnection tc, String apexCode) throws BuildException {
try {
ExecuteAnonymousResult result = tc.executeAnonymous(apexCode);
if (!result.isSuccess()) {
String error = result.isCompiled() ? result.getExceptionMessage() : result.getCompileProblem();
throw new BuildException(error);
}
} catch (ConnectionException e) {
handleException(e);
}
}
示例4: executeAnonymous
import com.sforce.soap.apex.SoapConnection; //导入依赖的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);
}
}
示例5: execute
import com.sforce.soap.apex.SoapConnection; //导入依赖的package包/类
public void execute() {
try {
if (fileName != null && ! fileName.isEmpty()) {
code = new Scanner(new File(fileName)).useDelimiter("\\A").next();
}
SoapConnection connection = getApexConnection();
LogInfo infoApex = new LogInfo();
infoApex.setCategory(LogCategory.Apex_code);
infoApex.setLevel(LogCategoryLevel.Finest);
LogInfo infoDB = new LogInfo();
infoDB.setCategory(LogCategory.Db);
infoDB.setLevel(LogCategoryLevel.Finest);
connection.setDebuggingHeader(new LogInfo[] { infoApex, infoDB }, LogType.Detail);
ExecuteAnonymousResult result = connection.executeAnonymous(code);
if (result.isSuccess()) {
log(connection.getDebuggingInfo().getDebugLog());
log("Success");
} else {
throw new BuildException(result.getExceptionMessage());
}
} catch (ConnectionException e) {
log("Note: use ant -verbose to get more information on the failure");
throw new BuildException("Failed: " + e.getMessage(), e);
} catch (IOException ioe) {
log(ioe.getMessage());
}
}
示例6: setCallOptions
import com.sforce.soap.apex.SoapConnection; //导入依赖的package包/类
public void setCallOptions(SoapConnection apexConnection, String clientId) throws ForceConnectionException {
apexConnection.setCallOptions(clientId, null, null);
}