I am using VS2010 and Casablanca version 1.2 to integrate a REST interface into an existing C++ solution. If I create a new solution with only this block of code it works flawlessly. When I drop this code into an existing .cpp file it crashes on the create of the client object with a memcpy exception. I have done the updates the props file to look at the correct version of Casablanca (100) and added my external dependencies as well the paths for the include and lib directories.
The block of code is:
The call stack for the exception is below.
msvcr100d.dll!_VEC_memcpy(void * dst, void * src, int len) + 0x46 bytes C
cpprest100d_1_2.dll!_wmemcpy() + 0x31 bytes
cpprest100d_1_2.dll!std::char_traits<wchar_t>::copy() + 0x2f bytes
cpprest100d_1_2.dll!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> ::assign() + 0xb7 bytes
cpprest100d_1_2.dll!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> ::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >() + 0x86 bytes
cpprest100d_1_2.dll!web::http::client::credentials::credentials() + 0x67 bytes
cpprest100d_1_2.dll!web::http::client::http_client_config::http_client_config() + 0x6c bytes
cpprest100d_1_2.dll!web::http::client::details::_http_client_communicator::_http_client_communicator() + 0x73 bytes cpprest100d_1_2.dll!web::http::client::details::winhttp_client::winhttp_client() + 0x52 bytes
cpprest100d_1_2.dll!std::tr1::_Ref_count_obj<web::http::client::details::winhttp_client>::_Ref_count_obj<web::http::client::details::winhttp_client><web::http::uri const &,web::http::client::http_client_config const &>() + 0xa6 bytes
cpprest100d_1_2.dll!std::tr1::make_shared<web::http::client::details::winhttp_client,web::http::uri const &,web::http::client::http_client_config const &>() + 0x8f bytes
cpprest100d_1_2.dll!web::http::client::http_network_handler::http_network_handler() + 0x70 bytes
cpprest100d_1_2.dll!std::tr1::_Ref_count_obj<web::http::client::http_network_handler>::_Ref_count_obj<web::http::client::http_network_handler><web::http::uri const &,web::http::client::http_client_config const &>() + 0xa3 bytes
cpprest100d_1_2.dll!std::tr1::make_shared<web::http::client::http_network_handler,web::http::uri const &,web::http::client::http_client_config const &>() + 0x8c bytes
cpprest100d_1_2.dll!web::http::client::http_client::build_pipeline() + 0x6f bytes
cpprest100d_1_2.dll!web::http::client::http_client::http_client() + 0x74 bytes
Hl7.exe!CChartSchedule::sendScheduleToCIM(QMsgSchedule * pMsg) Line 146 + 0x35 bytes C++
I have searched high and low to try and find a solution to this error with no avail. I think it may be a setting somewhere in the project settings but I have compared the stand alone project to my integrated project and can't come up with anything.
Any help or suggestions of where to look would be greatly appreciated.
Thanks.
Sandy
The block of code is:
try
{
http_client_config cimconfig;
cimconfig.set_validate_certificates(false);
http_client cimclient(L"https://dmaid52.corp.global/workplace",cimconfig);
cimclient .request(methods::GET).then([](http_response response) {
string_t theResponse = response.to_string();
}).wait();
}
catch( const http_exception &e )
{
printf("Exception status code %u returned. %s\n", e.error_code(), e.what());
}
When the call to create the cimclient is called I get the exception. If I remove the references to the config and only call http_client cimclient(L"https://dmaid52.corp.global/workplace") it seems to work ok but them it will throw the exception on the .request.The call stack for the exception is below.
msvcr100d.dll!_VEC_memcpy(void * dst, void * src, int len) + 0x46 bytes C
cpprest100d_1_2.dll!_wmemcpy() + 0x31 bytes
cpprest100d_1_2.dll!std::char_traits<wchar_t>::copy() + 0x2f bytes
cpprest100d_1_2.dll!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> ::assign() + 0xb7 bytes
cpprest100d_1_2.dll!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> ::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >() + 0x86 bytes
cpprest100d_1_2.dll!web::http::client::credentials::credentials() + 0x67 bytes
cpprest100d_1_2.dll!web::http::client::http_client_config::http_client_config() + 0x6c bytes
cpprest100d_1_2.dll!web::http::client::details::_http_client_communicator::_http_client_communicator() + 0x73 bytes cpprest100d_1_2.dll!web::http::client::details::winhttp_client::winhttp_client() + 0x52 bytes
cpprest100d_1_2.dll!std::tr1::_Ref_count_obj<web::http::client::details::winhttp_client>::_Ref_count_obj<web::http::client::details::winhttp_client><web::http::uri const &,web::http::client::http_client_config const &>() + 0xa6 bytes
cpprest100d_1_2.dll!std::tr1::make_shared<web::http::client::details::winhttp_client,web::http::uri const &,web::http::client::http_client_config const &>() + 0x8f bytes
cpprest100d_1_2.dll!web::http::client::http_network_handler::http_network_handler() + 0x70 bytes
cpprest100d_1_2.dll!std::tr1::_Ref_count_obj<web::http::client::http_network_handler>::_Ref_count_obj<web::http::client::http_network_handler><web::http::uri const &,web::http::client::http_client_config const &>() + 0xa3 bytes
cpprest100d_1_2.dll!std::tr1::make_shared<web::http::client::http_network_handler,web::http::uri const &,web::http::client::http_client_config const &>() + 0x8c bytes
cpprest100d_1_2.dll!web::http::client::http_client::build_pipeline() + 0x6f bytes
cpprest100d_1_2.dll!web::http::client::http_client::http_client() + 0x74 bytes
Hl7.exe!CChartSchedule::sendScheduleToCIM(QMsgSchedule * pMsg) Line 146 + 0x35 bytes C++
I have searched high and low to try and find a solution to this error with no avail. I think it may be a setting somewhere in the project settings but I have compared the stand alone project to my integrated project and can't come up with anything.
Any help or suggestions of where to look would be greatly appreciated.
Thanks.
Sandy