REST Procedure not working

Posted by danimasa on 25-Apr-2018 14:08

Hello

I'm trying to add a endpoint to my REST Service, so I wrote a procedure and published it but, when I try to define an output parameter I'm getting an error.

That is the code that works:

PROCEDURE parametros:
    DEFINE INPUT  PARAMETER charinput AS CHARACTER   NO-UNDO.
END PROCEDURE.


If I try to add an output parameter like this:

PROCEDURE parametros:
    DEFINE INPUT  PARAMETER charinput AS CHARACTER   NO-UNDO.
    DEFINE OUTPUT PARAMETER teste AS CHARACTER NO-UNDO.
    ASSIGN teste = "Teste".
END PROCEDURE.


I get the following error from the server:

{
    "messages": [
        {
            "code": "",
            "type": "error",
            "detail": "ParameterSet error: Tried to get output before it is ready. (7194)"
        }
    ],
    "length": null,
    "data": null
}

Someone could help me get out of that?

Thanks

Posted by danimasa on 01-May-2018 07:15

Hi Sanjeev

I found the solution, I have a page in my environment to register the compiled r file (that create a endpoint to the application), but besides that I have to deploy the r file to the workdir of the server (something I didn't do). So when I deploy the file to the correct workdir of the server it begins to work.

Thank you for your help

Posted by danimasa on 01-May-2018 07:20

Hi Sanjeev

I found the solution, my environment works in a JBOSS server and use a page to register the compiled r file to create the endpoint URL, but besides that I have to deploy the compiled file to the workdir of the PAS OE. So when I do that the REST request begins to work.

Thank you for your help

All Replies

Posted by Sanjeva Manchala on 26-Apr-2018 02:24

Hi Daniel,
 
I tried with the sample code you have shared. I’m not seeing any issues when accessing the service. Here is the code snippet with REST annotations:
 
@openapi.openedge.export FILE(type="REST", executionMode="single-run", useReturnValue="false", writeDataSetBeforeImage="false").
@openapi.openedge.export(type="REST", useReturnValue="false", writeDataSetBeforeImage="false").
PROCEDURE parametros:
    DEFINE INPUT  PARAMETER charinput AS CHARACTER   NO-UNDO.
    DEFINE OUTPUT PARAMETER teste AS CHARACTER NO-UNDO.
    ASSIGN teste = "Teste".
END PROCEDURE.
 
Here is the screenshot of my REST mapping editor.
 
Please check your mapping details and retry once. You can also share your mapping details, so that we can take a look and tell what the problem is.
 
Thanks,
Sanjeev
 

Posted by danimasa on 30-Apr-2018 11:35

Hello [mention:4e8c5302fe7047ac8ce319276d3cca30:e9ed411860ed4f2ba0265705b8793d05],

I tested the code using Eclipse REST Service like you did and it worked fine. But when I compile and publish to my environment it didn't work and gives me the error I posted earlier.

Looking at the server log, the following command raises the error:

com.progress.open4gl.Open4GLException: ParameterSet error: Tried to get output before it is ready. (7194)

at com.progress.open4gl.dynamicapi.ParameterSet.getOutputParameter(ParameterSet.java:436)

What could be wrong in my environment?

Thanks

Posted by Sanjeva Manchala on 30-Apr-2018 22:26

Hello Dan,
 
Regarding your comment, I have some questions. Can you please answer the following:
>> But when I compile and publish to my environment it didn't work and gives me the error I posted earlier.
 
  • How you are publishing to your environment? Is it by exporting the service from PDS OE (eclipse) or some other way?
  • To which server are you publishing? Rest manager or PAS OE?
 
Thanks,
Sanjeev
 

Posted by danimasa on 01-May-2018 07:15

Hi Sanjeev

I found the solution, I have a page in my environment to register the compiled r file (that create a endpoint to the application), but besides that I have to deploy the r file to the workdir of the server (something I didn't do). So when I deploy the file to the correct workdir of the server it begins to work.

Thank you for your help

Posted by danimasa on 01-May-2018 07:20

Hi Sanjeev

I found the solution, my environment works in a JBOSS server and use a page to register the compiled r file to create the endpoint URL, but besides that I have to deploy the compiled file to the workdir of the PAS OE. So when I do that the REST request begins to work.

Thank you for your help

This thread is closed