×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    31

    HTTP Connection problem

    Had looked to httpclientexample.cpp

    Made like there it was and
    getting compilation problem.

    function call '[RHTTPSession].OpenTransactionL({lval} const TLitC8<35>, {lval} CHttpEventHandler, {lval} RStringF)' does not match RHTTPSession::OpenTransactionL(const TUriC8 &, MHTTPTransactionCallback &, RStringF)' (non-static)

    However,
    in .h file
    Code:
    class CHttpEventHandler : public CBase, public MHTTPTransactionCallback
    	{
    public:
    	virtual ~CHttpEventHandler();
    	static CHttpEventHandler* NewLC();
    	static CHttpEventHandler* NewL();
    	//void SetVerbose(TBool aVerbose);
    	//TBool Verbose() const;
    	//
    	// methods from MHTTPTransactionCallback
    	//
    	virtual void MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent);
    	virtual TInt MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent);
    
    protected:
    	//CHttpEventHandler(CHttpExampleUtils& aUtils);
    	void ConstructL();
    private:
    	void DumpRespHeadersL(RHTTPTransaction& aTrans);
    	void DumpRespBody(RHTTPTransaction& aTrans);
    	void DumpIt(const TDesC8& aData);
    	TBool iVerbose;
    	TBool iSavingResponseBody;
    	RFs iFileServ;
    	RFile iRespBodyFile;
    	TFileName iRespBodyFileName;
    	TParse iParsedFileName;
    	MHTTPDataSupplier* iRespBody;
    //	CHttpExampleUtils& iUtils; // not owned
    	};
    .cpp using that:

    Code:
    _LIT8(KUri,"http://...");
    			CHTTPFormEncoder* iFormEncoder = CHTTPFormEncoder::NewL();
    			RHTTPTransaction iTransaction;
    			RHTTPSession iSess;
    			CHttpEventHandler* iTransObs;
    			//CHttpEventHandler* iTransObs;
    			iSess.OpenL();
    			RStringPool strP = iSess.StringPool();
    			RStringF aMethod;
    			aMethod = strP.StringF(HTTP::EPOST,RHTTPSession::GetTable());
    the error line ----->   iTransaction= iSess.OpenTransactionL(KUri, *iTransObs, aMethod);
    By the way, isnt there simple way to make http connection(trying to do it about 2 hours), like in java:

    Code:
     HttpConnection connection = null;
               connection = (HttpConnection) Connector.open("http://...");
               connection.setRequestMethod(HttpConnection.POST);
               connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
               connection.setRequestProperty("Connection", "close");
               connection.setRequestProperty("User-agent", "ua");
    
               OutputStream os = connection.openOutputStream();
               byte[] data=xmlStr.getBytes();
               connection.setRequestProperty("Content-length", ""+data.length );
               os.write(data);
               os.close();
               int ResponseCode=connection.getResponseCode();
               String ResponseMessage=connection.getResponseMessage();

  2. #2
    Super Contributor
    Join Date
    Jan 2007
    Location
    Bhubaneswar, India
    Posts
    1,189

    Re: HTTP Connection problem

    check OpenTransactionL() method in .h and .cpp file. In both file check parameter and return type of OpenTransactionL method.
    -------------------------------------
    Thanks & Regards
    Ram
    Symbian OS 9.2/9.3,S60 3rd FP1/FP2,Carbide.c++v2.0

  3. #3
    Registered User
    Join Date
    Aug 2009
    Posts
    31

    Thumbs up Re: HTTP Connection problem

    Thanks, but problem was in URL parameter.

    Need to doing like:
    Code:
    ///!!!!LIBRARY        inetprotutil.lib
    TUriParser8 uri;
    			uri.Parse(KUri); //Where aDes8Data can be TDesC8. 
    			iTransaction= iSess.OpenTransactionL(uri, *iTransObs, aMethod);

  4. #4
    Regular Contributor
    Join Date
    Jun 2007
    Posts
    52

    Re: HTTP Connection problem

    You can't pass LITERAL to the function,Copy that LITERAL to a Buffer and pass the buffer.

    For Ex:
    Code:
            TBuf8<KMaxLength> URL(KUri);
            TUriParser8 uri;
    	uri.Parse(URL);  
    	iTransaction= iSess.OpenTransactionL(uri, *iTransObs, aMethod);

Similar Threads

  1. strange problem with HTTP connection
    By yazwas in forum Symbian
    Replies: 0
    Last Post: 2007-10-08, 02:30
  2. HTTP Connection problem with real series 40 device
    By pagadi in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2004-06-17, 09:28
  3. NOKIA vs. SIEMENS HTTP connection problem?
    By imarenic in forum Mobile Java General
    Replies: 2
    Last Post: 2003-11-03, 12:18
  4. NOKIA vs. SIEMENS HTTP connection problem?
    By imarenic in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2003-11-03, 09:03
  5. Replies: 2
    Last Post: 2003-02-19, 03:10

Posting Permissions

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