我一直在尝试使用肥皂消息从 Arangodb 获取查询结果到我的前端服务(Angular 4)。我能够获得查询结果,但在 console.log 中打印出来。但是我怎样才能在这个函数(myService)下得到它呢?
换句话说,如何将查询结果输入到函数中,而不是在控制台中打印结果。这样我就可以使用这个函数来获取查询的输出?
我也使用了 .then() 来获得承诺。我还缺少什么?
服务器.js
var myService = db.query(aqlQuery`
LET startVertex = (FOR doc IN spec
FILTER doc.serial_no == '"123456abcde"'
LIMIT 2
RETURN doc
)[0]
FOR v IN 1 ANY startVertex belongs_to
RETURN v.ip`,
{
bindVar1: 'value',
bindVar2: 'value',
})..then(function(res) {
console.log("documents:" + res._result);
})
我想将函数提供给soap msg并接收它Angular 4,
soap msg
var soap_msg = '<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:examples:CheckUserNameService">' +
'<soapenv:Header/>' +
'<soapenv:Body>' +
'<urn:CheckUserNameResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">' +
'<status xsi:type="xsd:string">' + (myService) + '</status>' +
'</urn:CheckUserNameResponse>' +
'</soapenv:Body>' +
'</soapenv:Envelope>';
var server = http.createServer(function(request,response) {
response.end(soap_msg);
});
var port = 8000;
server.listen(port);
var soapServer = soap.listen(server, '/test', myService, xml);
但如果我使用 JSON.stringify,输出要么是空大括号,要么是 [object Promise]。我在这里做错了什么?
output
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)