Answered Failed to retrieve geocode from webservice call

  • Thursday, June 07, 2012 3:43 PM
     
     

         I've a piece of code in place to get geocode information from a Bing's GeoCode webservice. This code has been working since it was designed back a year or two ago. All of the sudden it stops working. Can anyone help me ID the issue. Thank you  

    Try
               
                Dim geocodeRequest As New GeocodeService.GeocodeRequest()

                ' Set the credentials using a valid Bing Maps key
                geocodeRequest.Credentials = New Credentials()
                geocodeRequest.Credentials.ApplicationId = "xxxxxxxxxx"
                'geocodeRequest.Credentials.Token = token

                If String.IsNullOrEmpty(City) OrElse String.IsNullOrEmpty(State) OrElse String.IsNullOrEmpty(Zip) Then
                    ' Set the full address query
                    geocodeRequest.Query = BuildAddressSingleLine()
                Else
                    Dim geoAddress As New GeocodeService.Address
                    geoAddress.AddressLine = ValidAddressLine(AddressLine1) & " " & ValidAddressLine(AddressLine2)
                    geoAddress.Locality = City
                    geoAddress.AdminDistrict = State
                    geoAddress.PostalCode = Zip
                    geoAddress.CountryRegion = Country
                    geocodeRequest.Address = geoAddress
                End If

                ' Set the options to only return high confidence results
                If _minConfidence.HasValue Then
                    Dim filters(0) As ConfidenceFilter
                    filters(0) = New ConfidenceFilter()
                    filters(0).MinimumConfidence = _minConfidence.Value

                    Dim geocodeOptions As New GeocodeService.GeocodeOptions()
                    geocodeOptions.Filters = filters

                    geocodeRequest.Options = geocodeOptions
                End If

                ' Make the geocode request
                Dim geocodeService As New GeocodeServiceClient()
                Dim geocodeResponse As GeocodeService.GeocodeResponse = geocodeService.Geocode(geocodeRequest)

                Return geocodeResponse

            Catch ex As Exception
                ErrorLog.WriteError(Nothing, "Error while making geocode Request:" & vbCrLf & ex.Message, "Geocoding", ErrorLog.SeverityLevel.Critical, ex.StackTrace)
                Return Nothing
            End Try

    ----------------------------------error message----------------------------

    The following Critical error was recorded in xxxxxx in process Geocoding "Error while making geocode Request:

    An error occurred while receiving the HTTP response to http://staging.dev.virtualearth.net/webservices/v1/geocodeservice/GeocodeService.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details."

    Stack Trace:

    Server stack trace:

       at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)

       at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

       at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)

       at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)

       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    Exception rethrown at [0]:

       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

       at TLI.Audit.DAL.GeocodeService.IGeocodeService.Geocode(GeocodeRequest request)

       at TLI.Audit.DAL.AddressService.MakeGeocodeRequest()

All Replies

  • Friday, June 08, 2012 8:35 AM
    Owner
     
     Answered
    The staging service for Bing Maps was turned off several months ago with the token service as only tokens could be used to access that service.

    http://rbrundritt.wordpress.com

    • Marked As Answer by Tim O Thomas Friday, June 08, 2012 1:11 PM
    •  
  • Friday, June 08, 2012 1:11 PM
     
     
    Thank you

    kn