cloudstack-users-cn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "梅亭居士" <714250...@qq.com>
Subject 调用Cloudstack API报错,如何处理
Date Fri, 01 Mar 2013 09:48:35 GMT
我通过调用Cloudstack API进行开发。调用命令为
 http://192.168.13.59:8080/client/api?command=listHosts&apiKey=VWiR6g0JUISvra1VtjvWtZf2mYutj0S3qFmP33EmC6IUV3fdRU00GeIdl5ZV195O_U-6D6Bw89cUBtlHREyxKQ&signature=VZSGu9AgfpLLBa5ugGm1H8qPva8=
 返回说调用失败,不能验证用户的证书和签名
   - <listhostsresponse cloud-stack-version="4.0.1.20130201075054">
     <errorcode>401</errorcode> 

    <errortext>unable to verify user credentials and/or request signature</errortext>


   </listhostsresponse>
 查看日志显示信息有
 2013-03-01 17:27:36,006 INFO  [cloud.api.ApiServer] (catalina-exec-20:null) User signature:
VZSGu9AgfpLLBa5ugGm1H8qPva8 is not equaled to computed signature: 8pGINj3xhRA5LzWCyQhn4rErq/E=
 说传入的签名和计算的签名8pGINj3xhRA5LzWCyQhn4rErq/E=不相同。
 我怀疑签名是否为8pGINj3xhRA5LzWCyQhn4rErq/E=
 重新调用命令
 http://192.168.13.59:8080/client/api?command=listHosts&apiKey=VWiR6g0JUISvra1VtjvWtZf2mYutj0S3qFmP33EmC6IUV3fdRU00GeIdl5ZV195O_U-6D6Bw89cUBtlHREyxKQ&signature=8pGINj3xhRA5LzWCyQhn4rErq/E=
 显示依然是调用失败,无法验证用户的证书和签名
 <?xml version="1.0" encoding="UTF-8" ?>   - <listhostsresponse cloud-stack-version="4.0.1.20130201075054">
     <errorcode>401</errorcode> 

    <errortext>unable to verify user credentials and/or request signature</errortext>


   </listhostsresponse>
 日志显示:
 013-03-01 17:29:53,367 INFO  [cloud.api.ApiServer] (catalina-exec-11:null) User signature:
8pGINj3xhRA5LzWCyQhn4rErq/E is not equaled to computed signature: 8pGINj3xhRA5LzWCyQhn4rErq/E=
  
 
 请问怎么解决这个问题?
  






 signature值是通过cloudstack源代码test/src/com/cloud/test/utils/UtilsForTest.java里面的signRequest()获取,传入的两个参数为:
 request="http://localhost:8080/client/api?command=listHosts
secretkey="5ZHIqkaoGS4r2PSQEmhNWiLYtncHu6_FR3eCCjG6YF_aDUoCXnoz-Q3FIqQFTOsal4Zbe8-TrlB64PmFQtFcdw";
 (request试过带上&apikey=###,获取的signature值依然无法使用)
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message