得到错误:"找到了意外的包装元素"尝试调用webservice函数时webservice使用WSSecurityCert

时间:2016-08-05 16:06:30

标签: web-services meteor soap ws-security node-soap

我正在使用meteor.js。我试图调用使用WSSecurityCert的Web服务的函数。 我使用openssl创建了一个签名密钥对,并将公钥发送给服务器管理员,以便将它们包含在密钥库中,他们说这些密钥库就是这样做的。他们还向我发送了他们的公钥,但我不知道在我的代码或应用程序中包含它的位置。

我的代码如下:

if (Meteor.isServer) {
Meteor.methods({
    getVouchers: function(){

        var fs = Npm.require('fs');
        var soap = Npm.require('soap');
        Npm.require('ursa');
        var base = process.env.PWD;

        var publicKey = fs.readFileSync(base + "/cert.pem", "utf8");
        var privateKey = fs.readFileSync(base + "/key.pem", "utf8");
        var password = "myPassPhrase";

        var url = 'http://www.smartcallesb.co.za:8091/SmartcallServices2/SmartloadService?wsdl';

        try
        {
            var wsSecurity = new soap.WSSecurityCert(privateKey, publicKey, password, 'utf8');
            var client = Soap.createClient(url);
            client.setSecurity(wsSecurity);
            //var result = client.SmartloadService.SmartloadServicePort.getDealerBalance(); //getAllNetworks
            var result = client.getDealerBalance();
            console.log(result)
        }
        catch (err)
        {
            console.log(err)
        }
        console.log("reached end")

    }
});}

运行时出现以下错误:

{ [Error: Soap method call failed [soap-method]]
error: 'soap-method',
reason: 'Soap method call failed',
reason: 'Soap method call failed',
details:
{ [Error: soap:Client: Unexpected wrapper element getDealerBalance found. 
Expected {http://www.smartcall.co.za/2010/12/service}getDealerBalance.]
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy requirement
/200702}AsymmetricBinding: The transform algorithms do not match the
requirement.....

这可能是因为服务器管理员发送给我的主机公钥不包含在我的应用程序中,如果是这样,我在哪里包含它?或者,我该如何修复/更正此问题?

0 个答案:

没有答案