# Can't get req/res Info after onvif node call

**URL:** <https://discourse.nodered.org/t/cant-get-req-res-info-after-onvif-node-call/48327>\
**Category:** General\
**Created:** [12 July 2021 16:56 UTC](https://discourse.nodered.org/t/cant-get-req-res-info-after-onvif-node-call/48327 "2021-07-12T16:56:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamessantoya26](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jamessantoya26/32/44822_2.png) [@jamessantoya26](https://discourse.nodered.org/u/jamessantoya26)\
**Post date:** [12 July 2021 16:56 UTC](https://discourse.nodered.org/t/cant-get-req-res-info-after-onvif-node-call/48327/1 "2021-07-12T16:56:46Z")

</div>

Hi guys,

I am trying to resolve the request call that I make in node-red, and I am executing the **onvif-discovery** call to get information from the cameras, but when the node responds, the request information does not exist, and is required to respond to the request.  
(I tried in different ways to pass the request information inside the **msg** , but apparently, it removes the **msg info** )  
PS: I used the **global context of node-red** to save the request information, but I know that it is not the best option and it may be an anti-pattern

**Node-RED version: v1.0.4**

 ![Selection_999(001)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/b/eb132e4b884985ab1596af8611d209159cfe9d23.png)

After execution --- outputs debug nodes

![Selection_999(002)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/0/b06dd9f4facf264e448a7fcc4b03f119adbb5eaf.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 July 2021 17:20 UTC](https://discourse.nodered.org/t/cant-get-req-res-info-after-onvif-node-call/48327/2 "2021-07-12T17:20:15Z")

</div>

What is the contrib node called (full name)? Where did you download it from / install it?

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [12 July 2021 17:30 UTC](https://discourse.nodered.org/t/cant-get-req-res-info-after-onvif-node-call/48327/3 "2021-07-12T17:30:04Z")

</div>

Hey Steve,  
It is about my node-red-contrib-onvif nodes, which have never arrived on npm due to a lack of time.

My discovery node [creates](https://github.com/bartbutenaers/node-red-contrib-onvif-nodes/blob/master/onvif_discovery.js#L102) a new output msg object, so the content of the original input msg is lost. Will need to change that...

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [12 July 2021 17:48 UTC](https://discourse.nodered.org/t/cant-get-req-res-info-after-onvif-node-call/48327/4 "2021-07-12T17:48:46Z")

</div>

The original msg is being over wrtten. You would need to pass the res around the onvif node, using a join node and a couple of change nodes ( this will work with other nodes that overwite msg to.)  
here is an example

```auto
[{"id":"3a93dd69.8093ba","type":"http in","z":"c74669a0.6a34f8","name":"","url":"pass","method":"get","upload":false,"swaggerDoc":"","x":90,"y":2020,"wires":[["5a07664f.e35b7","216b5b20.8e14d4"]]},{"id":"5a07664f.e35b7","type":"change","z":"c74669a0.6a34f8","name":"onvif node simulation","rules":[{"t":"set","p":"payload","pt":"msg","to":"pass variable","tot":"str"},{"t":"delete","p":"req","pt":"msg"},{"t":"delete","p":"res","pt":"msg"},{"t":"set","p":"topic","pt":"msg","to":"onvif","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":2000,"wires":[["a80204cb.33efb"]]},{"id":"216b5b20.8e14d4","type":"change","z":"c74669a0.6a34f8","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"response","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":2040,"wires":[["a80204cb.33efb"]]},{"id":"a80204cb.33efb","type":"join","z":"c74669a0.6a34f8","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":510,"y":2020,"wires":[["340aa201.e4f69e"]]},{"id":"340aa201.e4f69e","type":"change","z":"c74669a0.6a34f8","name":"","rules":[{"t":"move","p":"payload.onvif","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":2120,"wires":[["9f1eb5d4.7c80a8","eb80991e.7c4d38"]]},{"id":"9f1eb5d4.7c80a8","type":"http response","z":"c74669a0.6a34f8","name":"","statusCode":"","headers":{},"x":570,"y":2120,"wires":[]},{"id":"eb80991e.7c4d38","type":"debug","z":"c74669a0.6a34f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":650,"y":2160,"wires":[]},{"id":"958281fe.d2101","type":"inject","z":"c74669a0.6a34f8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":1880,"wires":[["2e3a91eb.958496"]]},{"id":"2e3a91eb.958496","type":"http request","z":"c74669a0.6a34f8","name":"test request","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.1.25:1880/pass","tls":"","persist":false,"proxy":"","authType":"","x":450,"y":1880,"wires":[["832b45bc.f25f88"]]},{"id":"832b45bc.f25f88","type":"debug","z":"c74669a0.6a34f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":1880,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [12 July 2021 18:57 UTC](https://discourse.nodered.org/t/cant-get-req-res-info-after-onvif-node-call/48327/5 "2021-07-12T18:57:02Z")

</div>

@E1cid  
Thanks for providing your workaround! But it was such a minor update to my code, that it was more work to put it on my todo list compared to adapting my code 😉

@jamessantoya26: this should now be fixed when you install the onvif nodes again from my Github repository. Please let me know if it is solved!

Remark: when you specify to get a separate output for every device:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/9/b970bd02b8ff771e4604cd8b1434203d43b934ee.png)

Then I will of course _ **clone** _ the input message for every output message. Otherwise people can get very strange behaviour which is hard to troubleshoot. But I'm not sure whether your input message (containing http request and response objects) will survive such a clone. You will need to test that.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [12 July 2021 18:58 UTC](https://discourse.nodered.org/t/cant-get-req-res-info-after-onvif-node-call/48327/6 "2021-07-12T18:58:44Z")

</div>

> [@BartButenaers](#):
>
> Thanks for providing your workaround! But it was such a minor update to my code,

The workaround was also for other nodes that overwrite msg.

---

<div class="post-metadata">

**Author:** ![jamessantoya26](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jamessantoya26/32/44822_2.png) [@jamessantoya26](https://discourse.nodered.org/u/jamessantoya26)\
**Post date:** [12 July 2021 19:14 UTC](https://discourse.nodered.org/t/cant-get-req-res-info-after-onvif-node-call/48327/7 "2021-07-12T19:14:32Z")

</div>

Guys, thanks for your quick responses, I really appreciate them..

@BartButenaers I'm going to install the onvif nodes again and I'll test that. thanks a lot! 👍👏

---

<div class="post-metadata">

**Author:** ![jamessantoya26](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jamessantoya26/32/44822_2.png) [@jamessantoya26](https://discourse.nodered.org/u/jamessantoya26)\
**Post date:** [12 July 2021 22:03 UTC](https://discourse.nodered.org/t/cant-get-req-res-info-after-onvif-node-call/48327/8 "2021-07-12T22:03:47Z")

</div>

@BartButenaers Thank you very much, it worked, I have in my message the http request and response objects, I was struggling with that hehe

👏 👏

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 July 2021 22:04 UTC](https://discourse.nodered.org/t/cant-get-req-res-info-after-onvif-node-call/48327/9 "2021-07-26T22:04:30Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
