Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / CGI using IIS

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. CGI using IIS
#13443
Posted by: chucksim 2011-01-24 21:43:35
I am trying to use rexx scripts for CGI  under ISS 5. I have it working fine as long as I use the GET method. But when I try to use the POST method, STDIN seems to have no data. The env variable CONTENT_LENGTH gets set correctly but when I read STDIN there is no data. Any ideas? I am using the code provided in the WWW.ZIP folder provided by Jeff.
Chuck Simmons
Message2.
#13444
Posted by: Jeff Glatt 2011-01-28 03:31:00 Last edited by: Jeff Glatt 2011-01-28 03:34:23 (Total edited 1 time)
Those example scripts were written before I made the changeover to Reginald's new GUI-based "console windows". These new console windows aren't like the old console windows. The new windows work with REXX GUI windows (for example, reading input from the console window doesn't lock out the user interface for any REXX GUI windows), and also you can even embed the console windows inside of REXX GUI windows. The new console windows are not connected to the operating system's "standard input handle", unlike the old traditional console windows. And the functions LINEIN, CHARIN, LINEOUT, and CHAROUT are tied to the console windows (when you omit the first arg). So the LINEIN and CHARIN functions no longer read from the standard input. They read directly from the console window's own private input.

To get CHARIN (or LINEIN) to read from standard input, instead of omitting the first arg, specify a filename of "<stdin>". This should work:

cgireadpost:
   USE ARG input

   IF GETENV('REQUEST_METHOD') \== "POST" THEN DROP input
   ELSE DO
      input = GETENV('CONTENT_LENGTH')
      input = CHARIN("<stdin>",, input)
      CATCH NOVALUE
         input = CONDITION('D') "environment variable was not set!"
         RAISE ERROR 1 DESCRIPTION (input) RETURN (input)
      CATCH NOTREADY
         DROP input
         RAISE ERROR 2 DESCRIPTION ("Form data could not be read!") RETURN ("Form data could not be read!")
   END
   RETURN ""
And if you need to write to standard output with CHAROUT or LINEOUT, use a filename arg of "<stdout>".
Message3.
#13445
Posted by: chucksim 2011-02-05 00:04:29
Works like a charm. Thanks!
Chuck Simmons
Message4. ODBC Error when using cgi from POST in html form
#13452
Posted by: chucksim 2011-02-15 23:06:03
I have a new issue now. I am trying to use the ODBC interface with a MS Access database using some functions defined in a DLL I am loading in my cgi script. I get the following error when I try to connect to my database. When I execute the cgi directly from the folder by dbl-clicking on it, it runs fine.


CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

C:\Inetpub\wwwroot\test1.cgiLine #20, err250: "ODBCALLOCDATABASE" reported "IM002 [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"

Below is my cgi script:
LIBRARY rexxgui, rxcmd, rxodbc


MACRO PAQS, DMQUES, RTF




@jobname = 'H01234'
/* Create handle for system database */
dbname = 'D:\Net\'||@jobname||'_paqs.mdb'

OdbcErr = 'SYNTAX'
OdbcHeading = 1

OdbcAllocEnv()

DO
   ConnectString = "DSN=MS Access Database;DBQ="||dbname||";PWD=chucky;"
   OdbcAllocDatabase("@jobdb", "ConnectString", "MyStatement")

   CATCH ERROR
      CONDITION("M")
      RETURN
END

DO
   ConnectString1 = "DSN=MS Access Database;DBQ=D:\Net\pcaccess.mdb;PWD=chucky;"
   OdbcAllocDatabase("@sysdb", "ConnectString1", "MyStatement1")

   CATCH ERROR
      CONDITION("M")
      RETURN
END




AT(1A1.2,time()) /* AT() is a defined function in my PAQS DLL that sets the value in mydatabase*/

say AT(1A1.2)  /* This AT() function simply returns the value from the database */




OdbcAllocDatabase("@jobdb")
OdbcFreeDatabase('DROP')
OdbcAllocDatabase("@sysdb")
OdbcFreeDatabase('DROP')
OdbcFreeEnv()
Chuck Simmons
Message5.
#13453
Posted by: ironcore 2011-02-16 00:44:47
I've had this problem.  ODBC needs a DSN created by the user id that is trying to connect.
Sign on as the user calling your app and create a DSN to your database.

At least that's how I got it to work.
cliff:-)
Message6.
#13454
Posted by: chucksim 2011-02-16 05:23:43
Looks like it may have something to do with IIS not being able to see my ODBC definitions? Any ideas?
Chuck Simmons
Message7.
#13455
Posted by: chucksim 2011-02-16 08:54:44
Ah. Got it. I had to define a System DNS.
Chuck Simmons
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2017-9-22  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0