Раздел: Программирование>ВзаимодействиеСОкружением>ActiveX
документация находится в Developer Guide:
Introduction
Перед использованием надо зарегистрировать: запустить Navision Axapta Configuration Utility закладка Business Connector, кнопка Register
пример работы с ABC из /JScript
// создаём экземпляр объектника
var ax=new ActiveXObject("AxaptaCOMConnector.Axapta2");
// подключаемся двухзвенно, указывая путь к конфигурации
ax.Logon2("имя пользователя","ваш пароль","","","","","путь к конфигурации");
// вызываем функцию str2con с параметром "test1, test2"
var ret=ax.CallStaticClassMethod("Global", "str2con", "test1, test2");
// выводим длину результирующего контейнера
WScript.Echo(ret.Length());
{ создайте проект ABC.dpr: }
program ABC;
{$APPTYPE CONSOLE}
uses
SysUtils, ComObj, ActiveX;
var ax, ret: Variant;
begin
CoInitialize(nil);
ax:=CreateOleObject('AxaptaCOMConnector.Axapta2');
ax.Logon2('имя пользователя','пароль','','','','','\\axserver\Axapta\Projects\test.xpo');
ret:=ax.CallStaticClassMethod('Global', 'str2con_RU', 'test1, test2');
WriteLn(ret.Length);
ret:=varNull;
ax:=varNull;
CoUninitialize();
ReadLn;
end.
static void TestCOM2Axapta(Args _args)
{
COM axaptaAppl;
COM axaptaCustTable;
axaptaAppl = new COM("AxaptaCOMConnector.Axapta");
axaptaAppl.logon("gtwy");
axaptaCustTable = axaptaAppl.CreateRecord("CustTable");
axaptaCustTable.ExecuteStmt("select CustTable");
while(axaptaCustTable.found())
{
print axaptaCustTable.Field("AccountNum");
}
pause;
}
<?
error_reporting(0xff);
ini_set('display_errors', 1);
$axp = com_load('AxaptaCOMConnector.Axapta');
$user = new VARIANT('Test');
$empty = new VARIANT();
echo $axp->Logon($user);
echo $axp->CallStaticClassMethod('AA_test22', 'test2');
com_release($axp);
$axp = null;
?>
Линцензии находятся на форме «Лицензионные условия» в Axapta'е. На первой же закладке есть лицензия COM Clients. Закупается на определенное кол-во подключений (в поле статус указывается кол-во закупленных лицензий)
В прайс-листе они называются «COM Пользователи»
Generally, you need to have one COM Client license for each concurrent
Business Connector (Axapta) user. I need to check on whether multiple
connections by the same Axapta user are treated distinctly or as one user as
far as licensing is concerned.
Regarding your second question, it depends on the type of application being developed. If the app just needs sporadic access to Axapta, for example, to retrieve some data which is thereafter manipulated outside of Axapta, then a persistent connection probably isn't warranted. Re-logging on will likely incur some time penalty, but you'd have to assess if this was significantly detrimental. If the application is transactional in nature, then the session would need to be maintained until the transaction is completed.
Buck wrote: