PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Web request returns the program  (Read 1992 times)

John_S

  • Silver Member
  • ***
  • Posts: 20
    • View Profile
Web request returns the program
« on: June 18, 2020, 03:18:38 PM »
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

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Web request returns the program
« Reply #1 on: June 18, 2020, 04:05:08 PM »
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

  • Silver Member
  • ***
  • Posts: 20
    • View Profile
Re: Web request returns the program
« Reply #2 on: June 18, 2020, 04:26:00 PM »
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

  • Silver Member
  • ***
  • Posts: 20
    • View Profile
Re: Web request returns the program
« Reply #3 on: June 18, 2020, 04:39:39 PM »
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

  • Silver Member
  • ***
  • Posts: 20
    • View Profile
Re: Web request returns the program
« Reply #4 on: June 18, 2020, 04:49:13 PM »
It's working now.  I needed to add our standard prefixes at the top of the program.

Thanks for your help - much appreciated!