BusinessEntity - Response w/error missing prods:clientId fi

Posted by jts-law on 07-Aug-2017 13:40

Hello all,

I'm working on a KUIB 2 app with an OE 11.6.3 rest service.  On the backend I have a custom class for CRUD as well as a few standard BusinessEntity classes.  The issue I'm having is the KUIB app is not displaying the prods:error message when an error occurs editing records.  I get the "Error while saving changes." message but not the detailed error value from the prods:error field.  The custom class works correctly and displays both.

In comparing the JSON in the request and response from/to the KUIB app, I noticed that the response from the BE does not include the prods:clientId field in the response.  Is there something special that needs to be done to force a standard generated BE to include prods:clientId in the response?

The following are the JSON request sent from the KUIB app and the response returned for the WORKING module.  The error displayed has "Error while saving changes." on the left of the small window, and "Unable to create, parameter already exists: Branch, 1" on the right side of the small window.

Request:
{"dsLookup" : { "prods:hasChanges" : true, "ttLookup" : [{ "prods:clientId" : "1502125404075-1056", "prods:rowState" : "created", "key_type" : "Int", "key_id" : "Bank.Branch", "key_value" : "1", "description" : "test", "group_description" : "", "group2_description" : "", "group3_description" : "" } ] } } Response (includes prods:clientId in data record):
{"dsLookup": { "prods:hasChanges": true, "ttLookup": [ { "prods:id": "ttLookup55552", "prods:rowState": "created", "prods:hasErrors": true, "prods:clientId": "1502125404075-1056", "key_type": "Int", "key_id": "Bank.Branch", "key_value": "1", "description": "test", "group_description": "", "group2_description": "", "group3_description": "" } ], "prods:before": { }, "prods:errors": { "ttLookup": [ { "prods:id": "ttLookup55552", "prods:error": "Unable to create, parameter already exists: Branch, 1" } ] } }}

The following are for the NOT WORKING module.  The error displayed has "Error while saving changes." in the small window and no other text.  I expect it to have "** glgroup already exists with Group 10 Account 1234567890. (132)" as well.

Request:
{"dsglgroup" : { "prods:hasChanges" : true, "ttglgroup" : [{ "prods:clientId" : "1502126481448-15", "prods:rowState" : "created", "id" : "", "seq" : 0, "gla_group" : 10, "account" : 1234567890 } ] } } Response (no prods:clientId in data record):
{"dsglgroup": { "prods:hasChanges": true, "ttglgroup": [ { "prods:id": "ttglgroup39169", "prods:rowState": "created", "prods:hasErrors": true, "id": "", "seq": 0, "gla_group": 10, "account": 1234567890 } ], "prods:before": { }, "prods:errors": { "ttglgroup": [ { "prods:id": "ttglgroup39169", "prods:error": "** glgroup already exists with Group 10 Account 1234567890. (132)" } ] } }}

Louis

Posted by maura on 08-Aug-2017 08:57

Hi Louis,

Your call to DataSet WRITE-JSON() is correctly setting the write-before-image param to true, and it is returning before-image data, (just not the clientId).

You should enter a bug so we can look into further..

Maura

All Replies

Posted by maura on 07-Aug-2017 14:48

I am unable to reproduce this issue with an 11.7 BE, either CUD or CUD+ Submit.

Could you log a bug so we can look into with an 11.6.3 BE

Thanks

Maura

Posted by jts-law on 07-Aug-2017 15:59

Maura,

Since I'm using a WebHandler I thought I'd run through another quick test using a standard ABL Rest service to try to duplicate my issue before opening a case.  What I found is that the ABL Rest service did return the prods:clientId correctly.  Any thoughts on what I might need to add to my WebHandler in order to return this field?

The following is the overview of how my WebHandler works for this object:

CONSTRUCTOR PUBLIC myWebHandler (  ):
   ...
   oGLGroupBE   = NEW GLGroupBE().
END CONSTRUCTOR.

METHOD OVERRIDE PROTECTED INTEGER HandlePut( INPUT poRequest AS OpenEdge.Web.IWebRequest ):
   DEF VAR oResponse    AS OpenEdge.Net.HTTP.IHttpResponse             NO-UNDO.

   oResponse            = NEW OpenEdge.Web.WebResponse().
   oResponse:StatusCode = INTEGER(StatusCodeEnum:OK).

   IF poRequest:PathInfo BEGINS "/GLGroup"
   THEN
      GLGroupPut(poRequest, INPUT-OUTPUT oResponse, OUTPUT lcBody).
   ELSE IF...

   oResponse:ContentLength = LENGTH(lcBody).
   oWriter = NEW WebResponseWriter(oResponse).
   oWriter:Open().
   oWriter:Write(lcBody).
   oWriter:Close().

   RETURN 0.

END METHOD.

METHOD PROTECTED VOID GLGroupPut( INPUT poRequest AS OpenEdge.Web.IWebRequest,
                                  INPUT-OUTPUT poResponse AS OpenEdge.Net.HTTP.IHttpResponse,
                                  OUTPUT plcBody AS LONGCHAR ):
   DATASET dsGLGroup:READ-JSON("JsonObject", poRequest:Entity, "EMPTY").
   oGLGroupBE:SubmitGLGroupBE(INPUT-OUTPUT DATASET dsGLGroup).                    
   DATASET dsGLGroup:WRITE-JSON ("LONGCHAR", plcBody, TRUE, ?, FALSE, FALSE, TRUE).
   poResponse:ContentType = "application/json".
END METHOD.

Thanks,
Louis

Posted by maura on 08-Aug-2017 08:57

Hi Louis,

Your call to DataSet WRITE-JSON() is correctly setting the write-before-image param to true, and it is returning before-image data, (just not the clientId).

You should enter a bug so we can look into further..

Maura

Posted by jts-law on 08-Aug-2017 09:20

Maura,

Okay thanks.  I've opened case 00412011 for this issue.

Louis

Posted by jts-law on 11-Aug-2017 16:00

Maura,

Just wanted to let you know that I've been working support and they now have a working test project to see this issue.

Louis

Posted by maura on 14-Aug-2017 14:12

Great. Thanks

Maura

This thread is closed