HTTPService

Refer to shipped RPG source file QRPGLRSRC and CRTDEMO program source in QCLSRC source file.

 

     D ListDef1        S             60    DIM(2) CTDATA

     D ListDefSize     S             10I 0 INZ(0)

     D ListEntSize     S             10I 0 INZ(0)

     D ListCount       S             10I 0 INZ(0)

     D ListMaxCount    S             10I 0 INZ(0)

      *

     D JSMHDL          S              4    INZ(*BLANKS)

     D JSMSRV          S            100    INZ(*BLANKS)

     D JSMSTS          S             40    INZ(*BLANKS)

     D JSMMSG          S           4096    INZ(*BLANKS)

     D JSMCMD          S           2048    INZ(*BLANKS)

     D ZEROLENGTH      S             10I 0 INZ(0)

      *

     D LST1            DS                  OCCURS(10)

     D  NAME                         50

     D  VALUE                       100

      *

      * JSMX_BEGIN

      *

     C                   CALLB(D)  'JSMX_BEGIN'

     C                   PARM                    *OMIT

     C                   PARM                    ZEROLENGTH

      *

      * JSMX_OPEN

      *

     C                   CLEAR                   JSMSRV

     C                   EVAL      JSMSRV = 'LOCALHOST'

     C                   CALLB(D)  'JSMX_OPEN'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMSRV

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * SERVICE_LOAD - BIND LIST

      *

     C                   EVAL      ListDefSize  = %SIZE(ListDef1:*ALL)

     C                   EVAL      ListEntSize  = %SIZE(LST1)

     C                   EVAL      ListCount    = 0

     C                   EVAL      ListMaxCount = %ELEM(LST1)

     C                   CALLB(D)  'JSMX_BINDLST'

     C                   PARM                    JSMHDL

     C                   PARM                    ListDef1

     C                   PARM                    ListDefSize

     C                   PARM                    LST1

     C                   PARM                    ListEntSize

     C                   PARM                    ListCount

     C                   PARM                    ListMaxCount

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * SERVICE_LOAD

      *

     C                   CLEAR                   JSMCMD

     C                   EVAL      JSMCMD = 'SERVICE_LOAD' +

     C                                      ' SERVICE(HTTPService)' +

     C                                      ' SERVICE_CONTENT(*HTTP)' +

     C                                      ' BIND(*LIST)' +

     C                                      ' TRACE(*YES)'

     C                   CALLB(D)  'JSMX_COMMAND'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMCMD

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * RECEIVE HANDLER

      *

     C                   CLEAR                   JSMCMD

     C                   EVAL      JSMCMD = 'RECEIVE' +

     C                                      ' HANDLER(InboundMultiPart)' +

     C                                      ' FIELD(SONUMBER)'

     C                   CALLB(D)  'JSMX_COMMAND'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMCMD

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * RECEIVE HANDLER

      *

     C                   CLEAR                   JSMCMD

     C                   EVAL      JSMCMD = 'RECEIVE' +

     C                                      ' HANDLER(InboundMultiPart)' +

     C                                      ' FILE(FILE1)' +

     C                                      ' TO(upload.txt)'

     C                   CALLB(D)  'JSMX_COMMAND'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMCMD

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * SEND HANDLER

      *

     C                   CLEAR                   JSMCMD

     C                   EVAL      JSMCMD = 'SEND' +

     C                                      ' HANDLER(InboundFile)' +

     C                                      ' FILE(receipt.pdf)' +

     C                                      ' CONTENT(*PDF)' +

     C                                      ' UACACHE(5)'

     C

     C                   CALLB(D)  'JSMX_COMMAND'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMCMD

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * JSMX_CLOSE

      *

     C                   CALLB(D)  'JSMX_CLOSE'

     C                   PARM                    JSMHDL

     C                   PARM                    JSMSTS

     C                   PARM                    JSMMSG

      *

      * JSMX_END

      *

     C                   CALLB(D)  'JSMX_END'

      *

     C                   SETON                                        LR

 

**CTDATA ListDef1

NAME                                              A000005000

VALUE                                             A000010000