-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
69 lines (54 loc) · 2.62 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using ServiceCountry;
using System;
using System.ServiceModel;
using System.Threading.Tasks;
namespace ATV_AWS_SOAP
{
class Program
{
static CountryInfoServiceSoapTypeClient client;
static async Task Main(string[] args)
{
client = new CountryInfoServiceSoapTypeClient(CountryInfoServiceSoapTypeClient.EndpointConfiguration.CountryInfoServiceSoap12,
new EndpointAddress(
"http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso"));
tCountryCodeAndName[] countryList = await GetListOfCountry();
var lastCountryISOCode = countryList[countryList.Length - 1].sISOCode;
var lastCountry = await GetCountryByCode(lastCountryISOCode);
var capital = await GetCapitalCity(lastCountryISOCode);
var currency = await GetCurrency(lastCountryISOCode);
var phone = await GetPhone(lastCountryISOCode);
Console.WriteLine($"Foram encontrados {countryList.Length} países.");
Console.WriteLine($"O país de código {lastCountryISOCode} é {lastCountry}.");
Console.WriteLine($"A capital do país é {capital}.");
Console.WriteLine($"A moeda do país é {currency}.");
Console.WriteLine($"O código de telefone do país é {phone}.");
}
public static async Task<tCountryCodeAndName[]> GetListOfCountry()
{
ListOfCountryNamesByNameResponse response = await client.ListOfCountryNamesByNameAsync();
tCountryCodeAndName[] result = response.Body.ListOfCountryNamesByNameResult;
return result;
}
public static async Task<string> GetCountryByCode(string Code)
{
CountryNameResponse response = await client.CountryNameAsync(Code);
return response.Body.CountryNameResult;
}
public static async Task<string> GetCapitalCity(string Code)
{
CapitalCityResponse response = await client.CapitalCityAsync(Code);
return response.Body.CapitalCityResult;
}
public static async Task<string> GetCurrency(string Code)
{
CountryCurrencyResponse response = await client.CountryCurrencyAsync(Code);
return response.Body.CountryCurrencyResult.sName;
}
public static async Task<string> GetPhone(string Code)
{
CountryIntPhoneCodeResponse response = await client.CountryIntPhoneCodeAsync(Code);
return response.Body.CountryIntPhoneCodeResult;
}
}
}