我正在使用nodejs soap模块来调用fedex服务,但是得到一个错误:
原文链接:https://www.f2er.com/php/140219.html{ "HighestSeverity": "ERROR","Notifications": [ { "Severity": "ERROR","Source": "prof","Code": "1000","Message": "Authentication Failed" } ],"Version": { "ServiceId": {},"Major": {},"Intermediate": {},"Minor": {} } }
下面是我的nodejs代码:
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,result) { if (err)throw err; res.send(result); }); });
但是当我发送这个数据在PHP下面一个,那么它的工作.
$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);