Is Casablanca supported on windows server 2008?

Apr 9, 2014 at 6:28 AM
hi, I'm using casablanca to develop a REST client applcaition in c++.
It works perfectly well on my deskop but not working if i deploy it to a windows server 2008?
Is it because it's not supported on windows server? If so, is there any alternatives out there for me?
Coordinator
Apr 11, 2014 at 1:20 AM
Hi

I don't see why Casablanca cannot work on Windows server 2008.
Could you please share some more information about your scenario and the error that you are seeing?

Thanks
Kavya
Apr 11, 2014 at 2:03 AM
hi, kavyako,

thank you for your reply.

I'm delveloping my application in visual studio 2012, with casablanca version 1.4.
Take the sample project "BingRequest" for example. I can run it on my local dev machine,
but when i tried to deploy it on my server 2008, i'm get a system error windows when i start the exe.
the window says "The program can't start because because MSVP110D.dll" is missing from your computer. Try reinstalling the program to fix this problem"

I googled the error message, some guys suggested installing Visual C++ 2012 Redistributable Package on my server 2008.
i tried , but still the same error.

I found that windows server 2008 is not listed as the supported platfrom for casablanca,
have you tested on server 2008?

thanks so much!
Apr 11, 2014 at 2:33 AM
hi,

actually i just tried the same deployment process on a fresh new Windows 7 (without VS2012 installed)
the same error occured.

So i'm starting to wonder it's not a matter of windows platform.

what do i need to do to deploy my application to a windows machine without vs2012 installed?
Apr 11, 2014 at 2:40 AM
please don't bother

i tried the releader version of my app, and it all works
thanks!
Coordinator
Apr 11, 2014 at 3:36 PM
Hi subuliu,

Glad to know you got it working. Let us know if you have any other questions.

Steve
Sep 2, 2014 at 1:04 PM
Steve,

I have another situation with Windows server 2008. I suppose you are the only one who can help me on this.
I have a client developed in Visual Studio 2010 on Windows 7 platform. All the code is working perfect on Windows 7, but on windows server 2008 I occasionally
receive the body of the response. I do not have Firewall on Windows 7 or on Windows Server. The log for building the response shows that the body is present and sent.
Here is my code for writing the log
client.request(request).then([=](http_response response)
    {
      utility::string_t res = response.to_string();
      std::string strResponsePOST = "";
      strResponsePOST = utility::conversions::to_utf8string(res);

      std::ostringstream ResponsePOST;
      ResponsePOST << "ResponsePOST_" << strFileNameDateTime << ".txt";

      std::ofstream outResponse; 
      outResponse.open (ResponsePOST.str(), std::ios_base::out | std::ios_base::trunc);
      outResponse << "Server returned returned status code " << response.status_code() << std::endl  << strResponsePOST << std::endl;
      outResponse.close();
....
}
I also tried this version too (but the issue persists):
client.request(request).then([=](http_response response)
    {
      utility::string_t res = response.to_string();
      
      std::wostringstream ss;

      std::ostringstream ResponsePOST;
      ResponsePOST << "ResponsePOST_" < strFileNameDateTime << ".txt";

      std::ofstream outResponse; 
      outResponse.open (ResponsePOST.str(), std::ios_base::out | std::ios_base::trunc);
      ss << L"Server returned returned status code " << response.status_code() << std::endl  << res << std::endl;
      std::wstring strResp = ss.str();
      std::string s(strResp.begin(), strResp.end());
      outResponse << s;
      outResponse.close();
....
}
And the log looks like this:
Server returned returned status code 200
HTTP/1.1 200 OK

Cache-Control: no-cache

Content-Length: 7

Content-Type: text/plain; charset=utf-8

Date: Wed, 27 Aug 2014 09:15:53 GMT




and I am expecting to receive this:
Server returned returned status code 200

HTTP/1.1 200 OK

Cache-Control: no-cache

Content-Length: 7

Content-Type: text/plain; charset=utf-8

Date: Wed, 27 Aug 2014 09:15:53 GMT

theBody


What/who is removing the body from the response? Could be a networking issue? (There are only 7 characters in the body)
What do you advise me to do?

Thanks,

Adrian
Coordinator
Sep 3, 2014 at 5:02 PM
Hi Adrian,

In the future I'd recommend creating a new discussion thread as it makes it easier to track and for others to search and understand based on the title.

This is a timing issue, basically it is a race as to whether or not the response body has arrived yet by the time you call http_response::to_string(). The task<http_response> returned from http_client is signaled once the headers have arrived, the response body might not have arrived yet. The to_string API is synchronous and doesn't block on any network I/O, so it will always print the headers but if the response body hasn't arrived yet it won't wait. If you want to make sure the response body has arrived before calling to string you can use the http_response::content_ready() API. It returns a task that is completed once the response body has arrived. Try adding the following right before calling http_response::to_string():
response.content_ready().wait();
Please be aware calling wait() is a blocking call, you also could hook up a task continuation to truly be asychronous. Really the to_string() API is intended mostly for debugging purposes. If you care about performance I wouldn't use it because it actually makes a copy of the response body in order to print it out. I've just updated locally and will check into the 'development' branch some more doc comments on the API so it is clear.

Steve
Sep 9, 2014 at 12:32 PM
Edited Sep 9, 2014 at 12:32 PM
Thanks Steve!

That was the issue. I thought when calling this:
.then([=](http_response response)
I have the whole response available. I could not imagine how can I receive just a piece of the response right before I build the "res" :
utility::string_t res = response.to_string();
Really the to_string() API is intended mostly for debugging purposes.
Yes I do that just for debugging but the app is very unstable and for the moment I cannot quit the logging.
In the future I'd recommend creating a new discussion thread as it makes it easier to track and for others to search and understand based on the title.
I will but the title of the thread seemed to be close to my problem. I made many requests on Windows 7 and on Windows Vista and this issue never happened. I thought it is because of the OS. That's why I posted here.

Thanks again,
Adrian