Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 获取错误:使用节点soap时getaddrinfo ENOTFOUND_Node.js_Web Services_Soap - Fatal编程技术网

Node.js 获取错误:使用节点soap时getaddrinfo ENOTFOUND

Node.js 获取错误:使用节点soap时getaddrinfo ENOTFOUND,node.js,web-services,soap,Node.js,Web Services,Soap,我有一个SOAP web服务,我需要从node.js应用程序中读取它,并决定使用它 当我使用SOAP客户端时,web服务可以工作,但我无法让它在node.js应用程序上工作。我收到以下错误消息: Error: getaddrinfo ENOTFOUND www.xxxxxxx.intra.com.mt www.xxxxxxx.intra.gov.mt:9011 at errnoException (dns.js:26:10) at GetAddrInfoReqWrap.onloo

我有一个SOAP web服务,我需要从node.js应用程序中读取它,并决定使用它

当我使用SOAP客户端时,web服务可以工作,但我无法让它在node.js应用程序上工作。我收到以下错误消息:

Error: getaddrinfo ENOTFOUND www.xxxxxxx.intra.com.mt www.xxxxxxx.intra.gov.mt:9011
    at errnoException (dns.js:26:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)
奇怪的是,实际的URL是www.xxxxxx.com.mt,没有内部部分。我不明白为什么这里的表现不同

下面是我正在使用的代码

var url = 'https://www.xxxxxxxx.gov.mt/wsRPS.asmx?WSDL';    

  soap.createClient(url, function(err, client){
     //client.addSoapHeader(soapHeader);
    //
    var args = {
      from: "2016-03-01T11:00:00",
      to: "2016-03-03T11:00:00"
    };

    client.GetInformation(args, function(err, result){
     if(err){
       throw err;
     }
     console.log(result);
    });
  });

有什么想法吗?谢谢

您需要提供客户端端点:

const url = 'https://www.xxxxxxxx.gov.mt/wsRPS.asmx';

soap.createClient(`${url}?wsdl`, (err, client) => {

    // here
    client.setEndpoint(url);

    const args = {
      from: "2016-03-01T11:00:00",
      to: "2016-03-03T11:00:00"
    };

    client.GetInformation(args, (err, result) => {
        if(err){
           throw err;
        }
        console.log(result);
    });

});

我得到一个类似的错误,指示getaddrinfo。您的解决方案无法工作,因为“client”的值未定义。因此,无法执行未定义的。setEndpoint(..)您救了我一天,我遇到了以下错误:```{error:getaddrinfo ENOTFOUND Guianett Guianett:443 at GetAddrInfoReqWrap.onlookup[as oncomplete](dns.js:67:26)errno:'ENOTFOUND',code:'ENOTFOUND',syscall:'getaddrinfo',主机名:'Guianett',主机:'Guianett',端口:443}“一岁的qn。你找到解决方案了吗?没有,还没有解决方案-我最终用PHP做了这个。。。我没有发现使用NodeJS进行soap的任何运气(也不是为它而构建的)。。。我很乐意尝试任何推荐的解决方案。