从Firebase云调用Soap服务函数错误

从Firebase云调用Soap服务函数错误,firebase,soap,google-cloud-functions,Firebase,Soap,Google Cloud Functions,我想从firebase云函数调用soap服务url 我已经启用了计费,并且可以从我的云函数调用其他api 我可以在postman上调用这个soap函数,它可以工作。 但是,从我的云函数调用它会产生以下错误 XMLHttpRequest错误: "Message": "Error: connect ECONNREFUSED 127.0.0.1:80\n at Object.exports._errnoException (util.js:1020:11)\n at exports._e

我想从firebase云函数调用soap服务url

  • 我已经启用了计费,并且可以从我的云函数调用其他api

  • 我可以在postman上调用这个soap函数,它可以工作。

  • 但是,从我的云函数调用它会产生以下错误

    XMLHttpRequest错误:

    "Message": "Error: connect ECONNREFUSED 127.0.0.1:80\n    at Object.exports._errnoException (util.js:1020:11)\n    at exports._exceptionWithHostPort (util.js:1043:20)\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1105:14)"
    
    代码

      var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
            var xmlhttp = new XMLHttpRequest();
    
            //replace second argument with the path to your Secret Server webservices
            xmlhttp.open('POST', 'xxxxx/SiloFunctions.asmx');
    
            //create the SOAP request
            var sr =
                '<soapenv:Envelope ' +
                'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
                'xmlns:xsd="http://www.w3.org/2001/XMLSchema"' +
                'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' +
                '<soap:Body>' +
                '<Request xmlns="http://tempuri.org/">' +
                '<Password>xxxx</Password>' +
                '<Latitude>123</Latitude>' +
                '<Longitude>123</Longitude>' +
                '<ClientName>123</ClientName>' +
                '<ClientSurname>123</ClientSurname>' +
                '<MSISDN>123123</MSISDN>' +
                '</Request>' +
                '</soap:Body>' +
                '</soapenv:Envelope>';
    
    
            //specify request headers
            xmlhttp.setRequestHeader('Content-Type', 'text/xml; charset=utf-8');
    
            //FOR TESTING: display results in an alert box once the response is received
            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState == 4) {
                    res.status(200).send(
                        {
                            "Message": xmlhttp.responseText,
                        })
                }
            };
    
            //send the SOAP request
            xmlhttp.send(sr);
    
    var XMLHttpRequest=require(“XMLHttpRequest”).XMLHttpRequest;
    var xmlhttp=new XMLHttpRequest();
    //将第二个参数替换为机密服务器Web服务的路径
    open('POST','xxxxx/SiloFunctions.asmx');
    //创建SOAP请求
    var sr=
    '' +
    '' +
    '' +
    “xxxx”+
    '123' +
    '123' +
    '123' +
    '123' +
    '123123' +
    '' +
    '' +
    '';
    //指定请求头
    setRequestHeader('Content-Type','text/xml;charset=utf-8');
    //对于测试:收到响应后,在警报框中显示结果
    xmlhttp.onreadystatechange=函数(){
    if(xmlhttp.readyState==4){
    资源状态(200)。发送(
    {
    “消息”:xmlhttp.responseText,
    })
    }
    };
    //发送SOAP请求
    xmlhttp.send(sr);
    

    Whyyyyyy?

    您应该使用完整的URL,而不是部分URL。它可能以https://开头。因为您没有使用它,所以您使用的HTTP库假定为localhost(127.0.0.1),这显然不起作用。

    您使用哪种付款计划?免费的“Spark”计划只允许向谷歌拥有的服务发送出站网络请求。你需要参加“火焰”或“火焰”计划。是的,我在Blaze
    xxxxx
    这里有点重要。你能告诉我你在里面放了什么吗?@DougStevenson那应该是someUrl.com/API/SiloFunctions.asmxIs这就是它的格式吗?就是这样。谢谢(作为奖励,他们在http://而不是https://上运行它,所以这也被阻止了。