Hi,
I have a service that gives xml data. But it didn't connect, I reseach all
of documents on internet and you site, I develop my code on you site exampl=
e

I give the example of my code :

protected InputStream getInputStream() {
try {
SchemeRegistry schemeRegistry =3D new SchemeRegistry();

    // http scheme
    schemeRegistry.register(new Scheme("http",
PlainSocketFactory.
getSocketFactory(), 80));
    // https scheme
    schemeRegistry.register(new Scheme("https", new EasySSLSocketFactory()=
,
443));

    params =3D new BasicHttpParams();
    params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 1);
    params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new
ConnPerRouteBean(1));
    params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
    HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
    HttpProtocolParams.setContentCharset(params, "utf8");

    // ignore that the ssl cert is self signed
    CredentialsProvider credentialsProvider =3D new
BasicCredentialsProvider();
    credentialsProvider.setCredentials(new AuthScope("www.yemeksepeti.com"=
,
AuthScope.ANY_PORT),
    new UsernamePasswordCredentials("cs_basari", "bas0102ari"));
    clientConnectionManager =3D new ThreadSafeClientConnManager(params,
schemeRegistry);

    context =3D new BasicHttpContext();
    context.setAttribute("http.auth.credentials-provider",
credentialsProvider);

System.out.println("----------------yemeksepetiandroid---------------------=
--
http://www.yemeksepeti.com/YemeksepetiCatalogWebService/CatalogExportMobile=
.asmx/Mobile_GetCities?");


    DefaultHttpClient client =3D new
DefaultHttpClient(clientConnectionManager, params);
    HttpGet get =3D new HttpGet("
http://www.yemeksepeti.com/YemeksepetiCatalogWebService/CatalogExportMobile=
.asmx/Mobile_GetCities?");

    HttpResponse response =3D client.execute(get, context);
    HttpEntity entity =3D response.getEntity();
           System.out.println(response.getStatusLine());
           if (entity !=3D null) {
               System.out.println("Response content length: " +
entity.getContentLength());
           }
          return entity.getContent();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
static class PreemptiveAuth implements HttpRequestInterceptor {

       public void process(
               final HttpRequest request,
               final HttpContext context) throws HttpException, IOExceptio=
n
{

           AuthState authState =3D (AuthState) context.getAttribute(
                   ClientContext.TARGET_AUTH_STATE);

           // If no auth scheme avaialble yet, try to initialize it
preemptively
           if (authState.getAuthScheme() =3D=3D null) {
               AuthScheme authScheme =3D (AuthScheme) context.getAttribute=
(
                       "preemptive-auth");
               CredentialsProvider credsProvider =3D (CredentialsProvider)
context.getAttribute(
                       ClientContext.CREDS_PROVIDER);
               HttpHost targetHost =3D (HttpHost) context.getAttribute(
                       ExecutionContext.HTTP_TARGET_HOST);
               if (authScheme !=3D null) {
                   Credentials creds =3D credsProvider.getCredentials(
                           new AuthScope(
                                   targetHost.getHostName(),
                                   targetHost.getPort()));
                   if (creds =3D=3D null) {
                       throw new HttpException("No credentials for
preemptive authentication");
                   }
                   authState.setAuthScheme(authScheme);
                   authState.setCredentials(creds);
               }
           }

       }


   }



And it gives these error log:

11-30 16:41:08.902: WARN/etAuthenticationHandler(629): Authentication schem=
e
ntlm not supported
11-30 16:41:08.932: WARN/DefaultRequestDirector(629): Authentication error:
Unable to respond to any of these challenges: {ntlm=3DWWW-Authenticate: NTL=
M,
negotiate=3DWWW-Authenticate: Negotiate}
11-30 16:41:08.952: INFO/System.out(629): HTTP/1.1 401 Unauthorized
11-30 16:41:08.952: INFO/System.out(629): Response content length: 1656
11-30 16:42:56.021: WARN/jdwp(629): Debugger is telling the VM to exit with
code=3D1
11-30 16:42:56.021: INFO/dalvikvm(629): GC lifetime allocation: 2845 bytes
11-30 16:42:56.342: DEBUG/Zygote(33): Process 629 exited cleanly (1)
11-30 16:42:56.382: INFO/ActivityManager(69): Process
com.basarimobile.android.yemeksepeti (pid 629) has died.
11-30 16:42:56.442: INFO/WindowManager(69): WIN DEATH: Window{4511be98
com.basarimobile.android.yemeksepeti/com.basarimobile.android.yemeksepeti.L=
ogin
paused=3Dfalse}
11-30 16:42:56.602: INFO/UsageStats(69): Unexpected resume of
com.android.launcher while already resumed in
com.basarimobile.android.yemeksepeti
11-30 16:42:56.692: WARN/InputManagerService(69): Got RemoteException
sending setActive(false) notification to pid 629 uid 10036



How I can solve my problem thanks?

Filiz Gökçe

Reply via email to