Google maps 无法向谷歌地图提出请求

Google maps 无法向谷歌地图提出请求,google-maps,google-maps-api-3,Google Maps,Google Maps Api 3,嗨,我向谷歌地图发出了一个restful请求,但我遇到了以下错误: java.io.IOException: Server returned HTTP response code: 400 for URL: http://maps.googleapis.com/maps/api/distancematrix/xml?origins=Washington, DC USA&destinations=Los+Angeles+CA+USA&mode=d

嗨,我向谷歌地图发出了一个restful请求,但我遇到了以下错误:

java.io.IOException: Server returned HTTP response code: 400 for URL: 
       http://maps.googleapis.com/maps/api/distancematrix/xml?origins=Washington, DC  
        USA&destinations=Los+Angeles+CA+USA&mode=driving&sensor=false
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
at java.net.URLConnection.getContent(URLConnection.java:688)

我相信这是一个正确的连接,因为我可以通过将上面的URL复制到我的浏览器中得到正确的响应,我想知道为什么我的控制台中有400个错误代码,而当java发送请求时,我没有得到正确的响应。

解决方案是,我应该在起始和目标中用+替换所有空格