$webinfo("httpresponseheaders") | Uniface 9 | Forum

Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

—  Results per page  —








— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters
For a group of consecutive words like 'end of support' use Match phrase

sp_Feed Topic RSS sp_TopicIcon
$webinfo("httpresponseheaders")
08 May 2018
8:43 pm
Avatar
Knut
Member
Forum Posts: 224
Member Since:
01 Oct 2012
sp_UserOfflineSmall Offline

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

09 May 2018
8:38 am
Avatar
ulrich-merkel
Frankfurt/Germany
Member
Forum Posts: 1868
Member Since:
01 Oct 2012
sp_UserOfflineSmall Offline

Hi Knut,

perhaps it’s just a typo as “accept:application/json”
should be a key-value pair written as “accept=application/json”?

09 May 2018
5:34 pm
Avatar
Knut
Member
Forum Posts: 224
Member Since:
01 Oct 2012
sp_UserOfflineSmall Offline

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

10 May 2018
9:08 am
Avatar
ulrich-merkel
Frankfurt/Germany
Member
Forum Posts: 1868
Member Since:
01 Oct 2012
sp_UserOfflineSmall Offline

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

10 May 2018
7:17 pm
Avatar
Knut
Member
Forum Posts: 224
Member Since:
01 Oct 2012
sp_UserOfflineSmall Offline

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

14 May 2018
12:16 pm
Avatar
diseli
Admin
Forum Posts: 1024
Member Since:
01 Oct 2012
sp_UserOfflineSmall Offline

Hi Knut,

I guess this is related to your other post (RESTful service in Uniface)?

Thanks,

Daniel

14 May 2018
12:53 pm
Avatar
Knut
Member
Forum Posts: 224
Member Since:
01 Oct 2012
sp_UserOfflineSmall Offline

Hi Daniel,

It would appear that would be the case….

Time to get on with the upgrade!

Regards,
Knut

Forum Timezone: Europe/Amsterdam

Most Users Ever Online: 131

Currently Online:
38 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

ulrich-merkel: 1868

Iain Sharp: 674

Theo Neeskens: 366

gianni: 341

Adrian Gosbell: 318

istiller: 295

rogerw: 270

Knut: 224

lalitpct: 197

Arjen van Vliet: 184

Member Stats:

Guest Posters: 3

Members: 10299

Moderators: 0

Admins: 6

Forum Stats:

Groups: 1

Forums: 62

Topics: 2290

Posts: 9937

Newest Members:

Ridgesn, SaphbamE, NanarrjLews, bruceus18, LesleyCag, rebeccavy1, jackieps69, GalenIcew, Gessonv, Tommycoado

Administrators: admin: 23, diseli: 1024, Nico Peereboom: 84, richiet: 406, Mike Taylor: 35, JanCees: 38