I need to send a https request (e.g. https://service.mydomain.com/wservice/abc?param1¶m2) to web service which returns a xml response. It is a well formed URL without any explicit port mentioned in it.
I am using the following code to create HTTPClient session
- Code: Select all
url=https://service.mydomain.com/wservice/abc?param1¶m2;
URI uri(url);
std::string path(uri.getPathAndQuery());
if (path.empty()) path = "/";
HTTPClientSession session(uri.getHost(), uri.getPort());
HTTPRequest req(HTTPRequest: :HTTP_GET, path, HTTPMessage::HTTP_1_1);
session.sendRequest(req);
When HTTPClientSession is created with "uri.getPort", by default it takes port 443 as connection port to server and I Get "connection reset by peer" message as response and if I remove uri.getPort and use only getHost, it takes port 80 as default.
Is there anyway that I can get it working without explicit port information as I dont have it.
The same url works fine, if sent by WebBrowser in form of URL (https://service.mydomain.com/wservice/abc?param1¶m2).
Any help is highly appreciated.
Thanks





