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
.cpp using that: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 };
By the way, isnt there simple way to make http connection(trying to do it about 2 hours), like in java: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);
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();





