r u doing ntml authentication in server or basic authentication bcas u r
server may req basic auth and u may do ntml auth means u need to disable
basic auth in server side vice versa
On Feb 15, 2013 12:49 PM, "Chawla, Vanita" <[email protected]> wrote:

> I see the authorization header being sent below in the wire and header
> logs.
>
> [DEBUG] headers - >> Authorization: NTLM xxxxxxxxxxxxxxx
>
> I also the message indicating auth cache not set.
>
> [DEBUG] RequestAuthCache - Auth cache not set in the context
>
> I am not sure if these are what you meant needs to be set. Is there
> something else I can check or correct?
>
>
>
> Thank you!
> On 2/15/13 11:59 AM, "Gomateswaran Danyakumar" <[email protected]>
> wrote:
>
> >You need to set the authorization header param I thik u r server is
> >expecting authorization param either disable it in server side or pass
> >correct param hope it is base64 encoded
> >On Feb 15, 2013 11:55 AM, "Chawla, Vanita" <[email protected]> wrote:
> >
> >> I am trying to use a REST call to Sharepoint 2010 via HTTPClient 4.2.3
> >> from a java Liferay 6.1 portlet on Mac OS 10.6.x (snow leopard).
> >> The response I always get back is: HTTP/1.1 401 Unauthorized
> >>
> >> I don't see an SSL handshake in the wire logs, but see a cookie and get
> >>a
> >> 401 unauthorized response. I have tried various combinations of the
> >>sample
> >> codes with same results.
> >>
> >> I have imported the cert into my local MAC's JVM cacerts and am trying
> >>to
> >> load the cacerts as the keystore.
> >>
> >> Note - that I've used FireFox and CURL to do the same thing I'm trying
> >>to
> >> do here programmatically, and it works fine. So the server appears to be
> >> set up correctly. The CURL verbose log show the SSL handshake happening
> >> first and the NTLM succeeds as the next step.
> >> My code is:
> >>
> >> String opsCalendarURL1 =
> >> "https://hostname/sites/team-sites/operations/_vti_bin/owssvr.dll?";;
> >> String opsCalendarURL2 =
> >> "Cmd=Display&List={6E460908-D470-4F8A-AF76-CC279E25E0B1}&XMLDATA=TRUE";
> >> String opsCalenderURLEncoded = opsCalendarURL1 + URLEncoder.encode(
> >> opsCalendarURL2 , "UTF8" );
> >>
> >> System.out.println(opsCalenderURLEncoded);
> >> DefaultHttpClient httpclient = new DefaultHttpClient();
> >>
> >> try {
> >>    // SSL
> >>    KeyStore trustStore  =
> >>KeyStore.getInstance(KeyStore.getDefaultType());
> >>    FileInputStream instream = new FileInputStream(new
> >>
> >>File("/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/li
> >>b/
> >> security/cacerts"));
> >>    try {
> >>     trustStore.load(instream, "pwd".toCharArray());
> >>    } finally {
> >>        try { instream.close(); } catch (Exception ignore) {}
> >>    }
> >>
> >>    SSLSocketFactory socketFactory = new SSLSocketFactory(trustStore);
> >>    Scheme sch = new Scheme("https", 443, socketFactory);
> >>    httpclient.getConnectionManager().getSchemeRegistry().register(sch);
> >>    System.out.println("----------------------------------------");
> >>
> >>    HttpHost targetHost = new HttpHost("hostname", 443, "https");
> >>    httpclient.getCredentialsProvider().setCredentials(
> >>     AuthScope.ANY,
> >>     new NTCredentials("username", "password","machine","domain"));
> >>
> >>    HttpGet httpget = new HttpGet(opsCalenderURLEncoded);
> >>
> >>    System.out.println("executing request: " + httpget.getRequestLine());
> >>    System.out.println("to target: " + targetHost);
> >>
> >>    HttpResponse response2 = httpclient.execute(targetHost, httpget);
> >>    HttpEntity entity = response2.getEntity();
> >>
> >>    System.out.println("----------------------------------------");
> >>    System.out.println(response2.getStatusLine());
> >>    System.out.println(response2.getProtocolVersion());
> >>    if (entity != null) {
> >>      System.out.println("Response content length: " +
> >> entity.getContentLength());
> >>    }
> >>    EntityUtils.consume(entity);
> >>   } finally {
> >>     httpclient.getConnectionManager().shutdown();
> >> }
> >>
> >> I can attach the wire logs if needed.
> >>
> >> Thanks a lot for your time!
> >>
> >> I appreciate any help and pointers.
> >>
> >> Vanita
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to