I’m trying to call a soap webservice using the ‘soap’ module in my Vue SPA, but I get this error just by importing the module. I already searched a lot but didn’t find a solution.
My code:
// /src/services/soapService.js
import soap from 'soap';
var soapService = {
users: {
getAllUsers() {
const url = 'http://127.0.0.2:8000/?wsdl'
soap.createClient(url, function(err, client) {
client.getAllUsers(function(err, result) {
console.log(result);
})
})
}
}
}
export default soapService;
Then I call my function in a Vue component:
<template>
<div></div>
</template>
<script>
import soapApi from '@/services/soapService'
export default {
name: 'Users',
methods: {
getAllUsers() {
this.allUsers = soapApi.users.getAllUsers();
}
},
mounted() {
this.getAllUsers();
}
}
</script>
When I try to load the Users.vue component, I get this error:
TypeError: The "original" argument must be of type Function
at promisify (util.js?3022:602)
at eval (index.js?4f62:7)
at Object.../node_modules/get-stream/index.js (0.js:529)
at __webpack_require__ (app.js:854)
at fn (app.js:151)
at eval (client.js?e3c8:24)
at Object.../node_modules/soap/lib/client.js (0.js:586)
at __webpack_require__ (app.js:854)
at fn (app.js:151)
at Object.eval (soap.js?3fc0:19)
abort @ vue-router.esm.js?8c4f:2316
eval @ vue-router.esm.js?8c4f:2369
eval @ vue-router.esm.js?8c4f:2138
eval @ vue-router.esm.js?8c4f:2203
Promise.then (async)
eval @ vue-router.esm.js?8c4f:2150
eval @ vue-router.esm.js?8c4f:2171
eval @ vue-router.esm.js?8c4f:2171
flatMapComponents @ vue-router.esm.js?8c4f:2170
eval @ vue-router.esm.js?8c4f:2106
iterator @ vue-router.esm.js?8c4f:2362
step @ vue-router.esm.js?8c4f:2004
step @ vue-router.esm.js?8c4f:2008
step @ vue-router.esm.js?8c4f:2008
step @ vue-router.esm.js?8c4f:2008
runQueue @ vue-router.esm.js?8c4f:2012
confirmTransition @ vue-router.esm.js?8c4f:2392
transitionTo @ vue-router.esm.js?8c4f:2260
push @ vue-router.esm.js?8c4f:2715
push @ vue-router.esm.js?8c4f:3037
handler @ vue-router.esm.js?8c4f:1139
invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1863
invoker @ vue.runtime.esm.js?2b0e:2188
original._wrapper @ vue.runtime.esm.js?2b0e:6961
Node v16.11.1
npm v8.1.3
vue v2.6.11