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, 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);