我不确定这是否是 node-soap 错误,或者是否有我忽略的东西,但配置选项生成的输入在 SoapUI 中运行良好。但是,当我通过 Chrome 通过 param_resoureid 访问路由器链接时,它只是显示一个空白屏幕。
ppmRouter.get("/get_time_sheet",(req,res,next) => {
var resourceid = req.query.param_resourceid
var soap = require('soap');
var url = config.wsdlObjectPath + "TimePeriods"
var sheader = { "Auth": {Username: config.xog_user, Password: config.password}}
var args = {
":NikuDataBus": {
":Header":{
attributes: {
version: "6.0.11",
action: "read",
objectType: "timeperiod",
externalSource: "NIKU"
}
},
":Query": {
":Filter": {
attributes: {
name: "resourceID",
criteria: "EQUALS"
},
$value: resourceid
}
}
}
};
var wsdlOptions = {
overrideRootElement: {
namespace: 'tns',
xmlnsAttributes: []
}
};
soap.createClient(url, wsdlOptions, function(err, client) {
client.addSoapHeader(sheader,"","","");
client.setEndpoint(config.xog_url)
client.ReadTimeperiod(args,(error,result)=>{
console.log(client.lastRequest)
if (error) throw error;
console.log(result)
res.send(result)
})
});
})