Jump to content

al17nichols

Members
  • Content Count

    30
  • Joined

  • Last visited

Posts posted by al17nichols


  1. I did some digging on the rest components an observed that getfullrequesturl never displayed the parameters and values when attempting to see what is actually being passed to the server.  Is there a property that changes the post to https instead of http?  Lastly when I right clicked the restrequest and selected with test data I did get results that began with "Data":{"AccessToken":"eyJhbGciOiJfolllowed by a long string of token information...."}.  Where do I input parameters and parameter values?  I tried to retrieve the data using RESTResponse1.GetSimpleValue('Data', LToken) or RESTResponse1.GetSimpleValue('AccessToken', LToken) .  Never was able to retrieve the data using this process.  If anyone know how to retrieve this data please let me know. 

     

    FYI there are 4 questions detailed here.  Please help.


  2. I am accessing a web end webservice.  Unlike the sample projects that I have seen which download a json file, I need to access the endpoint, grab a token, request other identifiers with the token, finally use the token with other parameters to retrieve JSON data from an endpoint.  Would this be accomplished with TRestClient, TRestRequest, TRestResponse components as configured in the example projects or would another approach be taken.  If I used the referenced VCL components I would have to use multiple sets of the 3 components or change the parameters to resubmit requests to the endpoint for the different pieces of data. 

     

    Can somebody advise the best approach to retrieve the desired results.  It is acceptable to recommend another approach altogether if it is the best approach.

     

     


  3. I managed to solve this by correcting the a few of the properties and now I received the expected results.  My remaining question is how do I know that exact statements are sent to the server?  Is there a way to know what XML, JSON are we submitting to the endpoint?


  4. I have the parameters you described, but I received response that it does not support method get.  I have the mentioned credentials and supplied them as parameters to the trestrequest component with the parameters method property set as rm post.

     
       
    Message "The requested resource does not support http method 'GET'."

  5. I have a url, parameters that I want to sent do an endpoint with the post command and receive a response token.  I placed the url in the restclient with the endpoint as https://bbb.domainx.com/v31/api/auth.  I added individual parameters.  I assigned the method as rmpost ( i tried it as rmget ) in neither case did it work.  I receive 404 Not found.  Anybody know what I am doing wrong?  Also. how can I find the resulting json that is being sent to the website (for trouble shooting purposes)?


  6. Has anybody had experience creating a Delphi application that can respond to a Twilio Webhook?  Looking to gain any insight as to how I can create a small application that enables me to know when there is a message coming from Twilio.

     

    Thanks


  7. On 8/19/2022 at 12:30 AM, Rollo62 said:

    My guess from your rough description is that you want to store data locally

    which might sum up day by day to a huge number.

    In that case I think a real capable local DB, like Sqlite, should be preferred over an in-memory TFdMemTable.

    everyday the memory data is flushed.  Only newly generated data is stored in the memory or db that I want to create.


  8. below is the server send file code and the client receive code.  forgive me. This was done before I knew much about indy.

    Server side send file
    TmpFileFS : TFileStream ;

      if FileExists( FilePath+FileName ) then
        Connection.IOHandler.WriteLn( Format( XMLHead + XMLTail, ['SPS_AttachGetFileRS', 'ResponseType="[1]" MSG="1" Ack="1"', 'SPS_AttachGetFileRS'] ))
      else
        Connection.IOHandler.WriteLn( Format( XMLHead + XMLTail, ['SPS_AttachGetFileRS', 'ResponseType="[1]" MSG="1" Ack="0"', 'SPS_AttachGetFileRS'] )) ;

      if FileExists( FilePath+FileName ) then
        begin
        TmpFileFS := TFileStream.Create( FilePath + FileName, fmOpenRead );
        Try
          // AContext.Connection.IOHandler.WriteLn( Format( XMLHead + XMLTail, ['SPS_AttachFileXferRS', 'ResponseType="[1]" MSG="1" ' + 'FileName="' + TmpFile + '"', 'SPS_AttachFileXferRS'] )) ;
          Connection.IOHandler.Write( TmpFileFS );
          //  AContext.Connection.IOHandler.WriteLn( Format( XMLHead + XMLTail, ['SPS_AttachFileXferRS', 'ResponseType="[1]" MSG="1" ' + 'Ack="1"', 'SPS_AttachFileXferRS'] )) ;
        Finally
          TmpFileFS.Free ;

     


    client side receive file
    /*Plain message sent requesing file by name ;*/
    /* XML response received below at readln */
    --->MsgResp := frmTuner.CommMsgInt.IOHandler.Readln ;
     if Length(MsgResp) = 0 then
       raise Exception.Create('File Not Located');
     VarList := TList.Create ;
     New( XMLVars ) ;
     XMLVars.VarName := 'SPS_AttachGetFileRS' ;
     XMLVars.AttNode := xxXMLNode ;
     XMLVars.VarValue := '' ;
     VarList.Add( XMLVars ) ;
     New( XMLVars ) ;
     XMLVars.VarName := 'Ack' ;
      XMLVars.AttNode := xxXMLAttrib ;
      XMLVars.VarValue := '' ;
      VarList.Add( XMLVars ) ;
      XMLMsgToTxt( MsgResp, VarList ) ;
      MsgResp := PXMLInfo( VarList[1]).VarValue  ;
      if MsgResp = '1' then  /* if value is 1 the file was located
        begin
        /* the filesize and other info was stored in the database  */
        xFerStream := TFileStream.Create( TempDir + FileName, fmCreate ) ;
     --->   frmTuner.CommMsgInt.IOHandler.ReadStream( XferStream, FileSize ,false );
        XFerStream.Free ;


  9. 20 hours ago, haentschman said:

    Hi...😎

    1. multiuser?

    2. server?...other maschine?

    3. persistent data? ...or daily?

    4. program crash? ...which data?

    Only accessed on the server by a threaded process.  Multiple connections via socket make be requesting data from the memory or sql lite store.  Want to use memory for quick access.  If the program crashes or the system is restarted the data needed will be rebuilt from a SQL database.


  10. the IOHandler referenced points to the tidtpclient with a designated port.  Transferring a file using the filestream.  The server sends the filesize a little earlier in a message that is wrapped in XML to include other information prior to the server (tidtcpserver) sending the actual file.  The receive does not send any information at the end of the transfer (interesting idea) at the current time.  The problem may occur that the transfer gets disrupted for some reason and I want to continue to use the connection by flushing any remaining data.  FYI: I read the remainder of your message and see that I need to add a message or something to indicate that the transfer has ended.


  11. Hello Remy.  Apologies for the time it has taken to get back to this post.  In this case I am doing a file transfer using this approach.  IOHandler.ReadStream( XferStream, FileSize ,false ).  This actually works most of the time as in (99.9%) of the time.  If it fails it is a result of some issue of mine, but if it fails I need to recover the client and server applications.

     


  12. I have some data that will only persist while the server is up and operational.  If the server is restarted daily the data is built over time as needed by the currently logged in users.  Currently I store the data using somewhat of a linked list.  This makes it harder to manage, ie. add, delete, or search for  messages for a single user, and is searched in one of 2 possible ways.  The question is which is the more efficient way to store this data: FDMemtable, or SQLLite.  I would say that at any point in time there might be 20,000 - 30,000 records during a given day.


  13. The desire is not to close the socket, but remove all of the bytes like a resync so that we can start communicating again.  The fact that I do not want to close and reopen the socket was not clear, but I do not want to close, but I do want to restart the communication.

     

     


  14. Thanks for your reply.  A scenario can occur when receiving data that an exception occurs or something happens that disrupts the flow of data.  I want to flush the remaining data that is being received so that I can reread the data.  I was doing a file transfer and the transfer was disrupted.  I read from the socket and there is more data coming from the buffer.  I have to close the socket and reopen to resync communication.  I hope this makes sense.

     


  15. I am looking for a sample application that demonstrates replacing a TClientDataset with Firedac application in a 3 tier environment.  In the middle layer I need access to new and old values, updatekind, etc. I need access to how the update is applied as exhibited in the tprovider.  I need to understand how the client side connects to the middle layer.


  16. Thanks for the responses.  Simply looking for the best performing solution that supports adding, deleting, perhaps master / detail relationships.  Some analysis showed SQLMemtable with very good performance.  Really hoping to discover more information on table definitions, and other examples.

×