Get the current IP location and latitude and longitude of the Web services __web

Source: Internet
Author: User
Tags soap web services

First, ordinary IP is unable to obtain detailed latitude and longitude, only through network services to obtain

The most useful in China is the JavaScript API provided by www.ip-look-up.com, as long as the following statements are written in the Web page

<script type= "Text/javascript" src= "Http://www.ip-look-up.com/Services/ipInfo.js" ></script>
He's going to return a JSON data in memory, just a little bit.
iplocation = {' Latitude ': 39.9289, ' longitude ': 116.388, ' address ': {' city ': ' Beijing ' , ' Region ': ' Beijing ', ' country ': ' in ', ' cnregionname ': ', ' cncity ': ', ' cncountryname ': ', ' country_code ': ' CN '};


There is also a webservice provided by http://www.fraudlabs.com/, which returns XML

As long as the user registered in his page to obtain the authorization of the key, and then download the corresponding programming language provided by the functional class will be able to resolve the location of the incoming IP

Modify the corresponding content in Client.java Java don't forget to refer to a few of the necessary jar packs (Mail.jar,soap.jar,xercesimpl.jar,xml-apis.jar,xmlparserapis.jar)

public class Client 
{//entry point to this 

	application public
	static void Main (string[] args) 
	{ 
		try 
		{
		//create a proxy
		apachesoapproxy proxy = new Apachesoapproxy ();

		Invoke Fraudlabscheck () over SOAP and get the new OID
		//require Parameter fraudlabscheck (String IP, String LICENSE) c10/>string result = Proxy. Fraudlabs ("148.229.0.123", "xx-xxxx-xxxx");
		
		Print out of the value
		System.out.println (result);
		}
		catch (Java.net.MalformedURLException exception) 
		{
			exception.printstacktrace ();
		}
		catch (Org.apache.soap.SOAPException exception) 
		{
			exception.printstacktrace ();
		}
	}
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.