Created
September 22, 2010 08:31
-
-
Save joerichsen/591364 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'savon' | |
client = Savon::Client.new "http://aws.hvm.dk/GetAddressService/GetAddressService.asmx?wsdl" | |
# Show the methods available | |
client.wsdl.soap_actions | |
# [:get_post_code_list, :get_address_access_by_street_code, :get_region_list, :get_address_access_by_named_street_uid, :get_municipality_by_municipality_code, :get_address_access_by_uid, :get_municipality_list, :get_address_specific_by_address_access_uid, :get_named_street_by_street_code, :get_post_code_by_post_code_identifier, :get_named_street_by_uid] | |
# Get an array of region names | |
client.get_region_list.to_hash[:get_region_list_response][:region].map { |region| region[:region_name] } | |
# Result ["Nordjylland", "Midtjylland", "Syddanmark", "Hovedstaden", "Sj\303\246lland"] | |
# Get the municipalities and their codes | |
puts client.get_municipality_list.to_hash[:get_municipality_list_response][:municipality].map { |m| "#{m[:municipality_name]} (#{m[:municipality_code]})" }.join("\n") | |
# Result | |
# ... | |
# Greve (0253) | |
# Køge (0259) | |
# Frederiksværk-Hundested (0260) | |
# ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment