内部网络 EOSError 1400

IntraWeb EOSError 1400

我正在尝试创建一个包含 TMS 工作流程的网站。尝试执行工作流时,我遇到了 EOSError 1400 问题。单击按钮启动工作流,然后转到 WorkflowStudio1TaskCreated 过程并继续到 WorkflowStudio1SendMail。然后它因上述错误而崩溃。我做错了什么?

单位代码:

unit Unit1;

interface

uses
  Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes,
  Data.DBXFirebird, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error,
  FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool,
  FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.FB, FireDAC.Phys.FBDef,
  FireDAC.VCLUI.Wait, FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf,
  FireDAC.DApt, Vcl.Controls, IWVCLBaseControl, IWBaseControl,
  IWBaseHTMLControl, IWControl, IWCompButton, Data.DB, FireDAC.Comp.DataSet,
  FireDAC.Comp.Client, Data.SqlExpr, wsDB, wsDbx, wsClasses, wsMain;

type
  TIWForm1 = class(TIWAppForm)
    WorkflowStudio1: TWorkflowStudio;
    WorkflowDBXDB1: TWorkflowDBXDB;
    SQLConnection1: TSQLConnection;
    FDConnectionTMS: TFDConnection;
    FDQueryGET: TFDQuery;
    FDQueryUPDADTE: TFDQuery;
    FDConnectionMedusa: TFDConnection;
    FDQueryGetUsers: TFDQuery;
    FDQueryUsers: TFDQuery;
    FDConnectionUPRO: TFDConnection;
    FDQueryGetUser: TFDQuery;
    qryInsertObject: TFDQuery;
    qryGetZapoUsers: TFDQuery;
    qryGetMedusaUsers: TFDQuery;
    qryGetEmail: TFDQuery;
    IWButton1: TIWButton;
    procedure IWButton1Click(Sender: TObject);
    procedure WorkflowStudio1TaskCreated(Sender: TObject;
      ATaskIns: TTaskInstance);
    procedure WorkflowStudio1SendMail(Sender: TObject; TaskIns: TTaskInstance;
      AUser: TWorkflowUser; AEmailInfo: TEmailInformation; var Sent: Boolean);
  public
  end;

implementation

{$R *.dfm}


procedure TIWForm1.IWButton1Click(Sender: TObject);
var
  Wrkins : TWorkflowInstance;
  t : TTaskInstance;
begin
  WorkflowStudio1.UserManager.Users.Add('1', 'Someone', 'temp@tempo.si');
  Wrkins := WorkflowStudio1.WorkflowManager.CreateWorkflowInstanceByName('Temp');

  Wrkins.Diagram.Variables.FindByName('User').Value := WorkflowStudio1.UserManager.Users.FindById('1').UserName;

  WorkflowStudio1.WorkflowEngine.RunWorkflow(Wrkins);
end;


procedure TIWForm1.WorkflowStudio1SendMail(Sender: TObject;
  TaskIns: TTaskInstance; AUser: TWorkflowUser; AEmailInfo: TEmailInformation;
  var Sent: Boolean);
begin
  WebApplication.ShowMessage('send mail');
  Sent := True;
end;

procedure TIWForm1.WorkflowStudio1TaskCreated(Sender: TObject;
  ATaskIns: TTaskInstance);
begin
  WebApplication.ShowMessage('Task ' + ATaskIns.Key + ' created');
end;

initialization
  TIWForm1.SetAsMainForm;

end.

服务器控制:

unit ServerController;

interface

uses
  SysUtils, Classes, IWServerControllerBase, IWBaseForm, HTTPApp,
  // For OnNewSession Event
  UserSessionUnit, IWApplication, IWAppForm, IW.Browser.Browser;

type
  TIWServerController = class(TIWServerControllerBase)
    procedure IWServerControllerBaseNewSession(ASession: TIWApplication);

  private

  public
  end;


  function UserSession: TIWUserSession;
  function IWServerController: TIWServerController;

implementation

{$R *.dfm}

uses
  IWInit, IWGlobal;

function IWServerController: TIWServerController;
begin
  Result := TIWServerController(GServerController);
end;



function UserSession: TIWUserSession;
begin
  Result := TIWUserSession(WebApplication.Data);
end;

procedure TIWServerController.IWServerControllerBaseNewSession(
  ASession: TIWApplication);
begin
  ASession.Data := TIWUserSession.Create(nil, ASession);
end;


initialization
  TIWServerController.SetServerControllerClass;
end.

并且在 UserSessionUnit 中没有添加任何内容

只是不要试图将所有内容都放入 Web 应用程序中。相反,您可以创建一个单线程/单用户 VCL 或控制台应用程序来承载 TMS 工作流组件,并通过一些进程间通信 (IPC) 接口与 Intraweb 进程通信。

这是复杂 Web 应用程序的常用方法,它也使用异步处理,而不是在 HTTP 请求的上下文中执行所有操作。

阅读示例:Dopplr: - It's made of messages(幻灯片演示)