I am trying to evaluate Carte and add a job I created in the Spoon designer to a local file repository I also created.
I created the job_configuration xml to add the job and wrote a test program.
The response however is always 302 - any idea how I can get past that to actually call the service ?
I have read that 302 means redirect so go grab the 'Location' header and make another call. In this case the location header again is "http://localhost:8181/kettle/addJob", and re-calling results in a further http 302 response.
I seem to be stuck in a loop now ..
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);