.Net classes are giving run time error.

Posted by Sivarami Reddy Marella on 31-Jul-2018 02:03

Hi,

I am able to compile the below code successfully, when I am calling this program I am getting the below run time error.

Could not access element 'GetHash' of class 'OpenEdge.Core.ByteBucket' using object of type 'OpenEdge.Core.ByteBucket' - caller compilation is out of sync with class compilation. (12882)

USING Progress.Lang.Object.

USING OpenEdge.Core.WidgetHandle.
USING OpenEdge.Core.String.
USING Progress.Json.ObjectModel.*.
USING OpenEdge.Net.HTTP.IHttpRequest.
USING OpenEdge.Net.HTTP.RequestBuilder.
USING OpenEdge.Net.HTTP.IHttpClientLibrary.
USING OpenEdge.Net.HTTP.lib.ClientLibraryBuilder.
USING OpenEdge.Net.HTTP.IHttpResponse.
USING OpenEdge.Net.HTTP.ClientBuilder.
USING OpenEdge.Net.HTTP.ResponseBuilder.

IF (ipc_Action = "Create") THEN
DO:
PUT "CREATE - POST" SKIP.
PUT "gc_URL:" SKIP.
PUT gc_URL FORMAT "x(1000)" SKIP.
http_Request = RequestBuilder:POST( gc_URL, obj_Json )
:ContentType('application/json')
:AcceptJson()
:Request
NO-ERROR.
END.

/* PUT (Update) to CRM */
IF (ipc_Action = "Update") THEN
DO:
PUT "UPDATE - PUT" SKIP.
PUT "gc_URL:" SKIP.
PUT gc_URL FORMAT "x(1000)" SKIP.
http_Request = RequestBuilder:PUT( gc_URL, obj_Json )
:ContentType('application/json')
:AcceptJson()
:Request
NO-ERROR.
END.


ASSIGN
http_Lib = ClientLibraryBuilder:Build():sslVerifyHost(NO):library
http_Client = ClientBuilder:Build():UsingLibrary(http_Lib):Client
http_Response = ResponseBuilder:Build():Response
.

http_Client:Execute(http_Request, http_Response) /* NO-ERROR */.

I am getting the error while running this line - http_Client:Execute(http_Request, http_Response) /* NO-ERROR */.

Thanks,

Sivarami Reddy

All Replies

Posted by Sivarami Reddy Marella on 31-Jul-2018 02:04

Openedge version is 11.5.1

Posted by Mike Fechner on 31-Jul-2018 02:25
You subject suggests .NET classes. However, I cannot see any reference to .NET in your sample code.
 
Did you post the wrong code sample?
 
Posted by Sivarami Reddy Marella on 31-Jul-2018 04:31

Hi Mike,

for the below USING lines,  I am compiling the program adding this pl - OpenEdge.Net.pl, so i have mentioned as .Net classes.

USING Progress.Lang.Object.

USING OpenEdge.Core.WidgetHandle.

USING OpenEdge.Core.String.

USING Progress.Json.ObjectModel.*.

USING OpenEdge.Net.HTTP.IHttpRequest.

USING OpenEdge.Net.HTTP.RequestBuilder.

USING OpenEdge.Net.HTTP.IHttpClientLibrary.

USING OpenEdge.Net.HTTP.lib.ClientLibraryBuilder.

USING OpenEdge.Net.HTTP.IHttpResponse.

USING OpenEdge.Net.HTTP.ClientBuilder.

USING OpenEdge.Net.HTTP.ResponseBuilder.

Posted by Mike Fechner on 31-Jul-2018 05:08
OK – OpenEdge.Net …. That’s different from the .NET Framework (Microsoft) …
 
Have you verified that the version of the OpenEdge.Net.pl and OpenEdge.core.pl you compile against is the same that’s used when executing the program?
 
Posted by Sivarami Reddy Marella on 31-Jul-2018 05:16

Hi Mike,

I am not using the OpenEdge.core.pl, Do I need to add this to my propath?

Thanks,

Sivarami Reddy M

Posted by Mike Fechner on 31-Jul-2018 05:20
I’d guess so
Posted by Sivarami Reddy Marella on 31-Jul-2018 05:32

Hi Mike,

I found the pl in three places and I have added gui and src pl , but there is no luck.

Path is - c:\Progress\OpenEdge11\gui\OpenEdge.Core.pl,c:\Progress\OpenEdge11\gui\OpenEdge.ServerAdmin.pl,c:\Progress\OpenEdge11,c:\Progress\OpenEdge11\bin,C:\Progress\OpenEdge11\tty\netlib\OpenEdge.Net.pl,C:\Progress\OpenEdge11\gui\netlib\OpenEdge.Net.pl,C:\Progress\OpenEdge11\src\OpenEdge.Core.pl.

Thanks,

Sivarami Reddy M

Posted by Simon L. Prinsloo on 31-Jul-2018 05:46

You need the one in C:\Progress\OpenEdge11\gui, because that is where you pick up the other one.

Posted by Sivarami Reddy Marella on 31-Jul-2018 05:54

Hi Simon,

I have checked that also, there is no luck. Hope sequence of propath is fine.

c:\Progress\OpenEdge11\gui\OpenEdge.Core.pl,c:\Progress\OpenEdge11\gui\OpenEdge.ServerAdmin.pl,c:\Progress\OpenEdge11,c:\Progress\OpenEdge11\bin,C:\Progress\OpenEdge11\tty\netlib\OpenEdge.Net.pl,C:\Progress\OpenEdge11\gui\netlib\OpenEdge.Net.pl,

Thanks,

Sivarami Reddy

Posted by Mike Fechner on 31-Jul-2018 05:58
You have two versions of OpenEdge.Net.pl in the propath – from GUI and TTY.
 
C:\Progress\OpenEdge11\tty\netlib\OpenEdge.Net.pl,C:\Progress\OpenEdge11\gui\netlib\OpenEdge.Net.pl,
 
I’d consistently go with one. GUI in this case. As that’s where you’re referencing the OpenEdge.Core.pl from.
 
Posted by Sivarami Reddy Marella on 31-Jul-2018 05:59

When I compiled it's compiles successfully and When I am trying to execute from DB write trigger I have this issue.

Thanks,

Sivarami Reddy

Posted by Mike Fechner on 31-Jul-2018 06:06
Not that this is related to your issue …
 
But DB Write triggers should be used for basic validation. Should be used for referential integrity, etc ….
 
Not for doing a REST call to another system. That sounds at least like a questionable design.
Posted by Sivarami Reddy Marella on 31-Jul-2018 06:10

This is not a rest service, I have over written the environment propath through program and then I am calling this program. The below is the path - C:\Progress\OpenEdge11\gui,C:\Progress\OpenEdge11\gui\adecomm.pl,C:\Progress\OpenEdge11\gui\adecomp.pl,C:\Progress\OpenEdge11\gui\adedesk.pl,C:\Progress\OpenEdge11\gui\adedict.pl,C:\Progress\OpenEdge11\gui\adeedit.pl,C:\Progress\OpenEdge11\gui\adeicon.pl,C:\Progress\OpenEdge11\gui\aderes.pl,C:\Progress\OpenEdge11\gui\adeshar.pl,C:\Progress\OpenEdge11\gui\adeuib.pl,C:\Progress\OpenEdge11\gui\adeweb.pl,C:\Progress\OpenEdge11\gui\adexml.pl,C:\Progress\OpenEdge11\gui\prodict.pl,C:\Progress\OpenEdge11\gui\protools.pl,C:\Progress\OpenEdge11\,C:\Progress\OpenEdge11\\bin,c:\Progress\OpenEdge11\gui\ablunit.pl,c:\Progress\OpenEdge11\gui\dataadmin.pl,c:\Progress\OpenEdge11\gui\OpenEdge.BusinessLogic.pl,c:\Progress\OpenEdge11\gui\OpenEdge.ServerAdmin.pl,c:\Progress\OpenEdge11,c:\Progress\OpenEdge11\bin,C:\Progress\OpenEdge11\gui\OpenEdge.Core.pl,C:\Progress\OpenEdge11\gui\netlib\OpenEdge.Net.pl

Thanks,

Sivarami Reddy M

Posted by Sivarami Reddy Marella on 31-Jul-2018 06:33

We have another program same like this  it is running, now I have added some libraries and I have changed the building response part to below with USING componenets.

  IF (ipc_Action = "Create") THEN

   DO:

       http_Request = RequestBuilder:POST( gc_URL, obj_Json )

                      :ContentType('application/json')

                      :AcceptJson()

                      :Request

                       NO-ERROR.

   END.

   IF (ipc_Action = "Update") THEN

   DO:

       http_Request = RequestBuilder:PUT( gc_URL, obj_Json )

                      :ContentType('application/json')

                      :AcceptJson()

                      :Request

                       NO-ERROR.

   END.

ASSIGN

       http_Lib      = ClientLibraryBuilder:Build():sslVerifyHost(NO):library

       http_Client   = ClientBuilder:Build():UsingLibrary(http_Lib):Client

       http_Response = ResponseBuilder:Build():Response

       .

http_Client:Execute(http_Request, http_Response) /* NO-ERROR */.

Earlier Code

IF create-update = "Create" THEN                        

  oRequest = RequestBuilder:POST("http://" + vcHost + ":" + vcPort + "/crmcreatecontact", oJson)

                           :ContentType('application/json')

                           :AcceptJson()

                           :Request NO-ERROR.

ELSE

  oRequest = RequestBuilder:PUT("http://" + vcHost + ":" + vcPort + "/crmupdatecontact/" + STRING(tdid), oJson)

                           :ContentType('application/json')

                           :AddHeader("Accept","application/json;odata=verbose")

                           :AcceptJson()

                           :Request NO-ERROR.

oResponse = ClientBuilder:Build():Client:Execute(oRequest) NO-ERROR.

Thanks,

Sivarami Reddy M

Posted by Sivarami Reddy Marella on 03-Aug-2018 03:04

I got the answer we need to add both the CHUI and GUI .pl to propath.

This thread is closed