언어 설정

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();
Edited by: Brock Boland on 17 3월, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

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