Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

New Post: How to download XML response file

$
0
0
Try this test code, set the breakpoint on the line "concurrency::streams::streambuf<uint8_t> rwbuf = concurrency::streams::file_buffer<uint8_t>::open(fileName).get();"
and debug it to see if the size of result vector is [size] = 0x0002ac7c
int _tmain(int argc, _TCHAR* argv [])
{
    auto fileName = L"D:\\sample.xml";

    // Pop up
    web::http::uri_builder uribuilder(L"http://www.ga.gov.au/flood-study-search-gws/ows?service=wms&version=1.1.1&request=GetCapabilities");
    http_client client(uribuilder.to_uri());

    client.request(methods::GET).then([=](http_response response){
        return response.extract_vector();
    }).then([=](std::vector<uint8_t> result){
        concurrency::streams::streambuf<uint8_t> rwbuf = concurrency::streams::file_buffer<uint8_t>::open(fileName).get();
        rwbuf.putn(&result[0], result.size()).wait();
        rwbuf.close();
    }).wait();

    return 0;
}
From my computer, I can save the xml file correctly.

Viewing all articles
Browse latest Browse all 4845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>