Data from a web service call has different encoding with dif

Posted by Mark Davies on 01-Jun-2019 12:40

Hi,

I am trying to figure out if there is some sort of reason why a call to a web service in OE10.2B will have a different result than OE11.3.

My situation is as follows.. I have to make a web service call (REST) and for ease of use I have opted to use the MS WebClient library. In my development environment I am running on OE11.6 - all fine and result is as expected. My client's application is running OE10.2B as there is no quick way to upgrade their application version at this time - hence the reason for using something other than the OE libraries to make the call. 

The call is simple and works in both versions of OE, but when I get the response from the call in OE10.2B it seems to be in a different encoding. However, running the exact same code in OE11.3 it is in UTF8, as expected. This is a sample of the call:

DEFINE VARIABLE oWebClient AS WebClient NO-UNDO.
DEFINE VARIABLE cResponse AS LONGCHAR NO-UNDO.
DEFINE VARIABLE oData AS "System.Byte[]" NO-UNDO.

oWebClient = NEW WebClient().

oWebClient:Headers:Add("Content-Type","application/x-www-form-urlencoded").
oWebClient:QueryString:Add("Param1", "Value1").
oWebClient:QueryString:Add("Param2", "Value2").

ASSIGN

oData = oWebClient:UploadValues("requestUrl","POST",oWebClient:QueryString).

cResponse = UnicodeEncoding:UTF8:GetString(oData).

COPY-LOB FROM OBJECT cResponse TO FILE "D:\temp\test.json".

Why would OE10.2B cause the result to be different? I checked the cpinternal for both versions and they are set the same.

All Replies

Posted by ChUIMonster on 01-Jun-2019 12:59
Posted by Mark Davies on 01-Jun-2019 14:12

Hi Tom,

Okay - that is a workaround - but a working one ;-) . I'll use that. Thanks

Posted by goo on 01-Jun-2019 14:22

Nice to know :-)

Sendt fra min iPad

1. jun. 2019 kl. 15:01 skrev ChUIMonster <bounce-ChUIMonster@community.progress.com>:

<ProgressEmailLogo-png_2D00_150x42x2-png> Update from Progress Community
<4TQ25RAP8G6W-png_2D00_70x70x2-png>
ChUIMonster

Perhaps something like this knowledgebase.progress.com/.../LONGCHARpopulatedfromNETmethodincorrectlysettoUTF16

View online

 

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

Flag this post as spam/abuse.

This thread is closed