WEB API not working

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
cesarrafael
Posts: 32
Joined: Tue Dec 01, 2015 3:44 am

WEB API not working

Post by cesarrafael »

Hi All,

I've been trying to build a Web API based on the tutorials, learn lansa, etc. but I'm not being able to make it work!
I think I followed all steps, but I also think I may be missing some parametrization....It doesn't work neither locally nor on the iSeries All I get is a" 404 not found"

iSeries
http://192.168.0.33:8080/d15pgmlib/my1e ... ees/100066
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Não Encontrado</TITLE>
</HEAD><BODY>
<H1>Não Encontrado</H1>
<P>O URL /d15pgmlib/my1emp/employees/100066 solicitado não foi encontrado neste servidor.<P>
</body></html>

Local windows:
http://localhost:8081/lansaoniseries/my ... ees/100066
{
"error": {
"messages": [
"HTTP 404 - Not Found"
]
}
}

I've tried several variations when calling the API (with and without "d15pgmlib", with partition and without partition, etc) Allways with the same result...
Any ideas on what am I missing?

Many thanks,
Attachments
code.png
code.png (148.89 KiB) Viewed 386145 times
Api_Des.png
Api_Des.png (61.5 KiB) Viewed 386145 times
Tim McEntee
Posts: 57
Joined: Thu May 26, 2016 8:46 am

Re: WEB API not working

Post by Tim McEntee »

http://192.168.30.45:7080/d02/LTAAPIOrd ... LTCPRODID=

so http or https
then ip:port
then partition
then server module name
then service name
cesarrafael
Posts: 32
Joined: Tue Dec 01, 2015 3:44 am

Re: WEB API not working

Post by cesarrafael »

Many thanks Tim!
However, we have multiple installations on our laptops....
But according to your specification it would be "http://localhost:8081/bpx/my1emp/employees?emp=100066", however I get a different error now. It's still a 404 but it's not json. Maybe I'm missing something on my install?
Error1.png
Error1.png (69.05 KiB) Viewed 386109 times
User avatar
Dino
Posts: 472
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: WEB API not working

Post by Dino »

Start your testing calling the status, it's simpler.

Check what routes exist or not on your /lansa_dc@pgmlib/run/conf/webmodules.conf

If the server module has successfully been compiled/checked in the 400, you should have entries there

Partition may be missing in your route
cesarrafael
Posts: 32
Joined: Tue Dec 01, 2015 3:44 am

Re: WEB API not working

Post by cesarrafael »

Hi Dino,
Many thanks for your help! But everything seems to be fine!
webserver.png
webserver.png (35.74 KiB) Viewed 386086 times
webmodules.png
webmodules.png (36.05 KiB) Viewed 386086 times
notfound.png
notfound.png (30.85 KiB) Viewed 386086 times
cesarrafael
Posts: 32
Joined: Tue Dec 01, 2015 3:44 am

Re: WEB API not working

Post by cesarrafael »

notfound2.png
notfound2.png (32.17 KiB) Viewed 386086 times
abaout.png
abaout.png (82.2 KiB) Viewed 386086 times
Not sure what to check anymore....it simply doesn't work...
I was under the impression this API thing was supposed to be straight forward and simple....

Many thanks for your help..
jonno
Posts: 8
Joined: Thu Nov 22, 2018 12:18 pm

Re: WEB API not working

Post by jonno »

We are also having issues using APIs directly to the IBMi:
- upgrading an existing lansa system (150060 to 150070) - api's don't work
- brand new installation - api's work
We are using APIs on our epc150060 system successfully via a windows server as an intermediary to the IBMi so we know the API's can work. Just not directly using the fixes in epc70 on the IBMi.
We are still investigating and will update this post when we find the problem
User avatar
Dino
Posts: 472
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: WEB API not working

Post by Dino »

What about the server modules?

.../d15pgmlib/dem/xvlwebsts works?
If so license, listener, firewall, should be fine.

Web apps works? Sample crud?

The url you show it works is the old style, using the lansaweb instead of the partition.... do you have anything running in the new web? Have you initialized the partition using the administration option in the green screen menu?

What about lansa web admin. Does it complete the test successfully?

Maybe missing something in the apache configuration in the 400?

Authority to the Web modules file?

I understand you already have a lot of systems installed, but what about installing a fresh one and compare?

Missed the new compare you had already. Check conf file, web admin, dc@ data areas missing values
cesarrafael
Posts: 32
Joined: Tue Dec 01, 2015 3:44 am

Re: WEB API not working

Post by cesarrafael »

Hi Dino,
Many thanks for your help and patience.
xvlwebtst works perfectly! We normally use web apps and framework without any problems.
xvlwebtst.png
xvlwebtst.png (82.95 KiB) Viewed 386058 times
Crud also works
CreudWebApp.png
CreudWebApp.png (79.76 KiB) Viewed 386058 times
Tried to test locally as well and it seems to be ok..
local_IIS_Test.png
local_IIS_Test.png (109.25 KiB) Viewed 386058 times
Not sure about what to look for when you say that something may be missing! Maybe something's missing, but how do i know?
It doesn't work on the iSeries and it doesn't work locally either!

This is a top feature anounced by lansa, it should work painlessly....we won't be spending a lot of time with this and will look for alternatives, as it obviously doesn't work, at least not straightforward....Maybe someone at support may take a look at this...we'll see...
Many thanks for all your help.
User avatar
Dino
Posts: 472
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: WEB API not working

Post by Dino »

In the Web admin, compare old and fresh install under tools, configure apache module. If empty values found, most likely is missing values in data area, that could also be visible comparing lansa about command in the 400.

Check the logs in the log and tmp folders.

I also found once that most verbs had been restricted in the apache configuration, but being able to run web apps... means that at least "get" is allowed...

If running epc150070... you should have running in the 400, jobs like lweb_cfg, lweb_job, lweb_mon, lweb_wsr plus the tp* jobs in your lansa subsystem... if anyone missing... check joblog
cesarrafael
Posts: 32
Joined: Tue Dec 01, 2015 3:44 am

Re: WEB API not working

Post by cesarrafael »

Hi,

checking one of D15PGMLIB web jobs I found this error:
d15pgmlibjoberr.png
d15pgmlibjoberr.png (117.79 KiB) Viewed 385715 times
Apparently it is creating an object called “N” and trying to create an object called “I” (just one character, without anything else)….Is it possible that the value ‘’ (blank) is causing the error, if so what is causing the value to be passed as ‘’ (blank)?
Object_N.png
Object_N.png (126.06 KiB) Viewed 385711 times
LWEB_WSR ends abnormally with this message:

CPF0001 Escape 30 10/07/25 12:36:15,366264 W3@WSTP D15PGMLIB *STMT QCMD QSYS 01C8
Do módulo . . . . . . . . . : W3XWSTP
Do procedimento . . . . . . : exceptionHandler__FP21_INTRPT_Hndlr_Parms_T
Instrução . . . . . . . . . : 5
Mensagem . . . : Foi encontrado um erro no comando .
Causa . . . . . : O sistema detectou erros no comando. Recuperação . . :
Consulte as mensagens anteriormente listadas no registo de trabalhos.
Corrija os erros e execute novamente o comando. *N em vez de um nome de
comando significa que o nome não tinha sido determinado antes do erro ser
encontrado

on the web error_log we have this:

[Thu Jul 10 12:34:59.362824 2025] [mpm_worker:notice] [pid 331:tid 00000004] ZSRV_MSG0385: Apache/2.4.34 (IBM i) LANSA-VLWEB/15 configurado -- a retomar as operações normais.
[Thu Jul 10 12:39:14.345104 2025] [vlweb:error] [pid 334:tid 0000006B] [client 192.168.0.200:53208] vlweb_localsys_handler(): System exception occurred, returns HTTP_INTERNAL_SERVER_ERROR (500).

Can't find anything else...

Any ideas?
Many thanks.
User avatar
Dino
Posts: 472
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: WEB API not working

Post by Dino »

That sounds like missing information in the data area.
As you have a new and old systems, compare and complete data areas in dc@pgmlib

Wrkdtaara dc@pgmlib/dc*

If an important value is missing that is also visible in the lansa about,
And lansa web administrator, tools, configure apache module, where all the values should be populated.

Also, I'll change the Web administrator to any port while testing

Check the log in the dc@pgmlib job in the qhttpsvr too
Post Reply