Overview
Features
Download
Documentation
Community
Add-Ons & Services

HTTP Post issue

Please post support and help requests here.

HTTP Post issue

Postby kiskit » 17 Jan 2009, 22:59

Hello everyone

I'm trying to send XML in a HTTP POST request.
I (probably naively) created a HTTPRequest in a HTTPClientSession. But there is no way I can fill in a content.

Oh and the goal is to obtain the body on the server side, also with Poco. So far I have a running HTTPServer and the handler is activated. But no way to get the body from the request either.

Can someone help me do that?

BRs

kiskit
kiskit
 
Posts: 2
Joined: 17 Jan 2009, 22:53

Re: HTTP Post issue

Postby alex » 18 Jan 2009, 23:17

kiskit wrote:I'm trying to send XML in a HTTP POST request.
I (probably naively) created a HTTPRequest in a HTTPClientSession. But there is no way I can fill in a content.

Code: Select all
HTTPTestServer srv;
HTTPClientSession s("localhost", srv.port());
HTTPRequest request(HTTPRequest::HTTP_POST, "/echo");
std::string body("this is a random request body\r\n0\r\n");
request.setContentLength((int) body.length());
s.sendRequest(request) << body;

kiskit wrote:Oh and the goal is to obtain the body on the server side, also with Poco. So far I have a running HTTPServer and the handler is activated. But no way to get the body from the request either.

Can someone help me do that?


See Net/samples/HTTPFormServer
alex
 
Posts: 1114
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: HTTP Post issue

Postby kiskit » 19 Jan 2009, 11:19

Looks pretty much what I want and pretty simple at the same time.

I'll try that tonight. Thanks a lot Alex.

Kiskit
kiskit
 
Posts: 2
Joined: 17 Jan 2009, 22:53

Re: HTTP Post issue

Postby gustavsen » 20 Jan 2009, 21:19

Hi,
I have this problem previously, finally with help in the list I found the missing part.

I copy my example code in pastebin for avoid forum reinterpretation:

http://pastebin.com/f69bff813

best regards
Gustavsen
gustavsen
 
Posts: 8
Joined: 21 Oct 2008, 14:24


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron