Created
          February 14, 2013 23:08 
        
      - 
      
- 
        Save mathias-brandewinder/4957240 to your computer and use it in GitHub Desktop. 
    Simple usage of WSDL type provider to grab city location
  
        
  
    
      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
    
  
  
    
  | #I @"C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\3.0\Runtime\v4.0\Type Providers" | |
| open System | |
| #r "System.ServiceModel.dll" | |
| open Microsoft.FSharp.Linq | |
| #r "FSharp.Data.TypeProviders" | |
| type terraService = Microsoft.FSharp.Data.TypeProviders.WsdlService<"http://terraserver-usa.com/TerraService2.asmx?WSDL"> | |
| let terraClient = terraService.GetTerraServiceSoap () | |
| let getPlace (city, state, country) = | |
| let place = new terraService.ServiceTypes.msrmaps.com.Place(City = city, State = state, Country = country) | |
| let location = terraClient.ConvertPlaceToLonLatPt(place) | |
| city, location.Lat, location.Lon | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment