RESTful service in Uniface | 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
RESTful service in Uniface
10 May 2018
7:50 pm
Avatar
Knut
Member
Forum Posts: 218
Member Since:
01 Oct 2012
sp_UserOfflineSmall Offline

Hi all,

I need to put a REST/json service together – and here’s the problem;
The .NET application is sending a requestheader with application/json and of course
the json string. Sometimes we get 2 fields, sometimes 10. There is no notation
in the JSON as to which table / entity to use – it only contains the field names –
which coincidentally doesn’t match to any of our entity fields.

Upon receiving this in Uniface, $webinfo(“INPUT”) is empty.
Ok, thought of switching to a DSP – nah, webload needs to have the JSON
structure built in the component – ain’t gonna happen. My understanding
(and testing using $webinfo(“DATA”) – nothing happens.

In finishing, if the request is sent as a content-type:text/plain, I do get
text/plain=”{“field1”:1, “field2″:”yes”………}” via $webinfo(“INPUT”) and can
do a jsontostruct and manipulate the json that way

So, do I need to (despite the fact I don’t want to) – define an entity with the
names of the input members as the field names to get this to work?

Is this the only / best way of doing this – or does anyone else have a
better way of doing this when sender insists on using content-type=application/json?

BTW – I’ve tried using a SVC, DSP, USP and a FRM with public operation… on 9.6.08

Knut

11 May 2018
7:10 pm
Avatar
ulrich-merkel
Frankfurt/Germany
Member
Forum Posts: 1807
Member Since:
01 Oct 2012
sp_UserOfflineSmall Offline

Hi Knut,

is the JSON string sent with the request perhaps something like a “named” parameter list?

Perhaps somewhere one can get a documentation of the contracts or expeced processing
which gives a better understanding
to populate a form with all the parameter names as optional fields so you can receive all the different requests?

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

Knut said
In finishing, if the request is sent as a content-type:text/plain, I do get
text/plain=”{“field1”:1, “field2″:”yes”………}” via $webinfo(“INPUT”) and can
do a jsontostruct and manipulate the json that way

So, do I need to (despite the fact I don’t want to) – define an entity with the
names of the input members as the field names to get this to work?

Is this the only / best way of doing this – or does anyone else have a
better way of doing this when sender insists on using content-type=application/json?

BTW – I’ve tried using a SVC, DSP, USP and a FRM with public operation… on 9.6.08

Knut  

Hi Knut,

The WRD only supports the MIME-Type application/json since version 9.7.02. For details see Issue 31157 (Support for MIMEType application/json is missing).

So, when you use version >= 9.7.02 then $webinfo(“INPUT”) will contain data when using content-type=application/json.

Hope this helps.

Daniel

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

Hi Daniel,

Indeed, that explains it!

Thank you.

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