Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TIWIPGeolocationClient::Execute() always false
#1
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
Reply
#2
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/RADStudi...ss_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
Reply
#3
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.
Reply
#4
(05-28-2025, 09:21 AM)JuergenS Wrote: Unfortunately, these property variables could not be changed by my application:
...
Apparently the current implementation under C++Builder does not work as described below:

https://docwiki.embarcadero.com/RADStudi...ss_Methods

MaxErrorCount and Enabled are not "class methods", they are "class properties" instead, so this documentation would be more relevant:

https://docwiki.embarcadero.com/RADStudi...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);

TIWIPGeolocationClient::MaxErrorCount = 15;
ShowMessage(pCurClient->MaxErrorCount); // should be 15

pCurClient->MaxErrorCount = 5;
ShowMessage(TIWIPGeolocationClient::MaxErrorCount); // should be 5

TIWIPGeolocationClient::Enabled = false;
ShowMessage(pCurClient->Enabled); // should be false

pCurClient->Enabled = true;
ShowMessage(TIWIPGeolocationClient::Enabled); // should be true

// Interface and key
pCurClient->IPGeoApiInterface = TIPGeoApiInterface(CurIndex);
pCurClient->ApiKey = theApiKey;

// Execute GeoApi function
if(pCurClient->Execute(theIPAddress))
{
     // Retrieve API response
}

(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!   

Reply
#5
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 ?
Reply
#6
(05-30-2025, 08:12 AM)JuergenS Wrote: TIWIPGeolocationClient::MaxErrorCount = 15;
ShowMessage(pCurClient->MaxErrorCount); // should be 15
-> result is 15

pCurClient->MaxErrorCount = 5;
ShowMessage(TIWIPGeolocationClient::MaxErrorCount); // should be 5
-> result is 5

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;
ShowMessage(pCurClient->Enabled); // should be false
-> result is true

pCurClient->Enabled = true;
ShowMessage(TIWIPGeolocationClient::Enabled); // should be true
-> result is 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.

Reply
#7
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.
Reply
#8
Hi Jurgen,

yes, there is a bug in there. It has been fixed in 16.0.10
Reply
#9
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
Reply
#10
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)