# Soap Server on Node-Red

**URL:** <https://discourse.nodered.org/t/soap-server-on-node-red/50907>\
**Category:** General\
**Created:** [12 September 2021 00:59 UTC](https://discourse.nodered.org/t/soap-server-on-node-red/50907 "2021-09-12T00:59:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aderici](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/aderici/32/37279_2.png) [@aderici](https://discourse.nodered.org/u/aderici)\
**Post date:** [12 September 2021 00:59 UTC](https://discourse.nodered.org/t/soap-server-on-node-red/50907/1 "2021-09-12T00:59:05Z")

</div>

Hi, i'd like to build a soap server based on node-red. While there are existing contrib nodes, they all target opening an additional port for soap server. I'm looking for a way to create a soap server and having it in the same port as node-red like mounting it into the express somehow. Interested in using node-soap library for this. Do you think it's possible?

Best regards,

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [12 September 2021 10:30 UTC](https://discourse.nodered.org/t/soap-server-on-node-red/50907/2 "2021-09-12T10:30:23Z")

</div>

So SOAP doesn't specify a port requirement, people generally implement it over their standard web ports (443) but it doesn't really care.

I've not looked at any of the existing nodes however the first node.js module I found certainly supports the use of an existing ExpressJS app server so it seems eminently possible to achieve.

> **[soap](https://www.npmjs.com/package/soap)**
>
> A minimal node SOAP client

Unfortunately, you will either have to persuade one of the authors of those nodes to code a change, write your own wrapper for a node.js module or try to use the module in a function node.

* * *

A bonus for those who don't know what SOAP is:

[https://www.soapui.org/learn/api/soap-vs-rest-api/](https://www.soapui.org/learn/api/soap-vs-rest-api/)

---

<div class="post-metadata">

**Author:** ![aderici](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/aderici/32/37279_2.png) [@aderici](https://discourse.nodered.org/u/aderici)\
**Post date:** [12 September 2021 10:33 UTC](https://discourse.nodered.org/t/soap-server-on-node-red/50907/3 "2021-09-12T10:33:30Z")

</div>

Thanks for the information. I noticed soap npm module supports this. I’d rather want to do this in a function node, i have exposed node-red module and soap over global context and trying to get it to work but i’m not sure how to do that. Any idea how to get the existing express in node red and mount a soap server in a sub route using function node?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [12 September 2021 10:45 UTC](https://discourse.nodered.org/t/soap-server-on-node-red/50907/4 "2021-09-12T10:45:05Z")

</div>

> [@aderici](#):
>
> Any idea how to get the existing express in node red and mount a soap server in a sub route using function node?

Hmm, I hadn't thought about that. I don't think you can. It isn't that hard to write a custom node - though from a standing start it is a fairly steep learning curve. If you do go down that route. I have a `jktesting` repo on Github that contains a `jktest2` node with what I think is a more comprehensible layout for a nodes .js file. Also my uibuilder node contains extensive examples of using Node-RED's ExpressJS app server though I'm sure there are many other nodes with simpler examples.

---

<div class="post-metadata">

**Author:** ![aderici](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/aderici/32/37279_2.png) [@aderici](https://discourse.nodered.org/u/aderici)\
**Post date:** [13 September 2021 13:13 UTC](https://discourse.nodered.org/t/soap-server-on-node-red/50907/5 "2021-09-13T13:13:06Z")

</div>

For anyone else interested, if you expose node-red through function global context you can achieve it like this through a function node :

nodered.server = soap.listen(nodered.server, options, myService, wsdl, function() {  
node.warn('service initialized');  
});

within the options you define path to mount your server

---

<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:** [12 November 2021 13:13 UTC](https://discourse.nodered.org/t/soap-server-on-node-red/50907/6 "2021-11-12T13:13:09Z")

</div>

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