REST Procedure not working - Forum - OpenEdge General - Progress Community

REST Procedure not working

 Forum

REST Procedure not working

This question is answered

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
Verified Answer
  • 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
  • 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
     
  • Hello ,

    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

  • 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
     
  • 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