자유롭게 질의 및 응답을 할 수 있는 게시판입니다. 개발자 여러분의 답변이 큰 도움이 됩니다. 
  • 제품설치/등록 오류 문의: 설치/등록 Q&A 이용 (제품 구매 고객 한정)

Delphi 데이터스냅 콜백 오류 문의

2016.10.14 11:10

회원 조회 수:379

본 게시판 사용시 당부 사항
* 이 게시판은 자유롭게 질문을 올리고 자발적으로 답변을 공유하는 게시판입니다.
* 어느 누구도 답변을 달아야만 하는 책임은 없습니다.
* 따라서 질문을 올리실 때에는 최대한 자세하고 정중하게 질문을 올려 주세요.
* 최대한 질문을 자세히 올려야 답변도 자세히 올라 옵니다.
* 본 질문에 답변을 주시는 여러 개발자님들께 미리 감사드립니다.
-----------------------------------------------------------------------------------------------

현재 베를린 10.1 update 1 버전을 사용중입니다.

엠바코데로 홈페이지에서 데이터스냅 콜백 관련 예제를 다운로드 받아 테스트 중 오류가 있어 문의 드립니다.

샘플코드를 다운받아 컴파일 후 다 정상 작동하는데 NotifyCallback 메서드를 이용해서 클라이언트간에 콜백함수를

호출할경우 오류가 발생합니다. 동영상을 보면 분명 정상 작동하는데 안되네요. 베를린 10.1 버전에서 버그로 인한건지

아니면 다른 설정이 있는건지 알고 싶습니다.

테스트한 예제 소스를 같이 첨부합니다.

 

다운받은 샘플 url: http://edn.embarcadero.com/article/41374

오류 메시지 : 'Remote error: VAR and OUT arguments must match parameter type exactly'

 


procedure TFormClient.ButtonNotifyClick(Sender: TObject);
var AClient: TDSAdminClient; aResponse: TJSONValue;
begin
  AClient := TDSAdminClient.Create(SQLConnection1.DBXConnection);
  try
    AClient.NotifyCallback(
      DSClientCallbackChannelManager1.ChannelName,
      EditDestinationClientId.Text,
      EditDestinationCallbackId.Text,
      TJSONString.Create(EditMsg.Text),
      aResponse
    );
  finally
    AClient.Free;
  end;
end;

 

28288_delphi_labs_datasnap_xe_xe3_callbacks (1).ZIP

 

참고로 테스트한 소스코드 입니다. NotifyCallback 호출시 오류가 발생합니다.

 

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
unit FormClientUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DBXDataSnap, DBXCommon, DB, SqlExpr, DBXJSON, StdCtrls,
  DSHTTPCommon, DSService, DSProxy;

type
  TMyCallback = class(TDBXCallback)
  public
    function Execute(const Arg: TJSONValue): TJSONValue; override;
  end;

  TFormClient = class(TForm)
    SQLConnection1: TSQLConnection;
    MemoLog: TMemo;
    DSClientCallbackChannelManager1: TDSClientCallbackChannelManager;
    ButtonBroadcast: TButton;
    EditMsg: TEdit;
    Label2: TLabel;
    ButtonNotify: TButton;
    Label1: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    EditLocalClientId: TEdit;
    EditLocalCallbackId: TEdit;
    EditDestinationCallbackId: TEdit;
    EditDestinationClientId: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure ButtonBroadcastClick(Sender: TObject);
    procedure ButtonNotifyClick(Sender: TObject);
  private
    FMyCallbackName: string;
  public
    procedure LogMsg(const s: string);
    procedure QueueLogMsg(const s: string);
  end;

var
  FormClient: TFormClient;

implementation

{$R *.dfm}

{ TMyCallback }

function TMyCallback.Execute(const Arg: TJSONValue): TJSONValue;
begin
  FormClient.QueueLogMsg(Arg.ToString);
  Result := TJSONTrue.Create;
end;

{ TFormClient }

procedure TFormClient.ButtonBroadcastClick(Sender: TObject);
var AClient: TDSAdminClient;
begin
  AClient := TDSAdminClient.Create(SQLConnection1.DBXConnection);
  try
    AClient.BroadcastToChannel(
      DSClientCallbackChannelManager1.ChannelName,
      TJSONString.Create(EditMsg.Text)
    );
  finally
    AClient.Free;
  end;
end;

procedure TFormClient.ButtonNotifyClick(Sender: TObject);
var AClient: TDSAdminClient; aResponse: TJSONValue;
begin
  AClient := TDSAdminClient.Create(SQLConnection1.DBXConnection);
  try
    AClient.NotifyCallback(
      DSClientCallbackChannelManager1.ChannelName,
      EditDestinationClientId.Text,
      EditDestinationCallbackId.Text,
      TJSONString.Create(EditMsg.Text),
      aResponse
    );
  finally
    AClient.Free;
  end;
end;

procedure TFormClient.FormCreate(Sender: TObject);
begin
  FMyCallbackName := TDSTunnelSession.GenerateSessionId;
  DSClientCallbackChannelManager1.ManagerId := TDSTunnelSession.GenerateSessionId;
  DSClientCallbackChannelManager1.RegisterCallback(
    FMyCallbackName,
    TMyCallback.Create
  );

  EditLocalClientId.Text := DSClientCallbackChannelManager1.ManagerId;
  EditLocalCallbackId.Text := FMyCallbackName;
  EditDestinationClientId.Text := '';
  EditDestinationCallbackId.Text := '';
end;

procedure TFormClient.LogMsg(const s: string);
begin
  MemoLog.Lines.Add(DateTimeToStr(Now) + ': ' + s);
end;

procedure TFormClient.QueueLogMsg(const s: string);
begin
  TThread.Queue(nil,
    procedure
    begin
      LogMsg(s)
    end
  );
end;

end.
번호 제목 글쓴이 날짜 조회 수
공지 [프로그래밍 강의] 2021.6~2021.12 관리자 2015.01.22 19791
공지 유용한 관련 사이트 관리자2 2014.03.20 58762
공지 본 게시판은 개발자 여러분들의 질문과 답변을 공유하는 공간입니다. 관리자 2012.01.10 102315
1539 embarcadero RAD studio xe7 어플관련(c++ Builder XE7) [2] 상쵸리 2017.01.04 252
1538 시애틀을 사용하고 있는데, 베를린 업데이트2를 설치하려고 합니다. 삭제 후 설치해야 하나요? 관리자 2017.01.05 118
1537 C++ 빌더에서 델파이 소스를 보다가 다시 빌드를 하면 에러 발생 techwon 2017.01.05 151
1536 안드로이드에서 앱 설치 시 External에 저장하게 하는 방법입니다. file 푸른솔 2017.01.05 350
1535 1개의 LIcense로 C++ Builder와 Delphi 사용이 가능한지? [3] techwon 2017.01.05 180
1534 exe파일의 폼(TForm) 리소스(RCDATA) 포함안되게 하는 방법은 [3] file 미스터몽키 2017.01.09 983
1533 [FireDAC][Phys][Ora]-315. Cannot get vendor library entry point[s]. 오류 대처방법 [1] 험프리 2017.01.11 555
1532 Java2OP 상쵸리 2017.01.11 147
1531 델파이 Xe 10.1를 사용시 이 컴파일 에라는 어떻게 해야하는가요? [2] file 화이부동 2017.01.12 279
1530 베를린 update2 후 SqlConnect 컴포넌트가 없어요(DBexpress) 모나도 2017.01.14 133
1529 delphi 7 구버전 설치 완료 후 실행시 문제 발생 [1] file 라신 2017.01.16 367
1528 XE7에서 마리아디비(MariaDB) 10버전은 연결 못하나요?? [1] file 스머프 2017.01.16 923
1527 XE버전별 차이점 관련 문의 드립니다. [1] moduware03 2017.01.17 1158
1526 [마이그레이션] bpr 파일(C++빌더 6.0)을 10.1 베를린에서 열수 없어요. 험프리 2017.01.18 559
1525 [컴포넌트] 이미지 회전, 확대/축소 등을 지원하는 컴포넌트 [1] file 험프리 2017.01.18 1044
1524 Delphi IDE 환경의 popup 창의 글씨가 너무큼니다 [2] file 라신 2017.01.18 291
1523 컴파일 시 "Object reference not set to an instance of an object" 오류가 발생합니다. file 험프리 2017.01.19 519
1522 TIdHTTP로 웹서버에 배열로 호출을 할 수 있나요? [1] 데브기어 2017.01.20 381
1521 FireDAC 질문입니다. [4] 황금의미르 2017.01.20 365
1520 2017-1-11 RAD Studio 10.1 Berlin 핫픽스가 나왔네요. 얄리 2017.01.23 184