ノードモジュールwcf.jsを使用して、ネットで入手可能な多くの例を試しました。しかし、適切な結果を得ることができませんでした。私は以下のURLを使用しています
https://webservice.kareo.com/services/soap/2.1/KareoServices.svc?wsdl
コードの助けを借りて私を説明できる人は誰でも本当に役に立ちます. node.jsでwsdlにアクセスする方法を知りたい
ありがとう。
ノードモジュールwcf.jsを使用して、ネットで入手可能な多くの例を試しました。しかし、適切な結果を得ることができませんでした。私は以下のURLを使用しています
https://webservice.kareo.com/services/soap/2.1/KareoServices.svc?wsdl
コードの助けを借りて私を説明できる人は誰でも本当に役に立ちます. node.jsでwsdlにアクセスする方法を知りたい
ありがとう。
wcf.jsをご覧ください
要するに、次の手順に従うことができます。
npm install wcf.js
次のようにコードを記述します。
コード
var Proxy = require('wcf.js').Proxy;
var BasicHttpBinding = require('wcf.js').BasicHttpBinding;
var binding = new BasicHttpBinding();
//Ensure the proxy variable created below has a working wsdl link that actually loads wsdl
var proxy = new Proxy(binding, "http://YourHost/YourService.svc?wsdl");
/*Ensure your message below looks like a valid working SOAP UI request*/
var message = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:sil='http://YourNamespace'>" +
"<soapenv:Header/>" +
"<soapenv:Body>" +
"<sil:YourMethod>" +
"<sil:YourParameter1>83015348-b9dc-41e5-afe2-85e19d3703f9</sil:YourParameter1>" +
"<sil:YourParameter2>IMUT</sil:YourParameter2>" +
"</sil:YourMethod>" +
"</soapenv:Body>" +
"</soapenv:Envelope>";
/*The message that you created above, ensure it works properly in SOAP UI rather copy a working request from SOAP UI*/
/*proxy.send's second argument is the soap action; you can find the soap action in your wsdl*/
proxy.send(message, "http://YourNamespace/IYourService/YourMethod", function (response, ctx) {
console.log(response);
/*Your response is in xml and which can either be used as it is of you can parse it to JSON etc.....*/
});