×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Nov 2010
    Posts
    93

    Thumbs up Error in Http post method

    I have tried to post two values using HTTP POST. I got following errors...

    1) Multiple markers at this line
    - 'RHTTPSession::OpenTransactionL(const TUriC8 &, MHTTPTransactionCallback &, RStringF)' (non-static)
    - function call '[RHTTPSession].OpenTransactionL({lval} TUriParser8, {lval} CTestAppUi, {lval} RStringF)' does
    not match
    2) Multiple markers at this line
    - illegal implicit conversion from
    'CTestAppUi *' to- 'MHTTPDataSupplier *'

    TestAppUi.cpp:

    Code:
      void CTestAppUi::IssueHTTPPostL(const TDesC8& aUri,const TDesC8& aContentType,const TDesC8& aBody)
    {
    	     TUriParser8 uri;
    		 uri.Parse(aUri);
    		 
    		 RStringF method=iSession.StringPool().StringF(HTTP::EGET, RHTTPSession::GetTable());
    		 
    		 iTransaction = iSession.OpenTransactionL(uri, *this, method);// Error 1
    		 
    		 _LIT8(KUserAgent, "SimpleClient 1.0");
    		 _LIT8(KAccept, "*/*");
    		 _LIT8(EContentType, "text/plain");
    		 RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection();
    		 SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
    		 SetHeaderL(hdr, HTTP::EAccept, KAccept);
    		 SetHeaderL(hdr, HTTP::EContentType, aContentType);
    		
    // Set content-type field of the header
    
    // Set this class as an data supplier. Inherited MHTTPDataSupplier
    // methods are called when framework needs to access body data.
     MHTTPDataSupplier* dataSupplier = this;  //Error 2...i tried to implement MHTTPDataSupplier for TestAppUi class..but that also not working
    iTransaction.Request().SetBody(*dataSupplier);
    iTransaction.SubmitL();
    }
    please help me resolve this issues....

    Also In this method where can i put my data(like username and password) to post....

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    India
    Posts
    1,173

    Re: Error in Http post method

    You are passing wrong parameters to openTransactionsL(). The declaration of this function is:

    Code:
    IMPORT_C RHTTPTransaction OpenTransactionL(const TUriC8& aURI, 
    									  MHTTPTransactionCallback& aCallback, 
    									  RStringF aMethod = RStringF());
    so, rather than passing your AppUi's object as second parameter, you should pass an object of MHTTPTransactionCallback class. So, derive your own class (in which you are defining all the HTTP related funstions i.e. HttpEngine class) by MHTTPTransactionCallback class. Make the object of HttpEngine (your class) and pass it in OpenTransactionL().

    Also, for its first parameter, do it like
    Code:
    TUriParser8 uri;
    	uri.Parse(aUri);
    // where aUri is = const TDesC8& aUri

Similar Threads

  1. HTTP Post Method - 403 Forbidden error
    By sid_diu in forum Symbian
    Replies: 1
    Last Post: 2011-05-05, 13:37
  2. Terribly Facing a problem in HTTP Post Method
    By joy.mca in forum Symbian
    Replies: 2
    Last Post: 2009-10-05, 09:37
  3. HTTP GET and POST METHOD
    By hornsattack in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2009-08-03, 11:26
  4. Can we use PUT method instead of Post in HTTP
    By ash_21 in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2009-07-21, 08:44
  5. And HTTP POST method Works !!
    By n_sidhaye in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2003-11-08, 17:54

Posting Permissions

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