in alexa/lambda/lib/functions/aws-sap-alexa-scp-solo/index.js [39:69]
async handle(handlerInput) {
var speakOutput = 'Error getting user details. Please check logs'
try{
var path = '/sap/bc/soap/rfc'
var body = require('./rfcrequest.js')
var response = await getDataFromSAP(handlerInput,path,'POST',body,null,'text/xml')
console.log('response is', response.body)
parser.parseString(response.body,(parserError,result)=>{
if(parserError){
console.log('Error in parsing ', parserError)
}else{
try{
console.log('Result is ', JSON.stringify(result))
const userId = result['SOAP-ENV:Envelope']['SOAP-ENV:Body'][0]['urn:ME_GET_CURRENT_USER_ID.Response'][0]['USERNAME'][0]
console.log('User ID is ', userId)
speakOutput = 'Your user name is ' + userId
}catch(err){
console.log('Error in getting the result is ', err)
}
}
})
}catch(e){
console.log('Error is ', e.message)
}
return handlerInput.responseBuilder
.speak(speakOutput)
.reprompt(speakOutput)
.getResponse();
}