× 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.



Thanks for the book reference. It looks to be a good starting point for me
too.


--
Jim Oberholtzer
Agile Technology Architects

-----Original Message-----
From: WEB400 [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Tim Fathers
Sent: Friday, August 03, 2018 3:15 AM
To: Robert Rogerson <rogersonra@xxxxxxxxx>; Web Enabling the IBM i (AS/400
and iSeries) <web400@xxxxxxxxxxxx>
Subject: Re: [WEB400] Web service advice...

If it's really no more than about 10 seconds then either way is probably ok,
but having the web-service not return until the job has actually ended is
probably the easiest. For longer running back-end tasks then it's more
normal in the web world to return an HTTP response of 202 (Accepted) and get
the client to poll periodically to check the status. Along with a 202
status, the API can also return information about how the client should
request the status and even an estimated completion time so that you can
tell the client "I expect this process to take about 10 seconds", so that
the client can more intelligently poll.

I'm not familiar with what method you're using to create your server-side
code, but it looks like you're using "GET" with an "action" query parameter
like this; GET /myserver/myjob?action=start, which is quite an old fashioned
way of writing a web-service and not really recommended these days. What
you're doing is fine for a bit of hacking and learning, but you should look
at using a more RESTful API if you want to do it "properly". I only mention
this because when I started out I headed down many blind alleys, learning
stuff that I subsequently found out was out of date, deprecated or just
plain wrong.

One final thing, I found the book "RESTFul Webservices Cookbook" by Sabbu
Allamarju really useful at answering the sort of practical question you
asked. Obviously it's more geared towards writing and using RESTful APIs,
and if you're just getting started it might be a little advanced, but it
does help answer many of the questions that arise when you're coming from
the stateful green-screen world to the stateless web-service world.

Tim.


________________________________
From: WEB400 <web400-bounces@xxxxxxxxxxxx> on behalf of Robert Rogerson
<rogersonra@xxxxxxxxx>
Sent: 02 August 2018 22:08
To: web400@xxxxxxxxxxxx
Subject: [WEB400] Web service advice...

Hi all, first let me state that I'm just learning about web services using
Scott Klement's pdf's.

What I'm trying to accomplish is this. I have a NEP on the V7R1 box which
I'm trying to control from the web.

As a first step I have the html and javascript working to call a web service
to start and stop the job.

What I want to do now is display the status of the job on the page. So
(assuming the job is stopped) when the page is first displayed I would call
my web service and pass action=status which would return stopped and I would
display Inactive on the page.

If I click the start button the web service is called with action=start and
the job is started and the page is updated to Active.

Where I'm looking for advice is when I click the stop button. It may take
10 seconds for the job to actually end. So between the time that I call the
web service to end the job and when the job is actually ended I want to
display Ending... on the page.

So I'm thinking of two approaches.

Call the web service with action=status in a loop until the status is ended.
Only the update the page to Inactive.

Or when I call the web service to end the job I update the page with
Ending... and do not return a response from the RPG program until the job is
actually ended.

Does anyone have any advise on how to approach this issue.

Thanks,

Rob

--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midr
ange.com%2Fmailman%2Flistinfo%2Fweb400&amp;data=02%7C01%7C%7C52136dd96ff942f
8e44708d5f8b3d1f8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C6366883735554
83961&amp;sdata=8V6m2FQKKozRc%2BGRGObU8SuEJh56qBC6Rg14ztczkBg%3D&amp;reserve
d=0
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.mi
drange.com%2Fweb400&amp;data=02%7C01%7C%7C52136dd96ff942f8e44708d5f8b3d1f8%7
C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636688373555483961&amp;sdata=l8h
RUoqMPLtj0ibpjvCw%2FRc%2BB9CshM69AZOFGJl2unI%3D&amp;reserved=0.

--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.