× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I should have clarified: this is not exactly what you requested, since you will need to add the method names to the URL. I think what you requested was a way to use a single URL, but have different code executed within the REST service based on the HTTP used to request something from the REST service. So http://myUrl/students would execute a SQL statement when it receives a GET request but call a program when it receives a POST request.

What I was suggesting would require another element in the URL to identify the method of the IWS service. So:
(1.) http://myUrl/students/enrolledStudent?class=PSYC101 would execute the SQL statement with a parameter to return students enrolled in Psychology 101.
(2.) http://myUrl/students/enrollNewStudent?class=Psyc101&studentId=12345 . would call the stored procedure, which would in turn call the desired ILE program to enroll a new student into the Psychology 101 class.


Thanks,

Kelly Cookson
Senior Software Engineer II
Dot Foods, Inc.
1-217-773-4486 ext. 12676
www.dotfoods.com


-----Original Message-----
From: Kelly Cookson
Sent: Tuesday, November 17, 2020 1:56 PM
To: Web Enabling the IBM i (AS/400 and iSeries) <web400@xxxxxxxxxxxxxxxxxx>
Subject: RE: [EXTERNAL] Re: [WEB400] Mixing sql and service program in IWS...

Just throwing this out as a possibility...I have never done this and have no clue about performance, limitations, or complexity in troubleshooting.

Would it be possible to create a *stored procedure* that calls the desired ILE program? I know stored procedures can call ILE programs. I've seen other people do it in our shop.

Then, use IWS to create a single REST service (SQL type service). The REST service would contain two methods within it.
(1.) One method receives HTTP GET requests and executes the SQL statement against the database file or table (e.g., SELECT * FROM MYFILE).
(2.) A second method receives HTTP POST requests and executes a SQL CALL statement to call the stored procedure--which in turn calls the desired ILE program.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.