2011-05-09 5 views
0

J'essaie de connecter mon application sur REST.Iphone AsiHttpRequest authentification RESTService

Je ne comprends pas, quand j'essaye de me connecter dans un premier temps, c'est échouer (403). Et quand je réessaye, c'est bon! (Je n'ai pas le certificat de Validé à ce moment)

 request = [ASIHTTPRequest requestWithURL:url]; 
    [request setUsername:login]; 
    [request setPassword:password]; 
    [request setDelegate:delegate]; 
    [request setRequestMethod:GET]; 
    [request setValidatesSecureCertificate:NO]; 
    /*I keep my login/pass*/ 
    [request setShouldPresentCredentialsBeforeChallenge:YES]; 
    [request setUseSessionPersistence:YES]; 
    [request setShouldAttemptPersistentConnection:YES]; 
    [request setPersistentConnectionTimeoutSeconds:15.0]; 
    [request setUseCookiePersistence:YES]; 
    /**/ 
    [request startSynchronous]; 

Et journal:

requestUrl:https://urlToLogin 

login:user 

pwd:pwduser 


Starting synchronous request <ASIHTTPRequest: 0x504fc00> 

Request #1 will use connection #1 

===Used: 0 bytes of bandwidth in last measurement period=== 

Request <ASIHTTPRequest: 0x504fc00> received response headers 

Got a keep-alive header, will keep this connection open for 15.000000 seconds 

Request <ASIHTTPRequest: 0x504fc00> finished downloading data (118 bytes) 

Request #1 finished using connection #1 

codeResponce:403 

requestUrl:https://urlToLogin 

login:user 

pwd:pwduser 

Starting synchronous request <ASIHTTPRequest: 0x603a600> 

Request #2 will use connection #1 

Request <ASIHTTPRequest: 0x603a600> received response headers 

Got a keep-alive header, will keep this connection open for 15.000000 seconds 

===Used: 138 bytes of bandwidth in last measurement period=== 

Request <ASIHTTPRequest: 0x603a600> finished downloading data (20 bytes) 

Request #2 finished using connection #1 

Request finished: <ASIHTTPRequest: 0x603a600> 

Répondre

0

On dirait qu'il pourrait ne pas être votre application qui ne va pas, mais le serveur que vous essayez de vous connecter - 403 signifie interdit, donc réessayer ne devrait pas le réparer.

À quoi est-ce que vous essayez de vous connecter?

Questions connexes