NodeJS发送HTTPS SOAP请求

时间:2013-05-11 21:55:41

标签: javascript node.js soap https

我正在尝试使用nodejs在特定的端点发送SOAP请求。

我的请求如下:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://company.com/nse/types">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:Login>
         <!--You have a CHOICE of the next 2 items at this level-->
         <typ:Credential userName="x" password="y"/>
      </typ:Login>
   </soapenv:Body>
</soapenv:Envelope>

我还有 https端点(例如https://hostname.com/box/)和 WSDL 文件。

有人可以告诉我最好的方法吗?我正在查看milewise/node-soap,似乎无法找到进入我所需端点的位置。

1 个答案:

答案 0 :(得分:2)

您可以将端点指定为选项的一部分:

var soap = require( 'soap' );
soap.createClient( ep.wsdl, { endpoint : ep.uri }, function( err, client ) {
   ...
});