Pentaho Carte休息服务给予302

时间:2015-12-22 16:44:22

标签: pentaho

我正在尝试评估Carte并将我在Spoon设计器中创建的作业添加到我也创建的本地文件存储库中。

我创建了xml来添加作业并编写了一个测试程序。

然而,响应始终是302 - 任何想法我怎么能过去实际调用服务?

我已经读过302表示重定向所以请抓住“位置”标题并再次拨打电话。在这种情况下,位置标题再次是“http://localhost:8181/kettle/addJob”,并且重新调用导致进一步的http 302响应。我好像现在陷入困境......

        String fileName = "C:\\format.xml";
        String url = "http://localhost:8181/kettle/addJob";
        HttpClient httpClient = new HttpClient();
        List authPrefs = new ArrayList();
        authPrefs.add(AuthPolicy.BASIC);
        httpClient.getParams().setParameter(
                AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);

        Credentials creds = new UsernamePasswordCredentials("cluster",
                "cluster");
        AuthScope scope = new AuthScope("localhost", AuthScope.ANY_PORT);
        httpClient.getState().setCredentials(scope, creds);
        AuthPolicy.registerAuthScheme("Basic", BasicScheme.class);
        PostMethod post = new PostMethod(url);
        String xml = FileUtils.readFileToString(new File(fileName));
        post.setRequestBody(xml);

        int result = httpClient.executeMethod(post);

0 个答案:

没有答案