Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor lengyuecau's Avatar
    Join Date
    Mar 2005
    Posts
    190
    Hi, guys!
    I want to get user data from the GPRS networking using HTTP protocol. But the server request the authentication using digest.

    I looked up in the Symbian SDK documentation and found the "MHTTPAuthenticationCallback" may do this work.

    I inherented the class and implemented the GetCredentialsL function. But when i send the "GET" operation to the server, the server give a response of "401" message, but the program don't do nothing and GetCredentialsL method is also not called.

    So i want someone give some suggestions or why it doesn't work.
    Thanks in advance!
    My code snippet is followed below:
    Code:
    void CHttpHandler::ConstructL()
    {
    	iSession.OpenL();
    	InstallAuthenticationL(iSession);
    }
    
    void CHttpHandler::SendGetL( const TDesC8& aURI, const TDesC8& aETag)
    {
    	TUriParser8 uriParser;
    	uriParser.Parse( aURI);
    	RStringF getMethod = iSession.StringPool().StringF(HTTP::EGET, RHTTPSession::GetTable());
    	iTransaction = iSession.OpenTransactionL( uriParser, *this, getMethod);
    	RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection();
    
    	if ( aETag != KNullDesC8)
    		SetHeaderL( hdr, HTTP::EIfMatch, aETag);
    	SetHeaderL( hdr, KXCAPIden, iUserUri);
    
    	iTransaction.SubmitL();
    }
    
    TBool CHttpHandler::GetCredentialsL( const TUriC8& aURI, RString aRealm, RStringF aAuthenticationType, RString& aUsername, RString& aPassword)
    {
    	TBuf<KURIBufferSize> authType;
    	TBuf<KURIBufferSize> uri;
    	TBuf<KDefaultBufferSize> authText;
    	authType.Copy(aAuthenticationType.DesC());
    	uri.Copy(aURI.UriDes());
    	
    	_LIT(KAuthRequired, "%S requires %S authentication.");
    	authText.Format(KAuthRequired, &uri, &authType);
    	_LIT(KAuthNote, "Authentication required.");
    	
    	RLog::Log( KAuthNote );
    
    	TBuf8<KDefaultBufferSize> userName;
    	TBuf8<KDefaultBufferSize> password;
    	_LIT8(KUserName, "sip:user7@example.com");
    	_LIT8(KPswd, "123");
    	
    	userName = KUserName();
    	password = KPswd();
    	
    	
    	TBuf8<KDefaultBufferSize> temp;
    	temp.Copy(userName);
    	TRAPD(err, aUsername = aRealm.Pool().OpenStringL(temp));
    	
    	if (!err)
    	{
    		temp.Copy(password);
    		TRAP(err, aPassword = aRealm.Pool().OpenStringL(temp));
    		if (!err)
    			return ETrue;
    	}
    	return EFalse;
    }

  2. #2
    Registered User srk2007's Avatar
    Join Date
    Oct 2007
    Posts
    42
    Hello my name is shravan.Iam also symbian beginner in developing. Actually iam struck with How to implement startonBoot code and launch a dialog for pw at the startup ie when mobile gets switched on?

    can u send me the code or try to help me in any way.
    Last edited by srk2007; 2007-11-16 at 10:04. Reason: adding few

Similar Threads

  1. Can I streaming Video from internet on S60 3rd edition?
    By jianyu_21 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2008-04-25, 05:15
  2. S60 3rd edition - getting started issue
    By Bill_Murray in forum Symbian C++
    Replies: 5
    Last Post: 2006-12-22, 14:44
  3. Remote Camera Manager - S60 3rd edition
    By pspickett in forum General Development Questions
    Replies: 0
    Last Post: 2006-12-18, 07:02
  4. RTP stack on S60 3rd edition
    By kit_walker in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2006-09-28, 14:37
  5. CLDC 1.1 Symbian S60 3rd Edition / CDC-lite ?
    By kevinmacdonald in forum Mobile Java General
    Replies: 2
    Last Post: 2006-05-12, 01:14

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved