Netbeans 5.5 Tip: Create a Webservice client to find Latitude & Longitude of your city
Using Netbeans 5.5 IDE, it is as easy as 1..2..3 to develop a Webservice client to find the Latitude and Longitude of your city. The webservice I used here is from Microsoft Terra Server called TerraService.
Here are the steps
The TerraService Webservice client will be added to the project as shown below.
Drag and drop the method ConvertPlaceToLonLatPt from the webservice client on to the main() method of Main.java. Necessary code will be added. Modify as shown below to display the location (blue lines are modified by me)
try { // Call Web Service Operation
locationsvc.TerraService service = new locationsvc.TerraService();
locationsvc.TerraServiceSoap port = service.getTerraServiceSoap();
// TODO initialize WS operation arguments here
locationsvc.Place place = new locationsvc.Place();
place.setCity("Menlo Park");
place.setState("California");
place.setCountry("United States");
// TODO process result here
locationsvc.LonLatPt result = port.convertPlaceToLonLatPt(place);
System.out.println("City: " + place.getCity() + ", " + place.getState() + ", " + place.getCountry());
System.out.println("Latitude = " + result.getLat() + " Longitude: " + result.getLon());
} catch (Exception ex) {
// TODO handle custom exceptions here
}
Compile and run the application. Bingo!, the result is the Latitude and Longitude of your city.
run: City: Menlo Park, California, United States Latitude = 37.45000076293945 Longitude: -122.16999816894531 BUILD SUCCESSFUL (total time: 3 second
Posted at 04:59PM Jan 05, 2007 | Permanent link to this entry
If you're more into RESTful stuff, there's Google's equivalent: http://blogs.sun.com/alexismp/entry/mashup_explanation_part_i
Posted by A` on January 06, 2007 at 04:17 AM PST #
Posted by cpark on January 06, 2007 at 11:06 AM PST #
Posted by Eric on January 12, 2007 at 05:23 PM PST #
Posted by 193.190.255.61 on March 06, 2007 at 05:13 AM PST #
Posted by Sam Lalani on March 25, 2007 at 05:28 PM PDT #
Hi,
I am trying to write a Java wbservice client for a .NET webservice. The .NET service required a Ticket number and a logon parameter to be passed in for Authentication.
I am unable to write this code. I am using Netbeans and am not able to create a Stub for my service. Typecasting does not work either. Please help......
Posted by Sucheta Lele on September 17, 2007 at 01:19 PM PDT #
comment
Posted by 88.155.25.119 on September 18, 2007 at 01:15 PM PDT #
Hi,
I am trying to access .Net webservice through Java client using Netbeans 6.0. Initially everything worked correctly. Ysterday I re installed my websrvice again after which I started gtting an error "Operation Undefined" for a particular operation though the operation is present in the wsdl and corresponding java class is formed.
Could anyone help me out? I am new to .net.
Thanks & Regards,
Sneha
Posted by Sneha on February 19, 2008 at 02:04 AM PST #
I have a GPS system on my car bought from http://www.lweshop.com/ and it really has helped enormously in finding new locations. I found this blog most interesting as I didn’t realize all of the wide range of applications out there today for GPS technology
Posted by Car GPS on December 21, 2008 at 06:07 PM PST #