How to find and display country name from IP Address in Xcelsius dashboard
Imagine you have developed your own dashboard and there are hundreds of people across the globe visiting your dashboard every day. Do you want to restrict or show data depending upon visitor’s country? In this article I will use a Web Service from www.webservicex.net and Xcelsius Web Service connection to find the country from the IP addresses.
Here are the detailed steps:
1. Launch Xcelsius/Dashboard Design, go to Data Manager and add Web Service Connection:
2. Now we will use following WSDL URL from www.webservicex.net and find country from IP Address:
Note: We can use any other Web Service which provides country name from IP Address. We can even build our own Web Service for this. I am using Web Service from www.webservicex.net as an example in this article.
3. Paste above URL in front of WSDL URL under Data Manager and click on Import:
4. Notice that Input Values and Output Values panes are populated with following fields:
- Input Values Pane:
IPAddress: This is the Web Service parameter. We are going to pass IP Address to a Web Service using this field.
- Output Values Pane:
ReturnCode: Returns 1 for valid IP Address else returns 0
IP: Returns IP Address passed to the Web Service
ReturnCodeDetails: Returns Success if passed IP Address is valid else returns Invalid IP Address
Country Name: Returns the name of the country corresponding the passed IP Address
Country Code: Returns country for the detected country for example for India country , country code returned will be IND
5. Map required fields from Input Values and Output Values pane with excel spreadsheet:
6. Now we can pass IP Address to the IPAddress Web Service parameter using let’s say Input Text component and display country name in a Label component.
7. Enter IP Address in a Input Text component and click on Refresh button:
You will see the country corresponding to the entered IP Address in the Results pane.
8. Alternatively you can select IP Address from the Scorecard and see the corresponding country name:
I have displayed country map using dynamic visibility on the right side of the dashboard. I have taken four countries (India,Japan,Malaysia,Thailand) as an example.
I have attached ‘IP Address Location.txt’ file with this article. Download and rename it to ‘IP Address Location.xlf’