IBM i Global

IBM i 

A space for professionals working with IBM’s integrated OS for Power systems to exchange ideas, ask questions, and share expertise on topics like RPG and COBOL development, application modernization, open source integration, system administration, and business continuity.


#Power


#IBMi
#Power
 View Only
  • 1.  Library list for SQL RESTful Webservices in IWS

    Posted 28 days ago
    Edited by Tim Fathers 28 days ago

    Hi all,

    For RESTful webservices created in the IWS, there seems to be a limit of 100 characters for the library list (below), which is nowhere near long enough for our library list. Is there any way to specify a longer library list (maybe by modifying the underlying config file directly)?

    EDIT:

    I'd also like to know if there's a way to return other status codes, such as 401 (Unauthorized), 403 (Forbidden), etc.?

    Many thanks,

    Tim.



    ------------------------------
    Tim Fathers
    ------------------------------



  • 2.  RE: Library list for SQL RESTful Webservices in IWS

    Posted 27 days ago

    Tim, 

    For the library list , try to consider running it through a JOBD that you can specify with the web services server creation's user?

    That will give you the most flexibility for changes. 


    If you really want to mess with the "configs", navigate to the path on the IFS : /QIBM/ProdData/OS/WebServices/bin/

    Then use the setWebServiceProperties.sh command for that WebService , see :

    (all are listed in this pdf: https://public.dhe.ibm.com/systems/support/i/iws/systems_i_software_iws_pdf_WebServicesServer_new.pdf) 


    On your custom error returns (I am assuming this will be a RPGLE procedure right?) , you can return that as an Specific value in the Procedure to return , example : 

    (reference : https://developer.ibm.com/tutorials/i-rest-web-services-server3/

    Just populate that variable then you are set to go. 

    Hope it helps. 



    ------------------------------
    Marius le Roux theIBMiGuy
    Owner , IBM i Modernization and Integration Consultant
    MLR Consulting
    ------------------------------



  • 3.  RE: Library list for SQL RESTful Webservices in IWS

    Posted 27 days ago

    Hi Marius,

    Many thanks for the reply. My questions were about SQL webservices as I would like to avoid using RPG, where possible. We already use a framework that I wrote some time ago, which exposes SQL stored procedures as webservices, hence we already have quite a lot of SQL/web code in place. Also, it looks like an RPG program must be located using an absolute path, rather than using the library list, which would not work in our environment.

    My goal here is to see if we can replace the framework we have with the IWS because ours has some limitations and it would make sense to move to something supported by IBM, instead of maintaining what we have.

    I will try the JOBD suggestion but I am wondering if it will only affect the IWS server job and not the QZDA* job that runs the SQL. I think the library list I enquired about in the original post is the JDBC job library list, which is set when a job is grabbed from the pool but I will try it.

    Not being able to set the HTTP status from SQL might prove to be a showstopper, unless I can use our reverse proxy to remap SQL exceptions to status codes.

    Thanks again for taking the time to answer - much appreciated.

    Tim.



    ------------------------------
    Tim Fathers
    ------------------------------



  • 4.  RE: Library list for SQL RESTful Webservices in IWS

    Posted 27 days ago

    Ah you are that Tim!. :) 

    If its the SQL only route, Nadir did confirm its on the roadmap in the last post for IWS from you. 


    For the QZDA* jobs library list (you can route them to a specific subsystem to get better control of them and also then inside of this subsystem , change their prestart settings accordingly (like the Class and the Job Description). 

    But it seems that using the Options inside the "Use Server's User ID" it will use that and append the libraries specified (if any is specified extra) during the webservice creation process from my understanding (though to be transparent here, I have not tested this yet - we just kept it simple by specifying the user in the webservice creation with the prestart Job config route change). 

    If might be open to other open source options to replace with, and don't mind some relatively easy coding , look at ILEAstic / NoxDB perhaps? (there is good community support on that though) 



    ------------------------------
    Marius le Roux theIBMiGuy
    Owner , IBM i Modernization and Integration Consultant
    MLR Consulting
    ------------------------------



  • 5.  RE: Library list for SQL RESTful Webservices in IWS

    Posted 27 days ago
    Edited by Tim Fathers 27 days ago

    Yep, it's me! I think Nadir was answering a different question I had regarding HTTP headers, unless I missed something.

    If we can't make IWS work for us, we'll stick with our existing framework but I'm not giving up yet, as it's so close to what we require.

    Thanks again,

    Tim.



    ------------------------------
    Tim Fathers
    ------------------------------



  • 6.  RE: Library list for SQL RESTful Webservices in IWS

    Posted 27 days ago
    Edited by Nadir K Amra 27 days ago

    Hi, I will update GUI to increase the maximum for library list. But I do not believe the Qshell command setWebServiceProperties.sh command has a limit, so that would be the way to go for now. You can try to set the JDBC property from web admin gui.  Select the service.  Go to properties and select the JDBC properties tab.  Change the libraries property. For example:

    libraries=lib1;lib2;lib3;

    But as has been indicated, there is no way to map SQL codes to HTTP status code.  Another thing that is on our TODO list. 



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



  • 7.  RE: Library list for SQL RESTful Webservices in IWS

    Posted 26 days ago

    Many thanks! Will these changes be made available as PTFs?



    ------------------------------
    Tim Fathers
    ------------------------------



  • 8.  RE: Library list for SQL RESTful Webservices in IWS

    Posted 14 days ago

    Hi, The following PTFs should resolve the field limitation in web admin GUI for library list:

    SJ08056                                  V7R6M0
    SJ08057                                  V7R5M0
    SJ08058                                  V7R4M0



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



  • 9.  RE: Library list for SQL RESTful Webservices in IWS

    Posted 12 days ago

    That's great - many thanks!



    ------------------------------
    Tim Fathers
    ------------------------------



  • 10.  RE: Library list for SQL RESTful Webservices in IWS

    Posted 26 days ago
    Edited by Paul Nicolay 26 days ago

    You can specify additional libraries (in addition to the ones you get from the server ID's job description) but this is only for additional objects (other files, programs, ...) but NOT for the webservice program itself, this always has a hardcoded library reference.

    This means that if you have a TSTLIB, PGMLIB type of library list and you insert a test version in your TSTLIB you'll need to redeploy the webservice or it will keep on using PGMLIB.

    PS. We never specify libraries on our webservices but run the server with a specific user ID with a proper JOBD attached to it.



    ------------------------------
    Paul Nicolay
    ------------------------------



  • 11.  RE: Library list for SQL RESTful Webservices in IWS

    Posted 26 days ago

    Hi Paul,

    Many thanks for the reply. For WSs implemented using RPG, I don't think would be practical for us to have to hardcode the program object library. Programs in our system move from dev, to T to Q and then to prod as they are worked on. When we work in the T env, for example, the library list ensures that any objects in T are used in preference to the Q or LIVE ones. If we wanted to replicate this, we would have to constantly update our various webservice environments to manually point at the correct objects as they passed through their various stages.

    We're actually only really interested in the SQL IWS way of creating webservices anyway, so the library list question was specifically about the library list that's set when a JDBC job is picked from the pool to run the query in.

    Unfortunately it looks like IWS with SQL is not quite there for what we'd need, but with the changes Nadir has said are coming, it looks very promising.

    I think what would work for us it to be able to have just four parameters:

    1. incoming meta data (HTTP request headers, URL params, query params, etc, etc.) wrapped in a single JSON object
    2. the request body as a LOB
    3. all output meta data (HTTP response headers, status, etc. etc.) wrapped in a single JSON object
    4. the response body as a LOB

    Tim.



    ------------------------------
    Tim Fathers
    ------------------------------