Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Involing Carte addJob REST service gives 302

  1. #1
    Join Date
    Dec 2015
    Posts
    6

    Default Involing Carte addJob REST service gives 302

    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);

  2. #2
    Join Date
    May 2007
    Posts
    24

    Default

    I don't know if you ever resolved your issue but in case anyone else stumbles on this post I had a similar problem where trying a simple get status evoked the 302 error. "http://192.168.0.105:8080/kettle/status". I ran wireshark on the transmitting machine and noticed that the wireshark request evoked the same error and then self corrected by transmitting the request again as follows "192.168.0.105:8080/kettle/status/". Appending the / seemed to do the trick. I added this to my code and it now works.
    John More

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.