1. Mark Lundell
  2. PowerServer 2020 or older (Obsolete)
  3. Monday, 27 April 2020 19:12 PM UTC

Is there a workable or recommended way to pass a byte[24] array to and from a DotNet component from a Power Server application?

Thanks.

Accepted Answer
Marco Meoni Accepted Answer Pending Moderation
  1. Tuesday, 28 April 2020 08:00 AM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # Permalink

Hi Mark,

in order to call .NET component from PowerServer you must

1) copy the .NET DLL (and its dependencies under) C:\inetpub\wwwroot\appeon\AEM\components

2) Use AppeonDotNetComponent object to call the .NET functions

Unfortunately non-primitive type parameters such as arrays are unsupported in AppeonDotNetComponent, so you must:

1) change the signature of the .NET function, e.g. change the array argument into a string and use Base64 for encoding/decoding the byte array

2) use a REST API as a "man-in-the-middle", call it via PowerServer RESTClient/HTTPclient objects, and have the REST API that calls, in turn, the original .NET DLL.

Best,

.m

Comment
  1. Mark Lundell
  2. Tuesday, 28 April 2020 21:34 PM UTC
Two more items. My other ref arguments (long and int) are also not being returned to PB, and I am receiving a -1 return code from the of_execinterface function - but no value in the ErrorText from the appeondotnetcomponent. The c# dll is working as designed, except the ref values. The C# is built under .net Framework 4.6.1
  1. Helpful
  1. Marco Meoni
  2. Thursday, 30 April 2020 06:45 AM UTC
Hello,

I remember a similar problem with .NET SOAP WS.

Can you make a test by using the return value to send out the result instead of arguments by reference?

Best,

.m
  1. Helpful
  1. Mark Lundell
  2. Friday, 8 May 2020 18:00 PM UTC
I finally determined the issue. My C# function is called with a set of 11 parameters. Several of the parameters were defined in C# and Power Builder as Int. All the parameters sent data to C# correctly. However, the ref parameters did not return data to PB. In fact the string ref parameters which were after the Int parameters also did not return data despite that fact that they were define correctly. I finally searched the documentation and found that I needed to define the int parameters as long in PB. Once I made that change the calls worked as desired. It would have saved me much time and frustration if the PowerServer documentation for the AppeonDotNetComponent had noted how the data types must be defined in PB and C#.
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Monday, 27 April 2020 19:19 PM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # 1

We recommend to call .NET code on the server through a REST API interface and using the new REST Client object.  https://docs.appeon.com/appeon_online_help/ps2020/features_help_for_appeon_web/Supported_Objects_for_web.html#RestClient

Comment
  1. Mark Lundell
  2. Wednesday, 29 April 2020 14:41 PM UTC
This does not answer the question. Does the AppeonDotNetComponent work or not? The documentation says that it does. I can pass parameters to my assembly, the assembly does its work correctly (because I log everything), but the ref parameters do not return values to the calling PB application.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.