I have written a new function in RDMLX using JSMX functions to process the JSON data that is sent via the web service.
The basic outline of the function is:-
Code: Select all
USE BUILTIN(JSMX_OPEN) TO_GET(#gblJSMSts #gblJSMStM #gblJSMHnd)
#gblJSMCmd := 'SERVICE_LOAD SERVICE(HTTPInboundJSONBindService) SERVICE_CONTENT(*HTTP)
TRACE(*YES)'
USE BUILTIN(JSMX_COMMAND) WITH_ARGS(#gblJSMHnd #gblJSMCmd) TO_GET(#gblJSMSts #gblJSMStM)
#gblJSMCmd := 'BIND TYPE(*INBOUND) SERVICE(MYSERVICENAME) SERVICE_EXCHANGE(*FIELD)'
USE BUILTIN(JSMX_COMMAND) WITH_ARGS(#gblJSMHnd #gblJSMCmd) TO_GET(#gblJSMSts #gblJSMStM)
BEGIN_LOOP
#gblJSMCmd := 'GET FRAGMENT(MYFRAGMENTNAME) SERVICE_EXCHANGE(*FIELD)'
USE BUILTIN(JSMX_COMMAND) WITH_ARGS(#gblJSMHnd #gblJSMCmd) TO_GET(#gblJSMSts #gblJSMStM)
IF (#gblJSMSts *EQ NOFRAGMENT)
* End of response
LEAVE
ENDIF
… save the date
END_LOOP
#gblJSMCmd := 'SERVICE_UNLOAD'
* * * SERVICE_UNLOAD not needed??? USE BUILTIN(JSMX_COMMAND) WITH_ARGS(#gblJSMHnd #gblJSMCmd) TO_GET(#gblJSMSts #gblJSMStM)
USE BUILTIN(JSMX_CLOSE) WITH_ARGS(#gblJSMHnd) TO_GET(#gblJSMSts #gblJSMStM)
*????? now do I now set the HTTP return status code to 200 if I processed the data correctly ??? rather than 600 [JMSDirect Message] that is currently being returned (with a "JSMDirect transaction did not complete" html message)
RETURN
My question is how do I specify the return status code that is passed back to the web service? E.g. I think I need to pass back status “200” to indicate the data has been received and processed correctly. However, the function is returning status “600 JSMDirect Message” and some html saying, “JSMDirect transaction did not complete”.
Thanks in advance
Colin