Data object, Webspeed webhandler: Dataset as output paramete

Posted by fvanleeu on 19-Apr-2017 05:12

When switching to the Webspeed webhandler Data object, we noticed that datasets are now written as Base64 in the response of an Invoke operation (Normal read operations are not affected). When using the same business entity in a REST RPC Data object service the dataset is written as normal JSON. 

Below an example of the respsonse body: 

{"response":{"dsFred":"eyJkc0ZyZWQiOnt9fQ=="}}

Anyone knows if this is by design or that this concerns a bug? 

Openedge 11.6, Service pack 3

Posted by egarcia on 19-Apr-2017 05:43

Hello,

The issue that you mentioned seems to be bug report PSC00352502.

This issue has been fixed in 11.7.

I would suggest to contact Technical Support should you need a hotfix for 11.6.3.

Are you using the JSDO on the client?

A possible workaround could be to add code to the handling of invoke operations in the JSDO to call decode the parameter on certain conditions.

I hope this helps.

Thank you and regards.

Posted by Peter Judge on 20-Apr-2017 09:57

There's another workaround you can add on the server. The DataObjectHandler (DOH) has callbacks that let you manipulate the response before it's sent back to the caller.

In this you can base64-decode the dataset data.

I'm attaching (I hope) 2 programs.

1) DOHEventHandler.cls . This contains the callback and some sample code that turns the base64-encoded string into a real dataset. It has no error handling and dumps a before and after file - you should probably clean this stuff up if you want to use it in any serious form.

2) session_start.p : this starts the event handler in the sessions You should use this code for your session startups (configured in openedge.properties)

[AppServer.Agent.hf_1163]
    sessionStartupProc=session_start.p

or if you already have a startup proc, simply call

new DOHEventHandler().

in your code.

[View:/cfs-file/__key/communityserver-discussions-components-files/19/session_5F00_start.p:320:240][View:/cfs-file/__key/communityserver-discussions-components-files/19/DOHEventHandler.cls:320:240]

All Replies

Posted by Mike Fechner on 19-Apr-2017 05:30

Which OpenEdge Release?

This pretty much looks wrong! I guess the client side does not understand this data - does it?

Sent from Nine

Von: fvanleeu <bounce-fvanleeu@community.progress.com>
Gesendet: 19.04.2017 12:13 nachm.
An: TU.OE.Development@community.progress.com
Betreff: [Technical Users - OE Development] Data object, Webspeed webhandler: Dataset as output parameter is written as Base64 in JSDO Invoke

Update from Progress Community
fvanleeu

When switching to the Webspeed webhandler Data object, we noticed that datasets are now written as Base64 in the response. When using the same business entity in a REST RPC Data object service the dataset is written as normal JSON. 

Below an example of the respsonse body: 

{"response":{"dsFred":"eyJkc0ZyZWQiOnt9fQ=="}}

Anyone knows if this is by design or that this concerns a bug? 

View online

 

You received this notification because you subscribed to the forum.  To stop receiving updates from only this thread, go here.

Flag this post as spam/abuse.

Posted by fvanleeu on 19-Apr-2017 05:40

The Openedge version is 11.6, Service pack 3

I should be able to decode the Base64 string in the method handling the response, but that would be an unwanted workaround.

Posted by egarcia on 19-Apr-2017 05:43

Hello,

The issue that you mentioned seems to be bug report PSC00352502.

This issue has been fixed in 11.7.

I would suggest to contact Technical Support should you need a hotfix for 11.6.3.

Are you using the JSDO on the client?

A possible workaround could be to add code to the handling of invoke operations in the JSDO to call decode the parameter on certain conditions.

I hope this helps.

Thank you and regards.

Posted by fvanleeu on 19-Apr-2017 06:09

Thanks Edsel,

I was not able to find anything about that bug report number, but good to know it is fixed, and i will reference that when contacting support for a Hotfix.

We are indeed using the JSDO on the client. decoding the property should be doable as a temporary workaround.

Regards,

Fred van Leeuwen

Posted by Peter Judge on 20-Apr-2017 09:57

There's another workaround you can add on the server. The DataObjectHandler (DOH) has callbacks that let you manipulate the response before it's sent back to the caller.

In this you can base64-decode the dataset data.

I'm attaching (I hope) 2 programs.

1) DOHEventHandler.cls . This contains the callback and some sample code that turns the base64-encoded string into a real dataset. It has no error handling and dumps a before and after file - you should probably clean this stuff up if you want to use it in any serious form.

2) session_start.p : this starts the event handler in the sessions You should use this code for your session startups (configured in openedge.properties)

[AppServer.Agent.hf_1163]
    sessionStartupProc=session_start.p

or if you already have a startup proc, simply call

new DOHEventHandler().

in your code.

[View:/cfs-file/__key/communityserver-discussions-components-files/19/session_5F00_start.p:320:240][View:/cfs-file/__key/communityserver-discussions-components-files/19/DOHEventHandler.cls:320:240]

Posted by fvanleeu on 02-May-2017 10:00

Thanks for the information and examples Peter,

Good to know about these callbacks.

This thread is closed