Hello everyone, I have a bit of a conundrum that I'm not sure why it is occuring.
I'm building a middleware of sorts to facilitate the communications of two systems. It's fairly straight forward and I've already had success in the past with similar flows using XML. This newer process is using JSON which shouldn't be an issue but for some reason when I get to the point of verification, the post is empty. Here is a high level overview of what is happening.
-
A. There is a local .net application is waiting for input from an application to generate HTTP XML post messages. The process is; Logon, perform a lookup, logoff.
-
B. There is a 3rd party REST service waiting to answer requests in JSON. Simply a
logon and establish a session, perform a verification with results, and logoff
The Node-Red application I am building will basically intercept the local .net application request, translate it a JSON request for the REST service and answer back to the .net application based on the REST service response.
I have nodes built to take information from the lookup and transform it to a verification. The secondary service I am reaching out to requires a persistent session instead of relying on session identifiers. So I enabled the keep alive option on the login post with the goal of carrying it through the process. Once the process continually failed I created temporary listeners to capture both ends as troubleshooting the 3rd party service is impossible at the moment. I'm attaching a screenshot of what the nodes I used.
The problem is, I can initiate each process with the 3rd party separately using the inject nodes without issue. However, because they are using a persistent session instead of session identifiers the lookup fails as their system interprets it as a new request that is unauthenticated. If I link the nodes together and select the persistent session, the "Lookup" node is empty and there is no data being sent. Despite having a template with data, which works individually.
[{"id":"41ff3755.b19ca8","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"66b3b782.6963d8","type":"debug","z":"41ff3755.b19ca8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1270,"y":460,"wires":[]},{"id":"406bacff.fb36f4","type":"change","z":"41ff3755.b19ca8","name":"Headers","rules":[{"t":"set","p":"headers.accept","pt":"msg","to":"application/json","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":460,"wires":[["f8d927bc.098648"]]},{"id":"f8d927bc.098648","type":"DataOut","z":"41ff3755.b19ca8","collection":"34b6e44b.fe0f8c","name":"","path":"/id","error":false,"x":550,"y":460,"wires":[["e967f770.db7008"]]},{"id":"ab27c427.7efe38","type":"inject","z":"41ff3755.b19ca8","name":"ManualLookup","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":460,"wires":[["406bacff.fb36f4"]]},{"id":"b8875dd7.3aa7d","type":"delay","z":"41ff3755.b19ca8","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":880,"y":380,"wires":[["dbb73823.64c108","406bacff.fb36f4"]]},{"id":"72903cc2.eec954","type":"inject","z":"41ff3755.b19ca8","name":"ManualLogin","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":380,"wires":[["f32a76b4.272368"]]},{"id":"dbb73823.64c108","type":"debug","z":"41ff3755.b19ca8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1230,"y":380,"wires":[]},{"id":"f32a76b4.272368","type":"template","z":"41ff3755.b19ca8","name":"LogonTemplate","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":" {\n \"userid\": \"TIBA\",\n \"password\": \"Park2021!\"\n }","output":"json","x":320,"y":380,"wires":[["febc37ac.441e58"]]},{"id":"febc37ac.441e58","type":"json","z":"41ff3755.b19ca8","name":"","property":"payload","action":"","pretty":false,"x":470,"y":380,"wires":[["560a14df.b0120c"]]},{"id":"c7353195.7fb7c","type":"json","z":"41ff3755.b19ca8","name":"","property":"payload","action":"","pretty":true,"x":730,"y":380,"wires":[["b8875dd7.3aa7d"]]},{"id":"560a14df.b0120c","type":"http request","z":"41ff3755.b19ca8","name":"LoginURL","method":"POST","ret":"txt","paytoqs":"query","url":"http://localhost:1880/listenerp","tls":"","persist":false,"proxy":"","authType":"","x":600,"y":380,"wires":[["c7353195.7fb7c"]]},{"id":"70fa72d.5a8628c","type":"http request","z":"41ff3755.b19ca8","name":"Lookup","method":"POST","ret":"txt","paytoqs":"query","url":"http://localhost:1880/listenerp1","tls":"","persist":false,"proxy":"","authType":"","x":1020,"y":460,"wires":[["66b3b782.6963d8","ee0ca639.a17ad8"]]},{"id":"e967f770.db7008","type":"template","z":"41ff3755.b19ca8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n \"actions\":[\n {\n \"method\": \"mark\",\n \"params\": {\n \"ticket_number\": \"{{payload.visualid}}\"\n }\n } \n ],\n \"set\":{\"Options::performance_ids\": \"\", \"Options::marking_options\": \"status\"},\n \"get\":[\"Result\"],\n \"objectname\": \"myticket\"\n}","output":"str","x":700,"y":460,"wires":[["1bacebec.6dec84"]]},{"id":"1bacebec.6dec84","type":"json","z":"41ff3755.b19ca8","name":"","property":"payload","action":"","pretty":true,"x":870,"y":460,"wires":[["70fa72d.5a8628c"]]},{"id":"ee0ca639.a17ad8","type":"http request","z":"41ff3755.b19ca8","name":"LogoffURL","method":"POST","ret":"txt","paytoqs":"ignore","url":"http://localhost:1880/listnerpl","tls":"","persist":false,"proxy":"","authType":"","x":510,"y":540,"wires":[["855c22e2.72cf9"]]},{"id":"855c22e2.72cf9","type":"json","z":"41ff3755.b19ca8","name":"","property":"payload","action":"","pretty":false,"x":650,"y":540,"wires":[["ce0c774a.eb7fb8"]]},{"id":"ce0c774a.eb7fb8","type":"debug","z":"41ff3755.b19ca8","name":"LogOffLog","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":990,"y":540,"wires":[]},{"id":"d9016124.c920c","type":"inject","z":"41ff3755.b19ca8","name":"ManualLogoff","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":540,"wires":[["ee0ca639.a17ad8"]]},{"id":"28582da.8b05dd2","type":"http in","z":"41ff3755.b19ca8","name":"PostListener","url":"/listenerp1","method":"post","upload":true,"swaggerDoc":"","x":150,"y":140,"wires":[["89518937.822028"]]},{"id":"f8792e9b.85569","type":"debug","z":"41ff3755.b19ca8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":40,"wires":[]},{"id":"eaad1620.b8e128","type":"http response","z":"41ff3755.b19ca8","name":"","statusCode":"200","headers":{},"x":620,"y":140,"wires":[]},{"id":"89518937.822028","type":"template","z":"41ff3755.b19ca8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"version\":\"7.42.1\",\"session\":\"186816AE-D88F-4778-967D-4697FE7408B0\"}","output":"str","x":320,"y":140,"wires":[["1f0712fa.d8714d"]]},{"id":"1f0712fa.d8714d","type":"json","z":"41ff3755.b19ca8","name":"","property":"payload","action":"","pretty":false,"x":470,"y":140,"wires":[["eaad1620.b8e128","f8792e9b.85569"]]},{"id":"f549cec6.48f27","type":"http in","z":"41ff3755.b19ca8","name":"PostListener","url":"/listenerp11","method":"post","upload":true,"swaggerDoc":"","x":190,"y":280,"wires":[["7d6d6841.125698"]]},{"id":"2625bb99.afffb4","type":"debug","z":"41ff3755.b19ca8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":180,"wires":[]},{"id":"7b0f1f51.4af84","type":"http response","z":"41ff3755.b19ca8","name":"","statusCode":"200","headers":{},"x":660,"y":280,"wires":[]},{"id":"7d6d6841.125698","type":"template","z":"41ff3755.b19ca8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n \"version\": \"7.42.1\",\n \"session\": \"3E62F34B-4B9E-49C7-95D6-50A6BC89D5DB\",\n \"data\": {\n \"Result\": {\n \"state\": \"0\",\n \"colour\": {\n \"standard\": \"#FF0000\",\n \"input\": \"#FF0000\",\n \"display\": \"#FF0000\"\n },\n \"mark_result\": {\n \"standard\": \"The ticket number does not exist.\",\n \"input\": \"The ticket number does not exist.\",\n \"display\": \"The ticket number does not exist.\"\n },\n \"mark_cancel_reason\": {\n \"standard\": \"\",\n \"input\": \"\",\n \"display\": \"\"\n },\n \"result_code\": {\n \"standard\": \"5275\",\n \"input\": \"5275\",\n \"display\": \"5275\"\n }\n }\n },\n \"return\": [\n {\n \"method\": \"mark\",\n \"message\": \"\"\n }\n ]\n}","output":"str","x":360,"y":280,"wires":[["8136370f.275028"]]},{"id":"8136370f.275028","type":"json","z":"41ff3755.b19ca8","name":"","property":"payload","action":"","pretty":false,"x":510,"y":280,"wires":[["7b0f1f51.4af84","2625bb99.afffb4"]]},{"id":"ceff341e.234628","type":"http in","z":"41ff3755.b19ca8","name":"PostListener","url":"/listenerpl","method":"post","upload":true,"swaggerDoc":"","x":930,"y":260,"wires":[["5bbfe558.0aac5c"]]},{"id":"98443f18.59563","type":"debug","z":"41ff3755.b19ca8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1510,"y":200,"wires":[]},{"id":"6848947e.7f1f7c","type":"http response","z":"41ff3755.b19ca8","name":"","statusCode":"200","headers":{},"x":1400,"y":260,"wires":[]},{"id":"5bbfe558.0aac5c","type":"template","z":"41ff3755.b19ca8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n \"version\": \"7.42.1\",\n \"session\": \"A8894AF9-9768-4FAD-96DA-96D632D9BE3E\"\n}","output":"str","x":1100,"y":260,"wires":[["e888e7b7.1695f8"]]},{"id":"e888e7b7.1695f8","type":"json","z":"41ff3755.b19ca8","name":"","property":"payload","action":"","pretty":false,"x":1250,"y":260,"wires":[["6848947e.7f1f7c","98443f18.59563"]]},{"id":"34b6e44b.fe0f8c","type":"json-db-collection","z":"","name":"request","collection":"request","save":true}]