用JavaScript调用SOAP

时间:2017-10-29 06:39:46

标签: javascript python soap

我是JavaScript新手。我已经为SOAP请求编写了一个Python代码,如何在JavaScript中实现这一点?

下面是我的Python代码。

client = Client(url='url1', location='url')
security = Security()
token = UsernameToken('api_username', 'api_password')
security.tokens.append(token)
client.set_options(wsse=security)

1 个答案:

答案 0 :(得分:0)

你试过this js包吗?

作为doc中的一个简单示例:

let soap = require('soap');
let url = 'http://example.com/wsdl?wsdl';
let args = {
    name: 'value'
};

soap.createClientAsync(url)
    .then((client) => {
        return client.MyFunctionAsync(args);
    })
    .then((result) => {
        console.log(result);
    });