I am using nodejs soap module to call fedex services but getting an error:
{
"HighestSeverity": "ERROR",
"Notifications": [
{
"Severity": "ERROR",
"Source": "prof",
"Code": "1000",
"Message": "Authentication Failed"
}
],
"Version": {
"ServiceId": {},
"Major": {},
"Intermediate": {},
"Minor": {}
}
}
Below is my nodejs code:
var data = {};
data["WebAuthenticationDetail"] = {
"UserCredential": {
"Key": developer_key,//getProperty('key');
"Password": password
}
};
//console.log(JSON.stringify(data));
data['ClientDetail'] = {
'AccountNumber': account_number,//getProperty('shipaccount');
'MeterNumber': meter_number//getProperty('meter');
};
data['Version'] = {
'ServiceId': 'crs',
'Major': 14,
'Intermediate': 0,
'Minor': 0
};
var soap = require('soap');
var path = require('path');
var path_to_wsdl = path.resolve(__dirname + '/wsdl/RateService_v14.wsdl');
soap.createClient(path_to_wsdl, function (err, client) {
if (err)throw err;
client.getRates(data, function (err, result) {
if (err)throw err;
res.send(result);
});
});
But when i am sending this data with php below one then it's working.
$path_to_wsdl = "wsdl-testing/RateService_v14.wsdl";
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient($path_to_wsdl /*, array('trace' => 1) */);
$request['WebAuthenticationDetail'] = array(
'UserCredential' => array(
'Key' => $developer_key,
'Password' => $password
) );
$request['ClientDetail'] = array(
'AccountNumber' => $account_number,
'MeterNumber' => $meter_number,
);
$request['Version'] = array(
'ServiceId' => 'crs',
'Major' => '14',
'Intermediate' => '0',
'Minor' => '0');
$response = $client -> getRates($request);
Logger::info('here is the response====', $response);
Same code is working in php but not in Nodejs. Please let me know where is the issue?
You could try using the node-shipping-fedex module insterad of using soap directly. https://github.com/typefoo/node-shipping-fedex
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With