HTTP Service (XML Inbound)

Loads the HTTPService service. Receives xml order using Inbound xml content handler and stylesheet (created using the XML Transformation Wizard).

********** Beginning of RDML commands ********** 

FUNCTION   OPTIONS(*DIRECT)

**********                                                    

DEFINE     FIELD(#JSMSTS) TYPE(*CHAR) LENGTH(20)              

DEFINE     FIELD(#JSMMSG) TYPE(*CHAR) LENGTH(255)             

DEFINE     FIELD(#JSMCMD) TYPE(*CHAR) LENGTH(255)

**********                                                    

DEFINE     FIELD(#ORDER) TYPE(*CHAR) LENGTH(10)               

DEFINE     FIELD(#NAME) TYPE(*CHAR) LENGTH(50)                

DEFINE     FIELD(#STREET) TYPE(*CHAR) LENGTH(50)              

DEFINE     FIELD(#CITY) TYPE(*CHAR) LENGTH(50)                

DEFINE     FIELD(#STATE) TYPE(*CHAR) LENGTH(5)                

DEFINE     FIELD(#ZIP) TYPE(*CHAR) LENGTH(5)                  

**********

DEFINE     FIELD(#LINENUM) TYPE(*DEC) LENGTH(3) DECIMALS(0)      

DEFINE     FIELD(#PARTNUM) TYPE(*DEC) LENGTH(3) DECIMALS(0)      

DEFINE     FIELD(#PARTDSC) TYPE(*CHAR) LENGTH(50)                

DEFINE     FIELD(#PARTAMT) TYPE(*DEC) LENGTH(10) DECIMALS(2)     

DEFINE     FIELD(#PARTQTY) TYPE(*DEC) LENGTH(3) DECIMALS(0)      

DEFINE     FIELD(#FILL1) TYPE(*CHAR) LENGTH(3)                   

**********                                                       

DEF_LIST   NAME(#WRKLST) FIELDS((#FILL1) (#LINENUM) (#PARTNUM)   

           (#PARTDSC) (#PARTAMT) (#PARTQTY)) TYPE(*WORKING)      

**********                                                       

********** 'Open service'                                        

**********                                                       

USE        BUILTIN(JSM_OPEN) TO_GET(#JSMSTS #JSMMSG)             

EXECUTE    SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)         

**********                                                       

********** 'Load service'                                        

**********                                                       

USE        BUILTIN(JSM_COMMAND) WITH_ARGS('SERVICE_LOAD SERVICE(HT

           TPSERVICE)') TO_GET(#JSMSTS #JSMMSG)                  

EXECUTE    SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)         

**********                                                       

********** Receive XML order, SV order, POST order               

**********                                                       

********** HANDLER(IXML) XSL(RECEIVEORDER) or                    

********** HANDLER(IXML) XSL(SENDORDER) or                       

********** HANDLER(ISVL) SVHEAD(ORDER) or                        

********** HANDLER(INVL) BIND(*FIELD)                            

********** HANDLER(IMP)  SVHEAD(ORDER)                           

**********                                                       

CHANGE     FIELD(#JSMCMD) TO('RECEIVE HANDLER(ISVL) SVHEAD(ORDER)

           SERVICE_LIST(FILL1,LINENUM,PARTNUM,PARTDSC,PARTAMT,   

           PARTQTY)')                                            

**********                                                       

USE        BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS

           #JSMMSG #WRKLST)                                      

EXECUTE    SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)         

**********                                                       

********** Process and validate                                  

**********                                                       

SELECTLIST NAMED(#WRKLST)                                        

**********                                                       

ENDSELECT                                                        

**********                                                       

********** Send response                                         

**********                                                       

CHANGE     FIELD(#JSMCMD) TO('SEND HANDLER(ISVL) SERVICE_LIST(FILL

           1,LINENUM,PARTNUM,PARTDSC,PARTAMT,PARTQTY)')          

**********                                                       

USE        BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS

           #JSMMSG #WRKLST)                                      

EXECUTE    SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)         

**********                                                       

********** 'Close service'                                       

**********                                                       

USE        BUILTIN(JSM_CLOSE) TO_GET(#JSMSTS #JSMMSG)            

EXECUTE    SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)         

**********                                                       

********** SUB ROUTINES                                          

**********                                                       

SUBROUTINE NAME(CHECK) PARMS((#JSMSTS *RECEIVED) (#JSMMSG *RECEIVE

           D))                                                   

**********                                                       

IF         COND('#JSMSTS *NE OK')                   

**********                                          

********** Close service and send the HTTP response 

**********                                          

USE        BUILTIN(JSM_CLOSE) TO_GET(#JSMSTS #JSMMSG)

**********                                          

ENDIF                                               

**********                                          

ENDROUTINE                                          

********** End of RDML commands **********