$webinfo("httpresponseheaders")

Author: knut.dybendahl@gmail.com (Knut)

So, I've been fighting the proc manual for quite some time.... Got a Uniface component being called by a .NET application so they want the content-type set to application/json on the way back. Simple I thought... Manual states $webinfo("HTTPRESPONSEHEADERS") = "content-type=application/json GOLD ; accept:application/json" Negative - content-type remains "text/html" and accept is nowhere to be seen. Now try: putitem/id $webinfo("HTTPRESPONSEHEADERS"), "Accept", "application/json" Hey presto, "accept:application/json" appears. Let's add putitem/id $webinfo("HTTPRESPONSEHEADERS"), "content-type", "application/json" Frown - the returned json (from $webinfo("OUTPUT") gets corrupted, but "content-type:application/json" appears in the header... Has anyone seen this before? If so, how did you get around it? Knut

6 Comments

  1. Hi Knut, perhaps it's just a typo as "accept:application/json" should be a key-value pair written as "accept=application/json"?


    Author: ulrich-merkel (ulrichmerkel@web.de)
  2. Hi Knut, Think your line doesn't specify the accept datatype what about: $webinfo(“HTTPRESPONSEHEADERS”) = “content-type=application/json GOLD ; accept=application/json” instead of the: ;$webinfo(“HTTPRESPONSEHEADERS”) = “content-type=application/json GOLD ; accept:application/json” As the helpfile reads:

    It contains an associative list of request parameters present in the request URL: ParameterName1 = Value1 GOLD; ParameterName2 = Value2...


    Author: ulrich-merkel (ulrichmerkel@web.de)
  3. Hi Uli, Negative, no matter which way I specify it I get the buffer overrun. Never mind, I've convinced the .NET developer to parse it separately as there are only 3 items in the JSON. Knut


    Author: Knut (knut.dybendahl@gmail.com)
  4. Negative... This line : $webinfo("HTTPRESPONSEHEADERS") = "content-type=application/json" causes the 1st two characters of $webinfo("OUTPUT") to be overwritten. Instead of {" there some sort of control character... ASCII value of 1.... Knut


    Author: Knut (knut.dybendahl@gmail.com)
  5. Hi Knut, I guess this is related to your other post (RESTful service in Uniface)? Thanks, Daniel


    Author: diseli (daniel.iseli@uniface.com)
  6. Hi Daniel, It would appear that would be the case.... Time to get on with the upgrade! Regards, Knut


    Author: Knut (knut.dybendahl@gmail.com)