REST
 

REST

13 posts, 1 answered
  1. Roger Blanchard
    Roger Blanchard avatar
    402 posts
    Registered:
    29 Jun 2018
    12 Jun
    Link to this post
    We have a method in our BE that is called via REST. The following will work just fine and returns the dataset. 

    @RestMethod (address="/ESLItem/~{UpcNum}/~{PackNum}/GetUpc", requestMethod="get", parameterClassName="Osprey.Pos.Item.ItemParameterWeb", response="dsItem:eItem").
    METHOD PUBLIC VOID GetUpc ( INPUT-OUTPUT DATASET dsItem, 
                                poItemParameter AS Osprey.Pos.Item.ItemParameterWeb  
                                ):

    However,

    If we use the response="dsItem:eItem" we get an empty response. 

    @RestMethod (address="/ESLItem/~{UpcNum}/~{PackNum}/GetUpc", requestMethod="get", parameterClassName="Osprey.Pos.Item.ItemParameterWeb", response="dsItem:eItem").
    METHOD PUBLIC VOID GetUpc ( INPUT-OUTPUT DATASET dsItem, 
                                poItemParameter AS Osprey.Pos.Item.ItemParameterWeb  
                                ):

    I even tried the "dsItem:no-envelope" and it also returns an empty response.


  2. Peter Judge
    Peter Judge avatar
    13 posts
    Registered:
    11 Aug 2022
    12 Jun in reply to Roger Blanchard
    Link to this post
    HI Roger,

    Just checking on the first example: I assume you mean response="dsItem" works (there's :eItem in the example).
  3. Roger Blanchard
    Roger Blanchard avatar
    402 posts
    Registered:
    29 Jun 2018
    12 Jun in reply to Peter Judge
    Link to this post
    Yes, sorry typo. 

    response="dsItem" works and response="dsItem:eItem" does not work. It just returns an empty result with no errors logged in PASOE. 
  4. Roger Blanchard
    Roger Blanchard avatar
    402 posts
    Registered:
    29 Jun 2018
    12 Jun in reply to Peter Judge
    Link to this post
    If I use "dsItem:no-envelope" it also returns an empty result. 

    If I use response="poItemParameter,dsItem:eItem" I will see the parameter object being returned. 
  5. Peter Judge
    Peter Judge avatar
    13 posts
    Registered:
    11 Aug 2022
    12 Jun in reply to Roger Blanchard
    Link to this post
    > If I use response="poItemParameter,dsItem:eItem" I will see the parameter object being returned.

    In this case the :eItem is (should be) ignored and you should see a "parameter" and a "dsItem" property in the response.

    What do you see in the Swagger document? Is the expected schema there - for the :eItem or :no-envelope endpoints?

    Do the temp-tables have a different SERIALIZE-NAME value?



  6. Roger Blanchard
    Roger Blanchard avatar
    402 posts
    Registered:
    29 Jun 2018
    13 Jun in reply to Peter Judge
    Link to this post
    >> In this case the :eItem is (should be) ignored and you should see a "parameter" and a "dsItem" property in the response.

    Just the parameter object is returned. 

    >> What do you see in the Swagger document? Is the expected schema there - for the :eItem or :no-envelope endpoints?

    I will check that this morning. 

    >> Do the temp-tables have a different SERIALIZE-NAME value?

    I will confirm but this is a brand new BE I created this week by just dropping the table in the designer. I did not change the serialize-name. 

    Thank you
  7. Roger Blanchard
    Roger Blanchard avatar
    402 posts
    Registered:
    29 Jun 2018
    13 Jun in reply to Peter Judge
    Link to this post
    >> >> What do you see in the Swagger document? Is the expected schema there - for the :eItem or :no-envelope endpoints?

    I see just the GET endpoint. Do we have to manually add a schema?


    I have tried the following with the same result. 

    @RestMethod (address="/ESLItem/~{UpcNum}/~{PackNum}/GetUpc", requestMethod="get", parameterClassName="Osprey.Pos.Item.ItemParameterWeb", response="dsItem:eItem", responseSchemaType="Osprey/Pos/EslItem/dsItem.xsd").
  8. Mike Fechner
    Mike Fechner avatar
    333 posts
    Registered:
    14 Sep 2016
    13 Jun in reply to Roger Blanchard
    Link to this post
    The responseSchemaType is meant for OO return values. Path refers to a path reference in the swagger file.

    ProDataset schemas need to be provided using the ParameterSchema annotation:

    https://consultingwerk.atlassian.net/wiki/spaces/SCL/pages/8094254/Support+for+RESTful+invocation+of+Business+Task+and+Business+Entity+Methods#Arguments-of-the-@ParameterSchema-annotation
  9. Roger Blanchard
    Roger Blanchard avatar
    402 posts
    Registered:
    29 Jun 2018
    13 Jun in reply to Mike Fechner
    Link to this post
    This is from the PASOE log file. 

    2024-06-13T08:02:10.730-0400 036512 033536 1 AS-7 ?:?:? RestResour     ### Registering REST Methods: Osprey.Pos.EslItem.ESLItemBusinessEntity
    2024-06-13T08:02:10.731-0400 036512 033536 1 AS-7 ?:?:? RestResour     ### Number of Methods: 1
    2024-06-13T08:02:10.731-0400 036512 033536 1 AS-7 ?:?:? RestResour     ### Registering REST Method: get       : /ESLItem/{UpcNum}/{PackNum}/GetUpc       Osprey.Pos.EslItem.ESLItemBusinessEntity:GetUpc(Osprey.Pos.Item.ItemParameterWeb) -> dsItem:eItem
  10. Roger Blanchard
    Roger Blanchard avatar
    402 posts
    Registered:
    29 Jun 2018
    13 Jun in reply to Mike Fechner
    Link to this post
    Hello Mike,

    I have reviewed that document and have tried using the @ParameterSchema but when I use the response="dsItem:eItem" I get a blank response. The response="dsItem" works as I would expect. 

    @RestMethod (address="/ESLItem/~{UpcNum}/~{PackNum}/GetUpc", requestMethod="get", parameterClassName="Osprey.Pos.Item.ItemParameterWeb", response="dsItem:eItem").
    @ParameterSchema (datasetname="dsItem", schemafile="/Osprey/Pos/EslItem/dsItem.xsd"). 

    Not sure what we are doing wrong. I assume we can use the .xsd that was created by the BE designer. 
  11. Peter Judge
    Peter Judge avatar
    13 posts
    Registered:
    11 Aug 2022
    13 Jun in reply to Roger Blanchard
    Link to this post

     I assume we can use the .xsd that was created by the BE designer.


    Yep, definitely.

    I see just the GET endpoint. Do we have to manually add a schema?


    Nope, the Swagger doc is built from the same annotations that the RestEntitiesWebHandler uses.

    We have a test case that's just about identical to what you're describing, and that does what's expected (no, this is not the "works on my machine" defence :). I think it might make sense to open a support ticket and we can set up a meeting to investigate this.
  12. Roger Blanchard
    Roger Blanchard avatar
    402 posts
    Registered:
    29 Jun 2018
    13 Jun in reply to Peter Judge
    Link to this post
    Thanks Peter.
  13. Peter Judge
    Peter Judge avatar
    13 posts
    Registered:
    11 Aug 2022
    Answered
    13 Jun in reply to Roger Blanchard
    Link to this post
    As a note for anyone who runs into this kind of issue, the improvements that allow returning datasets without an envelope or just a single table, were released in the 2024-02-19 release (see the release notes for more detail).
13 posts, 1 answered