语言

Menu
Sites
Language
How do i using Http Post Request?
​Dear All,

I want to using Http Post request for implement some functions.

But, I can't using Http Post Request. 

It looks like HttpStringEntity is not working. How about you? Server side tell me that "entity is empty". What's wrong?

Please check below my code.

HttpTransaction * pTransaction = mHttpSession->OpenTransactionN();
pTransaction->AddHttpTransactionListener(*this);

HttpRequest * pRequest = pTransaction->GetRequest();

pRequest->SetUri(url);
pRequest->SetMethod(NET_HTTP_METHOD_POST);

HttpHeader * pHeader = pRequest->GetHeader();
string he = oAuthHeader.substr(15).c_str();
String header = he.c_str();
pHeader->AddField("Authorization", header);

HttpStringEntity * pEntity = new HttpStringEntity();
pEntity->Construct(args);
pRequest->SetEntity(*pEntity);

pTransaction->SetUserObject(userObjects);
pTransaction->Submit();
编辑者为: Brock Boland 17 3月, 2014 原因: Paragraph tags added automatically from tizen_format_fix module.

响应

3 回复
Manasij Roy
Can you check the return values of pEntity->Construct(args); and pRequest->SetEntity(*pEntity);
Sarath C
I am also facing the same problem but both Construct and Setting entity worked well. But the server says it has request object associated with it
kavish
Hi sirrock, Just check that you are using correct header file name #include and namespace using namespace Tizen::Net::Http. For more details have a look on given link. https://developer.tizen.org/help/topic/org.tizen.native.apireference/classTizen_1_1Net_1_1Http_1_1HttpStringEntity.html