2016-09-14 50 views
4

我们的infra团队在机器中设置ca服务台并共享细节。我需要通过java程序创建其他事件。在这里我想通过提供访问密钥来使用基本认证。为此,我尝试使端点url获得访问密钥,然后创建事件,如下所示。CA服务DESK REST api使用JAVA

http://Host:port/caisd-rest/rest_access http://CAdeskHost:port/caisd-rest/in

String endpoint = "http://host:port/caisd-rest/rest_access"; 
    HttpClient client = new HttpClient(); 
    String encodedCredentials = new String(Base64.encodeBase64(("username" + ":" + "password").getBytes())); 
    PostMethod post = new PostMethod(endpoint); 
    post.addRequestHeader("Accept", "application/xml"); 
    post.addRequestHeader("Content-Type", "application/xml; charset=UTF-8"); 
    post.addRequestHeader("Authorization", "Basic " + encodedCredentials); 
    post.setRequestBody("<rest_access/>"); 
    try { 
     System.out.println("Execute Basic Authentication request on " + endpoint); 
     // Execute request 
     int result = client.executeMethod(post); 

但是,当我尝试执行上面的代码,得到404错误

“所请求的资源(/ caisd休息/ rest_access)不可用“。

任何人都可以帮助我如何找到ca服务台的REST URL是否它是所有像/caisd-rest一样的普通url或者它是不同的。在这里,我的团队刚刚安装了CA服务台。那么我们是否需要采取其他措施来提供休息通道?

回答

-1

我有同样的问题,问题在于REST没有被正确部署,使用该文档重新配置REST服务:REST API reconfiguration解决了这个问题。

我folowed下列步骤操作:

  1. 检查的NX_ROOT/bopcfg/WWW/CATALINA_BASE_REST/webapps /下caisd休息存在。如果此目录不存在,那么很好地表明REST部署无法正常工作。
  2. 检查错误NX_ROOT/log/jrest.log文件。
  3. 尝试修正错误,重新部署REST服务使用CMD:

    pdm_rest_util -undeploy
    pdm_rest_util -deploy