2016-12-14 68 views
0

我看到我的时间戳值根据文档here参数Timestamp的值2016-12-14T07%3A11%3A17Z无效。原因:必须是ISO8601格式

Timestamp=2014-08-18T12%3A00%3A00Z 

而我依然收到错误响应说

2016-12-14T07%3A11%参数Timestamp的3A17Z无效。

这是我的网址

http://webservices.amazon.com/onca/xml?AWSAccessKeyId=AKIAJ7NHWB4XOVV6LFEA&AssociateTag=emulya-20&IdType=UPC&ItemId=123&Operation=ItemLookup&ResponseGroup=Large&SearchIndex=All&Service=AWSECommerceService&Timestamp=2016-12-14T07%3A11%3A17Z&Signature=3cSWzK8%2FGiRZ7ZSug39gNAwGqKqIyIHuKoUiVDRQWzU%3D 
+1

你确定那是*确切*传送网址是什么?其他的东西可能会再次被URL编码? (试着用冒号代替'%3A' ...) –

+0

'final ResponseEntity response = restTemplate.getForEntity( uri, String.class);' - 这是使用restTemplate发送请求的url并且根据文档查询参数必须编码 –

+2

这并没有真正回答这个问题。你看过线路上正在传输什么,例如使用Fiddler或Wireshark? –

回答

0

弹簧RestTemplate编码的网址,这样反而使用restTemplate.getForObject(String url, Object.class),使用restTemplate.getForObject(java.net.URI uri, Object.class)

 final String url = config.getServiceUrl() + "?" + canonicalize 
       + "&Signature=" + signature; 
     final URI uri = URI.create(url); 
     final ResponseEntity<String> response = restTemplate.getForEntity(
       uri, 
       String.class); 
相关问题