[Solved] Error in Web-based customer registration application lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- devEric69 · 2020-04-30 08:52 Hello, I need to make communicate, a desktop application that asks for a registration number (I will use https://wiki.freepascal.org/OnGuard) with a service (CGI-bin with https://wiki.freepascal.org/fpWeb_Tutorial using webModules, webActions, and dataModules) from a website. I know I can POST or GET anything I want, with CGI-bin. Concerning  the response to the request (which will be a registration code), how can I expect the desktop application to be able to read the response? With a GET-cURL of a page? A page created on the fly? Is it posssible with CGI-bin? With another protocol like SOAP? Taking an analogy, is there a way to do like push or like Ajax, with fpWeb? ==> I'm inclined - for now - towards creating a html-page on the fly that will be cURLed by another thread of the desktop application (since the desktop application doesn't open a browser, I think it's impossible or pointless to create a html-page with a download link). I'd like to read the opinions of people who have created or seen shareware registration applications from an 'About' desktop window. ps 1: I would like to avoid sending the requested code by e-mail... ps 2: I would like to stay within an integrated CGI-bin solution, to make it as simple as possible. Regards. ---------------------------------------------------------------------- BeanzMaster · 2020-04-30 11:59 Hello perhaps by just generating a jSon response (file), it would be more easy to retreive from your application Best regards ---------------------------------------------------------------------- john horst · 2020-04-30 12:20 You would create a registration page. Once they signup and meet your requirements, that info would be stored in a database. You would also create an endpoint in fpweb to communicate with your database and call it from your desktop app. Your Desktop App (Auth) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i // Credentials RequestBody := TStringStream('{"name":"unique@fleemail.com"}');Response := HTTP.POST('/endpoint/send/reg-number', RequestBody); Server App (Respond) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i // Read the POST Body sent from your Desktop App. It should be identifying who the user is.... // Respond with their registration number.AResponse.Content := 'here is your reg number'; // <-- The Response Var in your Desktop App ---------------------------------------------------------------------- devEric69 · 2020-04-30 13:16 QuoteHello perhaps by just generating a jSon response (file), it would be more easy to retreive from your application Hello @BeanzMaster. Indeed, I can render a jSon file from the  webModule's webAction response (which would allow me to use a response format that can easily reify a registration object on the application- desktop side). QuoteYou would create a registration page. Once they signup and meet your requirements, that info would be stored in a database. You would also create an endpoint in fpweb to communicate with your database and call it from your desktop app. Hello @john horst. What I understand from your proposal - in a pure CGI-bin technology context, with no other technology embedded like in a browser; unless there is a "Sioux" trick to make the communication bidirectional? - is to POST on a URI (linked to a client; anonymous- shareware, or named-full-registred), the information of the customer to uniquely identify him (if he already has an account, or automatically create a new shareware account of this customer, in the database), and to read (cURL + regex) the answer of this same URI POSTed, or of a URI known in advance before the POST. Is that it? ---------------------------------------------------------------------- devEric69 · 2020-05-01 13:44 Hello, I've started this CGI project. I'm stuck by a technical problem during compilation: on the line of code where I indicate my personal Exception handler management like this ...: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Application.OnShowRequestException:= @goMyWebHandlerException.customExceptionHandler;... I've got the following error (I don't understand why, because I respect the signature of the method pointer required): Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uwebmodulesbroker.pas(44,87) Error: Incompatible type for arg no. 1: Got "", expected "" Can someone explain to me what's causing the problem? ---------------------------------------------------------------------- lucamar · 2020-05-01 13:58 The property is expecting a "normal" procedure pointer but you're passing to it an object's method (a "procedure of object"). The difference is that methods have a "hidden" parameter Self, so the signature doesn't match what Application.OnShowRequestException is expecting. ---------------------------------------------------------------------- devEric69 · 2020-05-01 14:51 Hello! Indeed; it's a just a simple pointer of procedure. I code by following this very well done tutorial: https://wiki.lazarus.freepascal.org/fpWeb_Tutorial , § Custom Exception Handler. However, there is a question of an object method, an object to be wary of ^^. That said, it may have changed since its publication. I think this paragraph should be changed; I agree to do it, if I can... ---------------------------------------------------------------------- lucamar · 2020-05-01 15:58 Quote from: devEric69 on May 01, 2020, 04:51:12 pmI think this paragraph should be changed; I agree to do it, if I can... Yes, it should, because it says almost exactly the contrary of what it should. But before modifying it better, if you can, check on older versions or the commit messages to see whether it was changed some time after it was written; in that case you can add a note saying in which version it was moved from a method pointer to a simple procedure. ---------------------------------------------------------------------- devEric69 · 2020-05-01 18:04 ==> it has been changed.