public string RouteTotalsSample()
        {
            var alist = new List<AddressContract>();
            alist.Add(new AddressContract(){
                Street = "Avenida Paulista",
                Number = "1000",
                City = "São Paulo",
                State = "SP"
            });

            alist.Add(new AddressContract(){
                Street = "Avenida Brigadeiro Faria Lima",
                Number = "100",
                City = "São Paulo",
                State = "SP"
            });

             AddressListContract order = new AddressListContract
            {
                RouteType = Constants.ROUTE_TYPE_AVOID_TRAFFIC,
                addresses = alist
            };

            DataContractJsonSerializer ser =
                    new DataContractJsonSerializer(typeof(AddressListContract));
            MemoryStream mem = new MemoryStream();
            ser.WriteObject(mem, order);
            string data =
                Encoding.UTF8.GetString(mem.ToArray(), 0, (int)mem.Length);
            WebClient webClient = new WebClient();
            webClient.Headers["Content-type"] = "application/json";
            webClient.Encoding = Encoding.UTF8;
            var result = webClient.UploadString("http://localhost:52306/RouteService.svc/route/totals", "POST", data);
            return result;
        }
 public string RouteTotalsJson(AddressListContract addressesJson)
 {
     if (addressesJson == null)
     {
         return MissingAddressParameter();
     }
     string json = Newtonsoft.Json.JsonConvert.SerializeObject(addressesJson.addresses);
     return CalculateRouteTotals(json, addressesJson.RouteType);
 }