AnsweredAssumed Answered

Web script accessing through Apache HTTP

Question asked by mt44555 on Apr 25, 2009
Latest reply on May 1, 2012 by arpit.gupta
hi all,

I have created a web script and tested it sucessfully in mozilla. now i want to access this through Apahche HTTPclient model. i am getting login ticket and parsing the xml and getting ticket value . I have taken the web script url and appeded the ticket value. used the following code

HttpClient client = new HttpClient();
      GetMethod method = new GetMethod(contenturl.toString());
      Credentials defaultcreds = new UsernamePasswordCredentials("tomcat",
            "tomcat");
      client.getState().setCredentials(
            new AuthScope("localhost", 8080, AuthScope.ANY_REALM),
            defaultcreds);
      client.getParams().setAuthenticationPreemptive(true);
      // client = new URL(contenturl.toString());
[b]in try block[/b]
int responseCode = client.executeMethod(method);
InputStream resultdoc = method.getResponseBodyAsStream();


The above HTTP POST MEthod, i have used GET Method too..

but getting the 401 error

Outcomes