Google地理编码API返回500内部服务器错误

时间:2016-10-11 17:41:00

标签: google-maps esb google-geocoding-api

让我先说一下:我不是开发人员。我目前正在使用Mulesoft集成多个系统(最初由外包开发人员开发的应用程序)。该应用程序的一部分是合并可能在系统中通用的记录。为此,我使用记录名称和地理编码作为关联地址。直到过去一周这个工作正常。现在,当应用程序的这部分运行时,我收到错误。来自失败的特定调用的调试日志是:

[2016-10-11 16:02:06.163] DEBUG  com.ning.http.client.providers.grizzly.AsyncHttpClientFilter [[tbosa-rpm].DefaultSftpConnector.receiver.01]: (t:null) REQUEST: HttpRequestPacket ( method=GET
url=/maps/api/geocode/json
query=key=[REMOVED]&address=%[REMOVED]%20[REMOVED]%20[REMOVED]%2CSPRING%20BRANCH%2CTX%22
protocol=HTTP/1.1
content-length=-1
headers=[
MULE_CORRELATION_SEQUENCE=969
MULE_CORRELATION_ID=bd4249f0-8fcb-11e6-9620-12fd3e455356
MULE_CORRELATION_GROUP_SIZE=4375
Host=maps.googleapis.com:443
User-Agent=AHC/1.0
Connection=keep-alive
Accept=*/*]
)
[2016-10-11 16:02:06.164] DEBUG org.mule.module.http.internal.HttpMessageLogger [[tbosa-rpm].DefaultSftpConnector.receiver.01]: (t:null) REQUESTER
GET /maps/api/geocode/json?key=[REMOVED]&address=%[REMOVED]%20[REMOVED]%20[REMOVED]%2CSPRING%20BRANCH%2CTX%22 HTTP/1.1

MULE_CORRELATION_SEQUENCE: 969

MULE_CORRELATION_ID: bd4249f0-8fcb-11e6-9620-12fd3e455356

MULE_CORRELATION_GROUP_SIZE: 4375

Host: maps.googleapis.com:443

User-Agent: AHC/1.0

Connection: keep-alive

Accept: */*

Content-Type: application/json; charset=UTF-8


[2016-10-11 16:02:07.684] DEBUG org.mule.module.http.internal.HttpMessageLogger [[tbosa-rpm].http.requester.GeocoderRequest.worker(1)]: (t:null) REQUESTER
HTTP/1.1 500 Internal Server Error

Content-Type: application/json; charset=UTF-8

Date: Tue, 11 Oct 2016 16:02:07 GMT

Pragma: no-cache

Expires: Fri, 01 Jan 1990 00:00:00 GMT

Cache-Control: no-cache, must-revalidate

Access-Control-Allow-Origin: *

Server: mafe

X-XSS-Protection: 1; mode=block

X-Frame-Options: SAMEORIGIN

Alt-Svc: quic=":443"; ma=2592000; v="36,35,34,33,32"

Accept-Ranges: none

Vary: Accept-Language,Accept-Encoding

Transfer-Encoding: chunked

35

{
"results" : [],
"status" : "UNKNOWN_ERROR"
}


0

[2016-10-11 16:02:07.684] DEBUG com.ning.http.client.providers.grizzly.AhcEventFilter [[tbosa-rpm].http.requester.GeocoderRequest.worker(1)]: (t:null) RESPONSE: HttpResponsePacket (
status=500
reason=Internal Server Error
protocol=HTTP/1.1
content-length=-1
committed=false
headers=[
content-type=application/json; charset=UTF-8
date=Tue, 11 Oct 2016 16:02:07 GMT
pragma=no-cache
expires=Fri, 01 Jan 1990 00:00:00 GMT
cache-control=no-cache, must-revalidate
access-control-allow-origin=*
server=mafe
x-xss-protection=1; mode=block
x-frame-options=SAMEORIGIN
alt-svc=quic=":443"; ma=2592000; v="36,35,34,33,32"
accept-ranges=none
vary=Accept-Language,Accept-Encoding
transfer-encoding=chunked]
)

问题似乎与地理编码API本身无关,因为我可以手动调用相同的地址而不会出现任何问题。连接受到限制,因此我们不应该遇到每秒请求的任何限制。这是管理API调用的应用程序中的一段代码:

<flow name="rpm-geocode-lookup" processingStrategy="synchronous">
    <set-payload value="#[payload.addressLine1],#[payload.city],#[payload.state]" doc:name="Set Location"/>
    <ee:cache cachingStrategy-ref="GeocoderCachingStrategy" doc:name="Geocoder Cache">
        <json:object-to-json-transformer doc:name="Object to JSON"/>
        <logger level="DEBUG" category="com.tbosa.esb.rpm" message="Making call to Geocoder for #[payload]" doc:name="Not Cached"/>
        <http:request config-ref="GeocoderRequest" path="/geocode/json" method="GET" doc:name="Geocoder Request">
            <http:request-builder>
                <http:query-param paramName="key" value="${geocoder.key}"/>
                <http:query-param paramName="address" value="#[payload]"/>
            </http:request-builder>
        </http:request>
        <json:json-to-object-transformer returnClass="java.util.Map" doc:name="JSON to Object"/>
        <choice doc:name="Choice">
            <when expression="#[payload.status == 'OK' || payload.results.size() &gt; 0]">
                <set-payload value="#[new java.lang.String(payload.results[0].geometry.location.lat) + payload.results[0].geometry.location.lng]" doc:name="Latitude+Longitude"/>
            </when>
            <otherwise>
                <logger message="Geocoder did not return any results. Result: #[payload]" level="WARN" category="com.tbosa.esb.rpm" doc:name="Logger"/>
                <set-payload value="''" doc:name="Blank Value"/>
            </otherwise>
        </choice>
        <expression-component doc:name="Expression">Thread.sleep(${geocoder.throttle.delay});</expression-component>
    </ee:cache>
    <exception-strategy ref="EmailExceptionStrategy" doc:name="Exceptions"/>        
</flow>

申请没有变更。我们已经成功运行了9个月,所以我不确定问题出在哪里。我老老实实地倾向于与Mulesoft的问题,但他们试图告诉我这是API的一个问题。想法?

1 个答案:

答案 0 :(得分:1)

500错误表示在处理请求期间Google端发生了错误。您是否在短暂延迟后重试了请求?

尝试确定哪个Google IP地址会影响您的应用。您可以在执行应用程序的计算机上使用traceroute maps.googleapis.comping maps.googleapis.com

如果500错误仍然存​​在,我建议在公共问题跟踪器中提交一个问题,其中包含traceroute和ping的结果,示例问题的示例HTTP请求,公共IP地址和项目编号。

https://code.google.com/p/gmaps-api-issues/

希望它有所帮助!