IBM i Global

IBM i Global

Connect, learn, share, and engage with IBM Power.

 View Only
  • 1.  IWS: Possible to ignore unknown parameters?

    Posted Mon June 09, 2025 05:05 PM

    I need to implement a service that's been defined by someone else that has 100+ field.  For my use case, I only care about a dozen of the fields.  Is it possible for me to define my pcml (or other parameters) in such a way to just ignore the undefined fields?



    ------------------------------
    Sam Byrd
    ------------------------------


  • 2.  RE: IWS: Possible to ignore unknown parameters?

    Posted Tue June 10, 2025 09:26 AM

    If your service is based on a program or a service program maybe you can use the "transient is-null fields" (to determine whether a field is null in a request): https://www.ibm.com/support/pages/detect-null-fields



    ------------------------------
    Philippe Bourgeois
    ------------------------------



  • 3.  RE: IWS: Possible to ignore unknown parameters?

    Posted Tue June 10, 2025 09:33 AM

    That would work, if I knew ahead of time all of the fields.  It seems that they can arbitrarily add fields to their json request (which is rather annoying).



    ------------------------------
    Sam Byrd
    ------------------------------



  • 4.  RE: IWS: Possible to ignore unknown parameters?

    Posted Tue June 10, 2025 10:41 AM

    At this time, you cannot ignore parameters in a deployed service.  It is on our TODO list. 



    ------------------------------
    Nadir K Amra
    ------------------------------



  • 5.  RE: IWS: Possible to ignore unknown parameters?

    Posted Tue June 10, 2025 10:45 AM

    Hello,

    I don't use IWS much as I think there are better solutions but if I do, I never use parameters in IWS the way you do as the limitations are high, specially in old versions.

    The best thing you can do is just to use a single parameter: a json and work with it. That way you can avoid passing parameters and you can be more flexible: i.e. deploying a new version of the rpg / cobol without changing the service.

    Regards,



    ------------------------------
    Juan Manuel Alcudia
    CD-Invest
    IBM Champion
    President of Common Europe
    ------------------------------



  • 6.  RE: IWS: Possible to ignore unknown parameters?

    Posted Tue June 10, 2025 10:53 AM
    Edited by Nadir K Amra Tue June 10, 2025 10:54 AM

    I do agree there are many options to doing REST services, of which IWS is legitimate option. 

    I do not agree with having one parameter in ALL cases.  You basically defeat the purpose of having IWS pass REST payloads as RPG/COBOL fields.  

    But, if you choose to have one character input parameter, and a client sends a REST request, you will get the JSON request in the parameter.  Then it will be up to the ILE program to parse the JSON document. You will also have to update the SWAGGER document that gets generated too. 



    ------------------------------
    Nadir K Amra
    ------------------------------



  • 7.  RE: IWS: Possible to ignore unknown parameters?

    Posted Tue June 10, 2025 11:04 AM

    Normally I only use separate parameters for the path parameters but only one for the body



    ------------------------------
    Juan Manuel Alcudia
    CD-Invest
    IBM Champion
    President of Common Europe
    ------------------------------