GOV/Webservice/Java

aus GenWiki, dem genealogischen Lexikon zum Mitmachen.
< GOV‎ • Webservice
Zur Navigation springen Zur Suche springen

Position setzen

So setzt man die Position eines Ortes:

import net.genealogy.gov.data.Position;
import net.genealogy.gov.ws.*;

public class GovClient {
   public static void main(final String[] args) throws Exception {
       String user = args[0];
       String password = args[1];
       String id = args[2];
       double longitude = Double.parseDouble(args[3]);
       double latitude = Double.parseDouble(args[4]);
 
       ComplexServicePortType readClient =
           new ComplexServiceLocator().getComplexServiceHttpPort();
       ChangeServicePortType writeClient =
           new ChangeServiceLocator().getChangeServiceHttpPort();

       net.genealogy.gov.data.Object place = readClient.getObject(id);
       Position position = new Position();
       position.setLat(latitude);
       position.setLon(longitude);
       place.setPosition(position);

       writeClient.saveObject(place, user, password);
   }
}