![]() |
|
TIWIPGeolocationClient::Execute() always false - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Atozed Software (https://www.atozed.com/forums/forum-1.html) +--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html) +---- Forum: English (https://www.atozed.com/forums/forum-16.html) +----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html) +----- Thread: TIWIPGeolocationClient::Execute() always false (/thread-5221.html) |
TIWIPGeolocationClient::Execute() always false - JuergenS - 05-24-2025 Hi, i have a problem with TIWIPGeolocationClient: RAD C++ Builder 12 Update 3 (with May Patch) InternetDirect(Indy) 10.6.2.0 IntraWeb 16.0.10 My Intraweb application 32/64 bit TIWIPGeolocationClient: TIPGeoApiInterface(apiIpApiCo, apiIpAPI) TIWIPGeolocationClient::Execute() returns always false I found that IPGeoApiInterface::Execute() always return false for the used geo interfaces. The same software is running with RAD C++ Builder 12.2 and IntraWeb 15.6.7 without any problems for 32/64 bit. Regards Juergen RE: TIWIPGeolocationClient::Execute() always false - JuergenS - 05-28-2025 This are some more informations: The following changes appear to have been made to the component's source code in IW16.0.9 or before: Error handling for the Geo API functions has been implemented. If an error occurs, an error message is output to the server log file (!) and the component TIWIPGeolocationClient is blocked. The behavior can be influenced by the user through the property variables MaxErrorCount and Enabled. Unfortunately, these property variables could not be changed by my application: TIWIPGeolocationClient* pCurClient; if((pCurClient = new TIWIPGeolocationClient(this)) != NULL) { // THIS SEEMS NOT TO WORK pCurClient->MaxErrorCount = 10; pCurClient->Enabled = true; // Interface and key pCurClient->IPGeoApiInterface = TIPGeoApiInterface(CurIndex); pCurClient->ApiKey = theApiKey; // Execute GeoApi function if(pCurClient->Execute(theIPAddress) == true) { // Retrieve API response } } Apparently the current implementation under C++Builder does not work as described below: https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Class_Methods A web application usually contains a large number of modules and components for which central error handling is performed. The question that arises for me is whether a single component like TIWIPGeolocationClient should implement its own error handling and error output at all. Regards Juergen RE: TIWIPGeolocationClient::Execute() always false - JuergenS - 05-29-2025 This version is now running: TIWIPGeolocationClient* pCurClient; TIWIPGeolocationClient::MaxErrorCount = 10; TIWIPGeolocationClient::Enabled = false; if((pCurClient = new TIWIPGeolocationClient(this)) != NULL) { // Interface and key pCurClient->IPGeoApiInterface = TIPGeoApiInterface(CurIndex); pCurClient->ApiKey = theApiKey; // Execute GeoApi function if(pCurClient->Execute(theIPAddress) == true) { // Retrieve API response } } In my opinion, the changes made to the general component TIWIPGeolocationClient for the version IW16.0.9 are certainly very helpful for the component developer's testing, but may be rather hindering for practical use due to the implicit error handling. A component developer should not make any assumptions about how his component will ultimately be used in an application environment. RE: TIWIPGeolocationClient::Execute() always false - rlebeau - 05-29-2025 (05-28-2025, 09:21 AM)JuergenS Wrote: Unfortunately, these property variables could not be changed by my application: MaxErrorCount and Enabled are not "class methods", they are "class properties" instead, so this documentation would be more relevant: https://docwiki.embarcadero.com/RADStudio//en/Static_Properties But either way, C++Builder supports accessing class/static properties though the class type as well as through an object pointer. Are you claiming that is not the case? IOW, what does this code report to you? Code: TIWIPGeolocationClient* pCurClient = new TIWIPGeolocationClient(this);(05-29-2025, 11:13 AM)JuergenS Wrote: This version is now running: On a side note: - new does not return NULL/nullptr on failure, instead it throws a std::bad_alloc exception. - have you considered using TIWIPGeolocationHelper (added in 15.2.55) to simplify use of TIWIPGeolocationClient? Quote:New TIWIPGeolocationHelper class exposes a simple interface to use with TIWIPGeolocationClient class. Now you can implement IPGeolocation for your sessions with 2 lines of code! RE: TIWIPGeolocationClient::Execute() always false - JuergenS - 05-30-2025 Hi, this are the results of the test you wanted me to do: TIWIPGeolocationClient::MaxErrorCount = 15; ShowMessage(pCurClient->MaxErrorCount); // should be 15 -> result is 15 pCurClient->MaxErrorCount = 5; ShowMessage(TIWIPGeolocationClient::MaxErrorCount); // should be 5 -> result is 5 TIWIPGeolocationClient::Enabled = false; ShowMessage(pCurClient->Enabled); // should be false -> result is true pCurClient->Enabled = true; ShowMessage(TIWIPGeolocationClient::Enabled); // should be true -> result is false Are there any examples on how to use TIWIPGeolocationHelper to simply the use of TIWIPGeolocationClient ? RE: TIWIPGeolocationClient::Execute() always false - rlebeau - 05-30-2025 (05-30-2025, 08:12 AM)JuergenS Wrote: TIWIPGeolocationClient::MaxErrorCount = 15; That's good, that proves that is only 1 property being accessed 2 different ways. (05-30-2025, 08:12 AM)JuergenS Wrote: TIWIPGeolocationClient::Enabled = false; That would imply that either there are 2 separate properties being accessed, or that there is one property with getter/setter methods that are flipping the value, for whatever reason. I don't have or use IntraWeb, let alone its source code, so I couldn't tell you what is happening. (05-30-2025, 08:12 AM)JuergenS Wrote: Are there any examples on how to use TIWIPGeolocationHelper to simply the use of TIWIPGeolocationClient ? I don't know. I just know that TIWIPGeolocationHelper was mentioned in the release notes. RE: TIWIPGeolocationClient::Execute() always false - JuergenS - 05-30-2025 In my opinion there is a bug in the handling of the Enabled property in IW16.0.9. In my running example you can see that the Enabled property of TIWIPGeolocationClient must be set to false to activate a current instance! In version IW 15.6.7 it was not necessary to set any properties to work with an instance of TIWIPGeolocationClient. RE: TIWIPGeolocationClient::Execute() always false - Alexandre Machado - 06-05-2025 Hi Jurgen, yes, there is a bug in there. It has been fixed in 16.0.10 RE: TIWIPGeolocationClient::Execute() always false - JuergenS - 06-05-2025 Hi Alexandre, The modification was done in IW16.0.9 and i used the source code from IE16.0.9, but i tested with IW16.0.10. So, in IW16.0.10 the issue hasn't been fixed yet. Juergen RE: TIWIPGeolocationClient::Execute() always false - Alexandre Machado - 06-09-2025 You are correct, the fix hasn't been included in release 16.0.10, due to time constraints. It's been fixed in IW 16.0.11 + a few other improvements. Please let me know if you have any issues. |