views:

47

answers:

2

A rather simple question. Should I use the WinHttp library to make a web service request in my C++ programs or should I use the IXmlHttpRequest interface in the msxml library to send web service requests? Obviously the WinHttp library provides a lot more fine control compared to the IXmlHttpRequest library. But the XmlHttpRequest object is a w3.org standard and in theory more portable.

A: 

Simple answer to your "simple question": You should use what you feel most comfortable in and what best fits to your requirements.

You could also consider the http client in boost::asio.

Peter Jansson
A: 

It depends whether you are accessing the service on secure channel i.e. HTTPS or simple one i.e. HTTP.

As per MSDN (http://msdn.microsoft.com/en-us/library/ms891732.aspx), IXMLHttpRequest supports only HTTP.

Note IXMLHTTPRequest does not support secure website access. To access a secure website, use the WinINet API.

But WinInet API is quite old and have some multi-threading issues (I think its there on MSDN too)...

So the best bet is WinHTTP for HTTPS and HTTP, otherwise good old IXMLHttpRequest.

Note: libcurl and curlpp (c++ port of libcurl) is also there to check. There is an old post for this http://stackoverflow.com/questions/1011339/how-do-you-make-a-http-request-with-c

Favonius