servlet hosting logo
Contact us: +44 (0) 870 1657215 - contact@nameonthe.net
Members of
Members of Nominet Ripe member WorldPay Guarantee
We accept the following payment methods:
Visa payments supported by WorldPay Visa/Delta payments supported by WorldPay Visa/Electron payments supported by WorldPay Mastercard payments supported by WorldPay Switch payments supported by WorldPay JCB Solo payments supported by WorldPay

Geolocator web service integration notes

Note: The underlying geolocator database is made freely available to Name On The Net clients

Web Services Background

Web services are receiving much attention recently, the respected Gartner Group boldly stating they will become "the mainstream business application architecture" by 2007. This seems likely given they are an integral part of Microsoft's .NET strategy. A web service can be defined as a software component addressable with a URL and accessible over the internet. Unlike earlier distributed architectures which were either proprietory or overly complex: DCOM, RMI and CORBA, web services are based on simple open standards defined under the auspices of w3c. Web services introduce a new set of acronyms: SOAP (Simple Object Access Protocol), WSDL (Web Services Description Language), UDDI (Universal Discovery Description and Integration), and believe it or not DISCO (Discovery of Web Services) and ROPE (Remote Object Proxy Engine) make an appearance.

Document purpose

The purpose of this document is to demonstrate how to use the www.nameonthe.net 'geolocater' web service. The 'geolocator' web service determines an IP address' country of origin. This can be used to customise your web sites behaviour in realtime, an obvious use would be to deliver custom content to particular markets.

Java Integration

The Apache Axis project is a open source SOAP implementation which can be downloaded from http://ws.apache.org/axis. It also implements JAXRPC (Java API for XML-based RPC) which conforms to JSR 224 (Java Specification Request). JAXRPC presents a higher level interface to work with Web services, 'protecting' the programmer from having to understand the finer details of SOAP. Download the binary package and place the distributed jar files into your classpath. The code below demonstrates how to invoke a web service with the name 'IPLookup' with the operation name 'getCountryByIP'. The web service will return null if it cannot determine the country code.

import javax.xml.namespace.QName;
import javax.xml.rpc.Call;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Service;

 ... Code ...

    try {
      Service service = new Service();
      Call call = (Call) service.createCall();
      String host = 
        "http://www.nameonthe.net/webservices/services/IPLookup?wsdl";

      // Set where the web service is located
      call.setTargetEndpointAddress(host);

      // Set the service and operation name
      call.setOperationName(new QName("IPLookup", "getCountryByIP"));
 
      // Invoke the operation
      String countrycode = (String)call.invoke(new String[] {"217.207.14.248"});
    } catch (ServiceException e) {
      // Your exception handling code
    }

  ... Code ...

Perl Integration

The SOAP::Lite module needs to be installed for the following example to work.

use SOAP::Lite;

print SOAP::Lite
   ->service('http://www.nameonthe.net/webservices/services/IPLookup?wsdl')
   ->getCountryByIP('217.207.14.248');
This prints the result from the lookup.

Version: 1.0
Date: 14/09/2004
username
password
>> Login <<
Today's Tech Tip
Google Tip (No 109)
Limit searches to a particular site when searching google by using the 'site: operator. Example:

"site:www.nameonthe.net hosting

"
System Status
(Wed Nov 19 22:21:47 GMT 2008)
There are no known network or server problems

Valid XHTML 1.0!

Valid CSS!

Copyright © www.nameonthe.net 1999-2008, All Rights Reserved
All prices exclude VAT