$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: 218
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: 1807
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: 218
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: 1807
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: 218
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: 1001
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: 218
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:
22 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

ulrich-merkel: 1807

Iain Sharp: 659

Theo Neeskens: 362

gianni: 318

istiller: 275

rogerw: 266

Knut: 218

lalitpct: 197

Arjen van Vliet: 180

sochaz: 173

Member Stats:

Guest Posters: 3

Members: 9263

Moderators: 0

Admins: 8

Forum Stats:

Groups: 1

Forums: 62

Topics: 2246

Posts: 9701

Newest Members:

Michaelsen, Gotovimprofile, Jamesveift, jeannetteww2, vixabest, Anthonycox, Thomasfak, tammigq11, CallProfile, BrianAmouh

Administrators: admin: 23, Adrian Gosbell: 318, diseli: 1001, Bob Maier: 3, Nico Peereboom: 77, Michael Rabone: 4, richiet: 406, JanCees: 34