這篇文章帶給大家的內容是關於nodejs實作webservice的問題分析,有一定的參考價值,有需要的朋友可以參考一下,希望對你有幫助。
函式庫,工具
node-soap
soapui
#建立
注意args裡參數順序##
const soap = require('soap'); let URL = "你的wsdl路径,可以是url或者本地文件"; // 注意参数顺序!!!!!!!!! let args = { key1: val1, key2: val2 }; // promise创建 let client = await soap.createClientAsync(URL); // callback创建 soap.createClient(url, function(err, client) { client.MyFunction(args, function(err, result) { console.log(result); }); });
args = { key1: val1, key2: val2 }
let val2: Array<datatype> = [ { key3: val3 } ]; let args = { key1: val1, key2: val2 }</datatype>
let val2: Array<datatype> = [ { key3: val3 } ]; let args = { key1: val1, key2: { dataType: val2 } }</datatype>
// dataType或namespace prefix在生成xml未声明 let val2: Array<datatype> = [ { key3: val3 } ]; let args = { key1: val1, key2: val2 }</datatype>
let val2: Array<string> = [ val3, val4 ]; let args = { attributes: { 'xmlns:arr': 'http://schemas.microsoft.com/2003/10/Serialization/Arrays' }, key1: val1, key2: { "arr:string": val2 } }</string>
##-火星中加入火星中
########### #################################### ### 上上#####nodejs0####)中實作問題上摘要###n####node
之後閱讀 · 作用內使用 6 分鐘
const soap = require('soap'); let URL = "你的wsdl路径,可以是url或者本地文件"; // 注意参数顺序!!!!!!!!! let args = { key1: val1, key2: val2 }; // promise创建 let client = await soap.createClientAsync(URL); // callback创建 soap.createClient(url, function(err, client) { client.MyFunction(args, function(err, result) { console.log(result); }); });
args = { key1: val1, key2: val2 }
let val2: Array<datatype> = [ { key3: val3 } ]; let args = { key1: val1, key2: val2 }</datatype>
let val2: Array<datatype> = [ { key3: val3 } ]; let args = { key1: val1, key2: { dataType: val2 } }</datatype>
// dataType或namespace prefix在生成xml未声明 let val2: Array<datatype> = [ { key3: val3 } ]; let args = { key1: val1, key2: val2 }</datatype>
let val2: Array<string> = [ val3, val4 ]; let args = { attributes: { 'xmlns:arr': 'http://schemas.microsoft.com/2003/10/Serialization/Arrays' }, key1: val1, key2: { "arr:string": val2 } }</string>
以上是nodejs實作webservice的問題分析的詳細內容。更多資訊請關注PHP中文網其他相關文章!