Web request returns the program

Started by John_S, June 18, 2020, 03:18:38 PM

Previous topic - Next topic

John_S

Hello.  I am trying to implement an API that accepts a part number and verifies that it is on file.  The attached .pxp program is what the API executes.

I am testing the API by executing the following code:
2610 LET URL$="http://cetec.meowintl.com:8088/wal_checkpn.pxp?&prc=AMP&Part=164164-1"
2620 LET URL$=SUB(URL$," ","%20")
2630 LET URL$=SUB(URL$,"|","%7C")
2640 LET URL$=SUB(URL$,"^","%5E")
2650 !
2660 SETERR 2690
2670 CALL "*PLUS/WEB/REQUEST",URL$,X$,Y$,Z$; REM "x$ is data, y$ is response, z$=response header

After 2670 executes X$ is nothing, and Y$ is a listing of my API program.  I don't understand why I am getting a program listing instead of my XML result.  What am I doing wrong?

Version 14.1, RedHat Linux, using the PxPlus web server.


Mike King

If you are getting a listing of your program then the .pxp file on the server is likely not a program file but rather a text file containing the source of the program.

Unlike native PxPlus which will automatically compile a text file to program format in memory, the web server requires that the .pxp files be true compiled program files.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

John_S

Thanks Mike, for some reason I thought it needed to be a text file.

I have saved it as a regular program, and now I am getting an error 121 "invalid program format" on line 1000 where it is just opening a keyed file.

1000 LET M2INV=HFN; OPEN INPUT (M2INV,IOL=*)"M2INV"


John_S

Since the file has an embedded IO program associated with it, I figured the error might be caused by it being unable to locate the IO program.  So I added the path to it to the prefix.  That fixed the error 121, but now I am getting an error 12 on line 1000.  I will keep trying.

John_S

It's working now.  I needed to add our standard prefixes at the top of the program.

Thanks for your help - much appreciated!