最新 delphi xe dataSnap callback 问题
delphi xe 增强了callback功能
但是,看李维先生的例子,TDSClientCallbackChannelManager,好像没有用TSQLConnection上的服务器参数
这样,在密码认证的DataSnap  服务器上,就无法使用TDSClientCallbackChannelManager 来注册callback
不知道有没有先知,不吝赐教?

解决方案 »

  1.   

    是的,TDSClientCallbackChannelManager没几个人明白
      

  2.   

    多好的控件啊,可模仿源代码,传个DBXConnection重新写一个回调注入控件
      

  3.   

    delphi XE是没有,但delphi Xe2已经 有了验证,你可以改源码,我现在已经 实现了,是将 dshttpcomm.pas中的 TDSClientCallbackChannelManager类及实现 方法 过程 全部 复制出来新做了一个文件,把类名也要改一下,增加两个username,password属性 
      

  4.   

      TDSClientCallbackChannelManager = class(TComponent)
        strict private
          FSecurityToken: String;
          FDSHostname: String;
          FDSPort: String;
          FDSPath: String;
          FCommunicationProtocol: String;
          FChannelName: String;
          FManagerId: String;
          FConnectionTimeout: String;
          FCommunicationTimeout: String;      FLocalCallbackRepo: TObjectDictionary<String, TDBXCallback>;
          //增加一个
          FDBXConnection:TFDBXConnection;
          
        protected
          ........
          property ConnectionTimeout: String read FConnectionTimeout write FConnectionTimeout;
          property CommunicationTimeout: String read FCommunicationTimeout write FCommunicationTimeout;
         //增加一个
          property  DBXConnection:TFDBXConnection read FDBXConnection write FDBXConnection;  end;
    implementation...procedure TDSClientCallbackChannelManager.ExecuteRemote(const AClassName,
      AMethodName: String; ParamSetup, ParamCheckup: TParamSetup; NoTimeout: boolean);
    var
      DBXConnection: TDBXConnection;
      DBXProperties: TDBXDatasnapProperties;
      DBXCommand: TDBXCommand;
    begin
      DBXProperties := DBXConnectionProperties(NoTimeout);
      try 
        //这里改一下就可以
        if FDBXConnection<>nil then
          DBXConnection := TDBXConnectionFactory.GetConnectionFactory.GetConnection(FDBXConnection.ConnectionProperties)
        else DBXConnection := TDBXConnectionFactory.GetConnectionFactory.GetConnection(DBXProperties);
        try
          DBXCommand := DBXConnection.CreateCommand;
          try
            DBXCommand.CommandType := TDBXCommandTypes.DSServerMethod;
            DBXCommand.Text := Format('%s.%s', [AClassName, AMethodName]);
            DBXCommand.Prepare;        ParamSetup(DBXCommand.Parameters);        DBXCommand.ExecuteUpdate;
            ParamCheckup(DBXCommand.Parameters);
          finally
            try
              DBXCommand.Close;
            except
              // ignore closing exceptions
            end;
            DBXCommand.Free;
          end;
        finally
          try
            DBXConnection.Close;
          except
            // ignore it
          end;
          DBXConnection.Free;
        end;
      finally
        DBXProperties.Free;
      end;
    end;这样改了后我们是可以用,不知道有那位高手可以改一改淡要再建一个连接,而是使用Tsqlconnection建立的那一个连接。
      

  5.   

    anyong001: 我给你发了信息, 聊一下回叫功能