Reputation: 9
Am trying to sign the XML using my private key, and using SOAPUI it gives the proper success response.
to generate the request am using below code
var Authorization = 'Basic ' + new Buffer((sapConfig.sap.username + ':' + sapConfig.sap.password) || '').toString('base64'); soap.createClient(__dirname + '/wsdl/SI_CARWORKZ_Customer_Sen_Sync.wsdl', wsdlOptions, function (err, client) { client.setSecurity(new soap.WSSecurityCert(privateKey, publicKey, password, 'utf8')); //client.setSecurity(new soap.ClientSSLSecurity(privateKey, publicKey, ca)); client.SI_CARWORKZ_Customer_Sen_Sync(details, sslOptions, function(err, result, raw, soapHeader) { console.log('%j', result); if(_.has(result, "ResponseData") && !_.isEmpty(result.ResponseData.Item)){ var status = _.pluck(result.ResponseData.Item, "Status"); if(status.indexOf('E') != -1){ return callback({status: "error", data: result}); }else{ // insert the user in mongodb sapLogs.insertCustomers(details.HEADER, function(result){ console.log("customer added"); return callback({status: "success", data: details}); }) } }else{ return callback({status: "error", data: [], message: "something went wrong." }) } }, {"Authorization": Authorization}); });
But when am sending the signed xml data using the script it shows me error
Error while validating the digital signature. The error was java.lang.NullPointerException while trying to invoke the method com.sap.security.core.ws.wss.tokens.securitytoken.BinarySecurityToken.getSecurityToken()
Is there any issue with my public key or private key?
I have exported them from jks file which is used in SOAPUI.
Upvotes: 1
Views: 1083