Jump to content

soon

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by soon

  1. May I know what is the best way to develop a multi-module system using UNIGUI ?

    We have to split the system into several modules and handle by different developer.

    Instead of making whole system into one exe, what are the possibility to split them and control by a main menu ?

     

    Example :

     

    <MAIN MENU>

    -> MODULE A

    -> MODULE B

    -> MODULE C

    -> MODULE D

    -> MODULE E

     

    How does UNIGUI link them together with 1 session per user ?

     

    thank you

  2. @soon: yes, the indy http client.

     

    Below is a function I previously used to send SMS via a phone operator web service, using http.get and no ssl:

     

    function TuniMainModule.SendSMS(number, msg:string):string;
    const
      cUSER_AGENT = 'Mozilla/4.0 (MSIE 6.0; Windows NT 5.1)';
    var
     httpResponse: string;
     Stream: TStringStream;
     URL, telParams:string;
     HTTP:TidHTTP;
    begin
      Stream := TStringStream.Create;
      HTTP:=TIdHTTP.Create(nil);
      HTTP.ReadTimeout := 10000;{ IdTimeoutInfinite; }
      HTTP.ConnectTimeout := 10000;
      try
        HTTP.Request.UserAgent := cUSER_AGENT;
        try
          HTTP.Get(URL, Stream);
          result:= Stream.DataString;
        except
          result:= 'SMS Error!';
        end;
      finally
        Stream.Free;
        HTTP.Free;
      end;
    end;
     
    If you want basic http auth then add:
     
    HTTP.Request.BasicAuthentication:=true;
    HTTP.Request.Username:=username;
    HTTP.Request.Password:=pw;
     
    If you need SSL, add:
     
    var
    LHandler: TIdSSLIOHandlerSocketOpenSSL;
    ...
    try
    LHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);

    ...

    HTTP.IOHandler:=LHandler;

    finally

    LHandler.Free;

     

    etc.

     

    If you need to POST, use HTTP.Post(url, aParams, aResponse);

     

    Notice: using GET you have to think about encoding, since this is

    part of the URL, but when using POST there is no worry about that.

    ok, thank you so much for your help :)

  3. I don't have an example right now, but a web service is basically just an HTTP server,

    so use any HTTP client and make a call, and read the result, XML or JSON....parse it,

    push it into a table and refresh the query linked to your grid, and there you have it.

     

    I like using the Indy components, the HTTP client is blocking, so use a thread if you

    have to, but it is very easy to set up and there are tons of examples on the net.

    Do you mean TIdHTTP ? :)

×
×
  • Create New...