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;
}
}