Web services 获取错误:";找到意外的包装器元素";尝试调用webservice使用WSSecurityCert的webservice函数时
我正在使用meteor.js。我试图调用使用WSSecurityCert的Web服务的函数。 我使用openssl创建了一个签名密钥对,并将公钥发送给服务器管理员,以便他们将其包含在密钥库中,他们说他们做到了。他们还向我发送了他们的公钥,但我不知道在我的代码或应用程序中包含它的位置 我的代码如下:Web services 获取错误:";找到意外的包装器元素";尝试调用webservice使用WSSecurityCert的webservice函数时,web-services,meteor,soap,ws-security,node-soap,Web Services,Meteor,Soap,Ws Security,Node Soap,我正在使用meteor.js。我试图调用使用WSSecurityCert的Web服务的函数。 我使用openssl创建了一个签名密钥对,并将公钥发送给服务器管理员,以便他们将其包含在密钥库中,他们说他们做到了。他们还向我发送了他们的公钥,但我不知道在我的代码或应用程序中包含它的位置 我的代码如下: if (Meteor.isServer) { Meteor.methods({ getVouchers: function(){ var fs = Npm.require('
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.....
这可能是因为服务器管理员发送给我的主机公钥没有包含在我的应用程序中,如果是,我应该在哪里包含它?否则,我如何修复/更正此问题?感谢Zardak,我在Soap中包括了以下选项var options={ignoredNamespaces:{namespaces:[],override:true}}。感谢Zardak,我包括了以下选项var options=Soap.createClient(url,选项)中的{ignoredNamespaces:{namespaces:[],override:true}}}