×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    4

    CHTTPFormEncoder problem

    Hi, I'm trying to use the example of HTTPClientExample which is posted on the forum nokia already. In the example, the body of the POST request is build like this:

    MHTTPDataSupplier* dataSupplier = this;
    iTransaction.Request().SetBody(*dataSupplier);

    where my class is derived from MHTTPDataSupplier. But, in my case, I have to use the application/x-www-form-urlencoded content type and they(the documentation) say that I have to use the CHTTPFormEncoder instead of MHTTPDataSupplier to be able to encode the body. If I use the MHTTPDataSupplier, the return of the post is 'Bad Authentication'. And my code look like this:

    CHTTPFormEncoder* data;
    data = CHTTPFormEncoder::NewL();
    data->AddFieldL(_L8("email"),_L8("mymail@domain.com"));
    data->AddFieldL(_L8("Passwd"),_L8("mypass"));
    data->AddFieldL(_L8("source"),_L8("example-1"));
    data->AddFieldL(_L8("service"),_L8("cl"));
    iTransaction.Request().SetBody(*data);

    Which still givin' me the 'Bad Authetication' error. I think I might missing something..

    Can any1 help?

    []'s, Ruy.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,698

    Re: CHTTPFormEncoder problem

    Exactly who gives that error message to you?

  3. #3
    Registered User
    Join Date
    Mar 2008
    Posts
    4

    Re: CHTTPFormEncoder problem

    Sry, this is the original code (my class is derived from MHTTPDataSupplier):

    iPostData = 0;
    iPostData = aBody.AllocL();//The body of the POST form
    MHTTPDataSupplier* dataSupplier = this;
    iTransaction.Request().SetBody(*dataSupplier);
    iTransaction.SubmitL();

    And the return value on the function ClientBodyReceived() on the observer is "bad Authentication". So, I modified to:

    CHTTPFormEncoder* data;
    data = CHTTPFormEncoder::NewL();
    data->AddFieldL(_L8("email"),_L8("mymail@gmail.com"));
    data->AddFieldL(_L8("Passwd"),_L8("mypass"));
    data->AddFieldL(_L8("source"),_L8("exampple-1"));
    data->AddFieldL(_L8("service"),_L8("cl"));
    iTransaction.Request().SetBody(*data);
    iTransaction.SubmitL();

    but it still givin' me the same error.

    []'s, Ruy.
    Last edited by rdnobrega; 2009-06-10 at 06:29.

Similar Threads

  1. STLPort namespace issue
    By yickhong in forum Open C/C++
    Replies: 0
    Last Post: 2009-04-09, 08:54
  2. SyncML link problem
    By samuel_ in forum Symbian
    Replies: 4
    Last Post: 2009-03-27, 08:02
  3. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  4. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  5. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×