Hi,
I'm trying to make HttpExampleClient for symbian sdk 7.0 work... When I choose "1. Get" and I enter an url, I get an error:
"<unrecognised event: -7361>"
(I compiled the release ver. of sample app, because when I tried to compiled the debug version, an error occurs: "EEXE.LIB(UP_EXE.obj) : fatal error LNK1103: debugging information corrupt; recompile module"😉
I used "Ethernet Support Configuration" to configure my emulator and I managed to surf the web using Services->ETHERNET.
Any ideas?
Using Httpexempleclient sample from symbian sdk, I wrote a minimal test class MyHttpClient, but it doesn't seems to work, because after "iTrans.SubmitL(); ", my second class CHttpEventHandler derived from MHTTPTransactionCallback receive first an THTTPEvent status = -7361, and then a THTTPEvent::EFailed.
What is the problem here?
Thank you.
Cristian Miron
Code:
class CHttpEventHandler : public CBase, public MHTTPTransactionCallback
{
public:
//
// methods from MHTTPTransactionCallback
//
virtual void MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent)
{
switch (aEvent.iStatus)
{
case THTTPEvent::EGotResponseHeaders:
{
// HTTP response headers have been received. We can determine now if there is
// going to be a response body to save.
RHTTPResponse resp = aTransaction.Response();
TInt status = resp.StatusCode();
RStringF statusStr = resp.StatusText();
TBuf<32> statusStr16;
statusStr16.Copy(statusStr.DesC());
} break;
case THTTPEvent::EGotResponseBodyData:
{
// Get the body data supplier
MHTTPDataSupplier* iRespBody = aTransaction.Response().Body();
iRespBody->ReleaseData();
} break;
case THTTPEvent::EResponseComplete:
{
int a = 0 ;
// The transaction's response is complete
} break;
case THTTPEvent::ESucceeded:
{
aTransaction.Close();
CActiveScheduler::Stop();
} break;
case THTTPEvent::EFailed:
{
int a = 0 ;
//aTransaction.Close();
//CActiveScheduler::Stop();
} break;
case THTTPEvent::ERedirectedPermanently:
{
int a = 0 ;
} break;
case THTTPEvent::ERedirectedTemporarily:
{
int a = 0 ;
} break;
default:
{
int a = 0 ;
} break;
}
}
virtual TInt MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent)
{
return 0;
}
};
class MyHttpClient : public CBase
{
RHTTPSession *iSess;
public:
MyHttpClient()
{
iSess = new RHTTPSession();
// create an active scheduler to use
// CActiveScheduler* scheduler = new(ELeave) CActiveScheduler();
// CleanupStack::PushL(scheduler);
// CActiveScheduler::Install(scheduler);
}
~MyHttpClient()
{
delete iSess;
iSess = NULL;
}
void SendRequest(TUriParser8 uri)
{
iSess->OpenL();
RStringPool strP = iSess->StringPool();
RStringF aMethod;
aMethod = strP.StringF(HTTP::EGET,RHTTPSession::GetTable());
CHttpEventHandler* iTransObs = new CHttpEventHandler();
RHTTPTransaction iTrans = iSess->OpenTransactionL(uri, *iTransObs, aMethod);
RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();
// submit the transaction
iTrans.SubmitL();
// Start the scheduler, once the transaction completes or is cancelled on an error the scheduler will be
// stopped in the event handler
CActiveScheduler::Start();
}
};
...
MyHttpClient hc;
TUriParser8 uri;
uri.Parse(_L8("news.yahoo.com"😉);
hc.SendRequest(uri);
....