Package br.com.maplink.decarta

Source Code of br.com.maplink.decarta.WebservicesConnector

package br.com.maplink.decarta;

import java.io.FileNotFoundException;
import java.io.IOException;

import br.com.maplink.decarta.bean.Address;
import br.com.maplink.util.PropertyReader;
import br.com.maplink.util.XMLPoster;

public class WebservicesConnector {
 
  public Address getAddress() {
    return address;
  }

  public void setAddress(Address address) {
    this.address = address;
  }

  public String getUrlDecartaServer() {
    return urlDecartaServer;
  }

  public void setUrlDecartaServer(String urlDecartaServer) {
    this.urlDecartaServer = urlDecartaServer;
  }

  public Address address;
  private String urlDecartaServer;
 
  public WebservicesConnector() throws FileNotFoundException, IOException{
    urlDecartaServer = PropertyReader.getValue("decartaWSAddress");
  }
 
  public String geocode(){
    System.out.println("iniciando GeoCode...");
    String httpResponse = "";
    Templates t = new Templates();
    String geocodeXML = t.Geocode(address);
    XMLPoster poster = new XMLPoster();
    try {
      poster.urlAddress = urlDecartaServer;
      poster.data = geocodeXML;
      httpResponse = poster.Post();
    } catch (Exception e) {
      System.out.println(e.getMessage());
      e.printStackTrace();
    }
    return httpResponse;
  }
}
TOP

Related Classes of br.com.maplink.decarta.WebservicesConnector

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.