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

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

2016.10.14 11:10

회원 조회 수:366

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

현재 베를린 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 17185
공지 유용한 관련 사이트 관리자2 2014.03.20 56060
공지 본 게시판은 개발자 여러분들의 질문과 답변을 공유하는 공간입니다. 관리자 2012.01.10 99498
1053 오라클10g에서 BDE를 사용하려합니다. 별도 BDE 버전이 있는지요? [3] 푸르름 2016.11.22 1624
1052 Access Violation 발생 시 예외발생 위치 찾는 방법이 있어 공유합니다. [2] 나즈나 2016.11.28 1566
1051 델파이 베를린 버젼의 Listview DynamicApperance 버튼 크기조정? [2] silkroad99 2016.11.28 270
1050 Delphi 10.1 Berlin Update2설치후 FireDac으로 MySQL 접속시 오류 [3] 범이 2016.11.28 301
1049 델파이2007에서 프로젝트 실행시 에러 [1] file 신재철 2016.11.28 160
1048 Listview ScrollviewPos 위치 변경 버그인가요? silkroad99 2016.11.29 253
1047 ClientDataSet의 데이터 참조 [1] 나즈나 2016.12.02 118
1046 Modal 창이 뒤로 숨는 현상 원인이 무엇일까요? file 도의 2016.12.02 863
1045 Webbrowser에서 오픈시 과거 데이타를 가져오는 듯한 느낌은? [4] 화이부동 2016.12.06 505
1044 아래 Debug Error 추적 내용이 있어 다른 방법을 공유 합니다. [1] jang 2016.12.06 457
1043 Delphi 10.1 Berlin Enterprise update1 to update2 후 문제 [1] jang 2016.12.07 112
1042 비콘 컴포넌트를 이용한 어플에 대한 질문 드립니다. [1] file 한수 2016.12.07 211
1041 RAD 스튜디오 베를린 10.1에서 인포믹스 DB를 지원하나요? 험프리 2016.12.08 200
1040 Delphi 10.1 Berlin Update2 설치후 WindowsXP 운영체제 오류 발생에 대한 의견 [6] 범이 2016.12.08 485
1039 안녕하세요. 델파이 10.1 베를린 설치 관련하여 질문 드립니다. [5] file 이즈로즈 2016.12.08 636
1038 델파이 10 에서 립모션 설정 방법좀 알고 싶습니다. [1] 한사람 2016.12.12 180
1037 DBMemo 컴퍼넌트에서 엔터키 누를때 음표(♪, 동그라미) 없애는 방법 file 델펀맨 2016.12.12 844
1036 자바 소스를 델파이로 바꿔주는 툴은 있나요? [1] 화이부동 2016.12.13 524
1035 콤보박스의 글자간 간격이 이상합니다. [4] file 떵묻은강아지 2016.12.14 552
1034 [재질문] 콤보박스의 글자와 글자간 간격이 이상합니다. file 떵묻은강아지 2016.12.14 209