1. Lucius1972, 28.09.2011 #1
    Lucius1972

    Lucius1972 Threadstarter Junior Mitglied

    Hallo Leute,

    Momentan arbeite Ich an einer App um mich ueber eine HTTPS Seite einzuloggen.
    Dabei werden alle Zerificate erlaubt, Ich bekommen aber folgende Fehler im Logcat:
    HTML:
    WARN/ResponseProcessCookies(4911): Cookie rejected: "BasicClientCookie[version=0,name=ObFormLoginCookie,domain=www.xxxx.com,path=/web/restricted/form?formelement=512663,expiry=null]". Illegal path attribute "/web/restricted/form?formelement=512663". Path of origin: "/web/restricted/form/formelement=512663"
    Kan mich da bitte Jemand weiterhelfen um dies zu loesen?
    Danke euch.

    Mein Code:
    Code:
     
    [SIZE=2]DefaultHttpClient client = [/SIZE]
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]; [/SIZE][/LEFT]
     
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]try[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] { [/SIZE][/LEFT]
     
     
     
    [LEFT][SIZE=2]KeyStore trustStore = KeyStore.[I]getInstance[/I](KeyStore.[I]getDefaultType[/I]()); [/SIZE][/LEFT]
     
    [LEFT][SIZE=2]trustStore.load([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2], [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]); [/SIZE][/LEFT]
     
     
     
     
     
    [LEFT][SIZE=2]SSLSocketFactory sf = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] CustomSSLSocketFactory(trustStore); [/SIZE][/LEFT]
     
    [LEFT][SIZE=2]sf.setHostnameVerifier(SSLSocketFactory.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]ALLOW_ALL_HOSTNAME_VERIFIER[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]); [/SIZE][/LEFT]
     
     
     
     
     
    [LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Setting up parameters [/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
     
    [LEFT][SIZE=2]HttpParams params = [/SIZE][/LEFT]
     
     
     
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] BasicHttpParams(); [/SIZE][/LEFT]
     
    [LEFT][SIZE=2]HttpProtocolParams.[I]setVersion[/I](params, HttpVersion.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]HTTP_1_1[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]); [/SIZE][/LEFT]
     
    [LEFT][SIZE=2]HttpProtocolParams.[I]setContentCharset[/I](params, [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"utf-8"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]); [/SIZE][/LEFT]
     
    [LEFT][SIZE=2]params.setBooleanParameter([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"http.protocol.expect-continue"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]false[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]); [/SIZE][/LEFT]
     
     
     
     
     
     
     
    [LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Setting timeout [/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
     
    [LEFT][SIZE=2]HttpConnectionParams.[I]setConnectionTimeout[/I](params, 5000); [/SIZE][/LEFT]
     
    [LEFT][SIZE=2]HttpConnectionParams.[I]setSoTimeout[/I](params, 5000); [/SIZE][/LEFT]
     
     
     
     
     
     
     
    [LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Registering schemes for both HTTP and HTTPS [/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
     
    [LEFT][SIZE=2]SchemeRegistry registry = [/SIZE][/LEFT]
     
     
     
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] SchemeRegistry(); [/SIZE][/LEFT]
     
    [LEFT][SIZE=2]registry.register([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Scheme([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"http"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], PlainSocketFactory.[I]getSocketFactory[/I](), 80)); [/SIZE][/LEFT]
     
    [LEFT][SIZE=2]registry.register([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Scheme([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"https"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], sf, 443)); [/SIZE][/LEFT]
     
     
     
     
     
    [LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Creating thread safe client connection manager [/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
     
    [LEFT][SIZE=2]ClientConnectionManager ccm = [/SIZE][/LEFT]
     
     
     
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] ThreadSafeClientConnManager(params, registry); [/SIZE][/LEFT]
     
     
    [LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Creating HTTP client [/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
     
    [LEFT][SIZE=2]client = [/SIZE][/LEFT]
     
     
     
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] DefaultHttpClient(ccm, params); [/SIZE][/LEFT]
     
     
    [LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Registering user name and password for authentication [/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
     
    [LEFT][SIZE=2]client.getCredentialsProvider().setCredentials( [/SIZE][/LEFT]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] AuthScope([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2], -1), [/SIZE]
    
    [SIZE=2]// Input user and password[/SIZE]
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] UsernamePasswordCredentials(username, password)); [/SIZE][/LEFT]
    [/LEFT]
    
     
     
     
     
     
     
     
     
    [LEFT][SIZE=2]} [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]catch[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] (Exception e) { [/SIZE][/LEFT]
     
    [LEFT][SIZE=2]client = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] DefaultHttpClient(); [/SIZE][/LEFT]
     
    [LEFT][SIZE=2]} [/SIZE][/LEFT]
     
     
     
     
     
     
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] String url = [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"https://www.xxxx.com/web/restricted/form/formelement=512663"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]; [/SIZE][/LEFT]
     
    [LEFT][SIZE=2]HttpPost httpPost = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] HttpPost(url); [/SIZE][/LEFT]
     
     
     
     
     
     
    [LEFT][SIZE=2]HttpResponse response = client.execute(httpPost);[/SIZE][/LEFT]
     
    [LEFT][SIZE=2]Log.[I]w[/I]([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Response "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Status line : "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]+ response.toString()); [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// 200 if successfully logged in[/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
    
     
  2. Thyrion, 28.09.2011 #2
    Thyrion

    Thyrion Ehrenmitglied

    Schau dir mal den Pfad deines Elements und den Pfad des Cookies an. Die stimmen nicht überein und daher wird aus Sicherheitsgründen die Warnung geworfen:

    "/web/restricted/form?formelement=512663" (value)
    und
    "/web/restricted/form/formelement=512663" (Path of origin)




    Ich vermute auch mal, dass du hier ein ? statt / setzen wolltest, oder?
    -> final String url = "https://www.xxxx.com/web/restricted/form/formelement=512663";
     
  3. Lucius1972, 28.09.2011 #3
    Lucius1972

    Lucius1972 Threadstarter Junior Mitglied

  4. Lucius1972, 28.09.2011 #4
    Lucius1972

    Lucius1972 Threadstarter Junior Mitglied

  5. Lucius1972, 28.09.2011 #5
    Lucius1972

    Lucius1972 Threadstarter Junior Mitglied

    Ist da keiner der weiterhelfen kann?
    Vielleicht uebersehe Ich ja was..