Node-red-contrib-soap 401 - Unauthorized: Access

Dear All,

i am trying to get a response from a web Service using the node-red-contrib-soap node. I succesfully got a response from the service using the SoapUI 5.5. tool.
I set up the bellow flow

[{"id":"60927358.4d0a1c","type":"inject","z":"4d3dba4b.961914","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":170,"y":1400,"wires":[["9f735a1e.9d5c38"]]},{"id":"9f735a1e.9d5c38","type":"function","z":"4d3dba4b.961914","name":"SOAP Params","func":"var newmsg={\n //server:"https://wsgateway.sacmi.it/WsSistemiOlfattivi/service1.asmx",\n options:{},\n headers:{\n 'Content-Type': 'application/soap+xml;charset=UTF-8'\n },\n payload:{\n "plantId":1,\n "nHoursAgo":1\n }\n \n};\nreturn newmsg;","outputs":1,"noerr":0,"x":360,"y":1340,"wires":[["92bbe16b.3d12"]]},{"id":"ca4c7c6f.59f0b","type":"debug","z":"4d3dba4b.961914","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":850,"y":1340,"wires":},{"id":"92bbe16b.3d12","type":"soap request","z":"4d3dba4b.961914","name":"","topic":"","wsdl":"af1fd7ca.a510f8","method":"GetMeasureData","x":580,"y":1440,"wires":[["ca4c7c6f.59f0b"]]},{"id":"af1fd7ca.a510f8","type":"soap-config","z":"","wsdl":"https://wsgateway.sacmi.it/WsSistemiOlfattivi/service1.asmx","auth":"1","user":"SACMI\ManteAnd","pass":"6iQX9c3zDK5s","key":"","cert":"","token":""}]

I am getting the following repsonse

WSDL Config Error: Error: Invalid WSDL URL: https://wsgateway.sacmi.it/WsSistemiOlfattivi/service1.asmx?wsdl

Code: 401

Response Body:

401 - Unauthorized: Access is denied due to invalid credentials. <!-- body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;} fieldset{padding:0 15px 10px 15px;} h1{font-size:2.4em;margin:0;color:#FFF;} h2{font-size:1.7em;margin:0;color:#CC0000;} h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} #header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF; background-color:#555555;} #content{margin:0 0 0 2%;position:relative;} .content-container{background:#FFF;wi...

Any advise is more than welcome......

PS.: node version v6.14.3
node-red version 0.18.4

First things first to start with. Your flow can't be imported, due to the forum software mangling some characters. Please read How to share code or flow json to see how to export it properly

Second, I'm not sure why exactly it is failing. A 401 suggests the credentials for logging in have been wrong, but the node you're using isn't properly utilising the Credentials aspect, so the username and password have been pasted in a readable format in your reply. Since this looks corporate, I'd suggest changing your password ASAP. It did however give me the chance to test if there was an error there, and since it returned okay I'd say the problem wasn't there.

Thirdly, what hardware are you running on, and is there a reason you're using such old versions of Node-RED and NodeJS. I'm not saying it's related, but it might be.

I think I do have an answer for your issue, and it can be found in the README of the node you are using:

(source: https://github.com/chameleonbr/node-red-contrib-soap#readme ; bolding is my addition)
While I can not say for sure if this caused it as I can't import your flow, it appears that you are overriding the address with msg.server in your function node. The address you're trying to override it with is identical to the one in your config node. Meaning this isn't useful on one hand, and is also resulting in that the auth from the config node appears to be ignored. See first if you can get it to work without the function node, by manually specifying things like method name in the soap-request node. If that works, go back to the function node to create a more dynamic version if needed. If it doesn't work with the soap-request directly either, file an issue on the node's Github page.

@trinitry
Please keep your initial response in the topic so others can read along running into the same or similar problem.

I redacted the flow you sent me in DM from username/password, and added it below.

[{"id":"60927358.4d0a1c","type":"inject","z":"4d3dba4b.961914","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":170,"y":1400,"wires":[["9f735a1e.9d5c38","92bbe16b.3d12"]]},{"id":"ca4c7c6f.59f0b","type":"debug","z":"4d3dba4b.961914","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":850,"y":1340,"wires":[]},{"id":"92bbe16b.3d12","type":"soap request","z":"4d3dba4b.961914","name":"","topic":"","wsdl":"af1fd7ca.a510f8","method":"GetMeasureData","x":470,"y":1440,"wires":[["ca4c7c6f.59f0b"]]},{"id":"af1fd7ca.a510f8","type":"soap-config","z":"","wsdl":"https://wsgateway.sacmi.it/WsSistemiOlfattivi/service1.asmx?wsdl","auth":"3","user":"<redacted username>","pass":"<redacted password>","key":"","cert":"","token":""}]

Sorry for not sharing the flow properly,

[{"id":"60927358.4d0a1c","type":"inject","z":"4d3dba4b.961914","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":170,"y":1400,"wires":[["9f735a1e.9d5c38","92bbe16b.3d12"]]},{"id":"ca4c7c6f.59f0b","type":"debug","z":"4d3dba4b.961914","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":850,"y":1340,"wires":[]},{"id":"92bbe16b.3d12","type":"soap request","z":"4d3dba4b.961914","name":"","topic":"","wsdl":"af1fd7ca.a510f8","method":"GetMeasureData","x":470,"y":1440,"wires":[["ca4c7c6f.59f0b"]]},{"id":"af1fd7ca.a510f8","type":"soap-config","z":"","wsdl":"https://wsgateway.sacmi.it/WsSistemiOlfattivi/service1.asmx?wsdl","auth":"3","user":"<redacted username>","pass":"<redacted password>","key":"","cert":"","token":""}]

now it should be okey, i try to use it without the function node, but i still get the same response of 401 error code.
i follow the aforementioned advise without success, any ideas?
Could we confirmed that this is an error related to the specific node?
Regarding the versions, i am using node with node-red in an embedded device and is a bit tricky to follow the latest releases.

Thank you for your support