IBM i Global

IBM i Global

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

 View Only
Expand all | Collapse all

IBM web admin for i

  • 1.  IBM web admin for i

    Posted Wed March 27, 2024 05:40 PM

    In IBM Web Admin for i, I have an http server running with a deployed service (that calls an RPGLE program).  It's all working great.   Is there a way to ignore unrecognized fields (keys) that are passed in so I do not get the error below?  

    "Error 500: javax.servlet.ServletException: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "BillAcctIddd" (Class iseries.wsbeans.getcustomers.CustomersFilterDS_T), not marked as ignorable

     at [Source: com.ibm.ws.webcontainer.srt.SRTInputStream@4846cb18&#59; line: 3, column: 21
    ] (through reference chain: iseries.wsbeans.getcustomers.CustomersFilterDS_T["BillAcctIddd"
    ])"


    ------------------------------
    JOHN RICCIARDELLI
    ------------------------------


  • 2.  RE: IBM web admin for i

    Posted Thu March 28, 2024 03:40 PM

    Do you mean this is an IWS service created with the Wizards? In that case, I have no idea how you could achieve this since the PCML for the RPG should have set the parm list properly for you.

    If you didn't use PCML and coded it by hand, I suggest you re-do it with PCML.

    If this isn't IWS related we'll need to know a lot more about how you set this up.



    ------------------------------
    Jon Paris
    ------------------------------



  • 3.  RE: IBM web admin for i

    Posted Thu March 28, 2024 08:41 PM

    Thank for the reply



    ------------------------------
    JOHN RICCIARDELLI
    ------------------------------



  • 4.  RE: IBM web admin for i

    Posted Thu March 28, 2024 08:44 PM

    I did create this with the IWS wizard.  I was hoping that there was some configuration I could change (or add) that would allow it to ignore unrecognized field names from the request.   If that is not possible then I was hoping to also get some informatoin on how to send back a JSON error message when that error did occur (before it calls the RPG program).  So if an unrecognized field is sent and it gets a 500 error how to add the custom error message.  I already added teh following to the config file:

    Any advice is greatly appreciated!  

    Thank you



    ------------------------------
    JOHN RICCIARDELLI
    ------------------------------



  • 5.  RE: IBM web admin for i

    Posted Thu March 28, 2024 09:52 PM
    Edited by Satid S Thu March 28, 2024 09:57 PM
      |   view attached

    Dear John

    Please look at page 30 of the presentation file (by the great Scott Klement) I attach herewith to see if it helps you on this or not. If not, please read the entire file instead in case it may help. 

    These 2 URLs may also be useful for you :

    Integrated Web Services for IBM i - Frequently asked questions at  https://www.ibm.com/support/pages/integrated-web-services-ibm-i-frequently-asked-questions 

    Integrated Web Services for IBM i - Web services made easy at  https://www.ibm.com/support/pages/integrated-web-services-ibm-i-web-services-made-easy



    ------------------------------
    Satid S
    ------------------------------

    Attachment(s)



  • 6.  RE: IBM web admin for i

    Posted Fri March 29, 2024 10:53 AM

    At this time, there is no way to tell IWS to ignore unexpected fields in a client request.  And the error happens prior to reaching the web service, so you cannot override the message.  However, work is being done on this and you should open an IDEA so we can prioritize. 

    We understand this is an important issue. 



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



  • 7.  RE: IBM web admin for i

    Posted Fri March 29, 2024 11:06 AM

    Thank you nadir.  So I have to create these outside of IWS (Do it yourself version).  Probably better for me to learn JSON handling.  Any tips on how to program for where there is a datastructure coming in and going out (so input paramters not in URL like in Scott Klements example in the above PDF).  Once again I greatly appreciate all the help/advice!   



    ------------------------------
    JOHN RICCIARDELLI
    ------------------------------



  • 8.  RE: IBM web admin for i

    Posted Sun March 31, 2024 01:55 PM

    I am making progress.  When I test with postman and send the reqeust as application/json and call QtmhRdStin( request:%Size(request) : rtnLen: err);   

    Request comes back as #█ãÑ%ÈÁÊ██#█ëÁ/ÊÄÇ███ä êà████████████████'██████████████'   '   

    bu if I send as text/plain from postman it comes back corectly formatted.  My question is how to I send it as application/JSON from postman and have it formatted correctly?

    Thanks



    ------------------------------
    John Ricciardelli
    ------------------------------



  • 9.  RE: IBM web admin for i

    Posted Sun March 31, 2024 04:39 PM

    I got it to work for application/json with:

    Data-into InputDS
                  %DATA('*STDIN':'doc=string allowmissing=yes allowextra=yes trim=all case=convert')
                  %PARSER('YAJLINTO');     

    Next question:  How do I do the same thing with XML?  



    ------------------------------
    John Ricciardelli
    ------------------------------



  • 10.  RE: IBM web admin for i

    Posted Sun March 31, 2024 07:54 PM

    Answered my own question and for future reference . . . . I just made the request field below CCSID(*UTF8) and it worked!

    QtmhRdStin(request:%Size(request) : rtnLen: err);   



    ------------------------------
    John Ricciardelli
    ------------------------------



  • 11.  RE: IBM web admin for i

    Posted Mon April 01, 2024 09:33 AM

    I just want to express my appreciation for you John, for posting your updates and eventually solution in this thread!  It will be super helpful to anyone who has the same issue and finds themselves here.



    ------------------------------
    Steven Riedmueller
    Certified IBM i Admin
    Speaker, Mentor, and Advocate
    ------------------------------



  • 12.  RE: IBM web admin for i

    Posted Mon April 01, 2024 10:02 AM

    Happy to help out anyone avoid the same struggles as me and thanks for the kind words.   

    Now that I have the HTTP server and my API program working, my next question is:  How do add security to my HTTP server?  Turn my "HTTP://" into "HTTPS://"?    Are there any good detailed instructions out there? 

    thanks



    ------------------------------
    John Ricciardelli
    ------------------------------



  • 13.  RE: IBM web admin for i

    Posted Mon April 01, 2024 10:26 AM

    It's not too complicated.  You'll want to access DCM and create a new "application" definition.  Then you can assign a certificate to that application, and use that application name in your HTTP server under the HTTPAdmin "Security" section.

    You have the option of obtaining a certificate from DigiCert or other certificate authority, or using a "Local CA" within the DCM to generate a cert.  If you have full control over the client systems, you can just use the local CA and you won't have to pay for a cert.



    ------------------------------
    Steven Riedmueller
    Certified IBM i Admin
    Speaker, Mentor, and Advocate
    ------------------------------



  • 14.  RE: IBM web admin for i

    Posted Wed April 10, 2024 08:35 AM

    I have the HTTP server all set up with security (HTTPS) so my next question is how do I change the library list of for the programs being called that are listed in the config file with ScriptAlias?  

    I tried changing the JOBD lib list that is in the config file but that did not work.  And I added a SetEnv QIBM_CGI_LIBRARY_LIST but no luck there either.  What controls the lib lists? 

    Thanks

    John



    ------------------------------
    John Ricciardelli
    ------------------------------



  • 15.  RE: IBM web admin for i

    Posted Thu April 11, 2024 02:37 AM
    Edited by Satid S Thu April 11, 2024 02:37 AM

    Dear John

    >>>> I tried changing the JOBD lib list that is in the config file but that did not work.  And I added a SetEnv QIBM_CGI_LIBRARY_LIST but no luck there either.  What controls the lib lists?  <<<<

    Did you set the SetEnv directive as instructed in this Technote?  CGI frequently asked questions at  https://www.ibm.com/support/pages/cgi-frequently-asked-questions-0#How%20can%20I%20change%20the%20library%20list%20for%20my%20CGI%20program?   

    How can I change the library list for my CGI program?

    This can be done using the SetEnv directive with the QIBM_CGI_LIBRARY_LIST environment variable and a list of the libraries. Be sure to uppercase the library names and separate them by semi-colons. For example:   SetEnv QIBM_CGI_LIBRARY_LIST "MIME;CGIURL;CGILIBL"

    The listed libraries replace the libraries in the user part of the library list. When the CGI program has finished processing, these libraries will be removed from the library list and the library list will be restored to what it was before the CGI program ran.

    If you did, try restarting the deployed server to see if it solves the issue.



    ------------------------------
    Satid S
    ------------------------------



  • 16.  RE: IBM web admin for i

    Posted Mon April 01, 2024 10:27 AM
    Edited by Nadir K Amra Mon April 01, 2024 10:30 AM

    Check out Security Tasks at:

    https://www.ibm.com/docs/en/i/7.4?topic=server-tasks

    Well, I thought it would have TLS configuration, but it does not.  In Web Admin GUI, there is a wizard in navigation panel to configure TLS. 

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