0
node-soap을 사용하여 FedEx API에 간단한 요율 요청을하려고합니다. 필자는 필요한 모든 정보를 포함하기 위해 문서와 WSDL을 읽었으나 응답으로 빈 오브젝트 만 얻는다.node-soap을 사용하여 node.js로 FedEx 평가 요청
오류가 발생하지 않았기 때문에 내가 잘못하고 있거나 뭘하고 있는지 잘 모르겠습니다. 여기
내 코드입니다 :var express = require('express');
var app = express();
var port = process.env.PORT || 7000;
var path = require('path');
var soap = require('soap');
var url = path.join(__dirname, 'wsdl', 'RateService_v20.wsdl');
var params = {
WebAuthenticationDetail: {
UserCredential: {
Key: 'the key I was given by FedEx',
Password: 'the password I was given'
}
},
ClientDetail: {
AccountNumber: 'the acc number I was given',
MeterNumber: 'the meter number I was given',
Localization: {
LanguageCode: 'EN'
}
},
Version: {
ServiceId: 'crs',
Major: '20',
Intermediate: '0',
Minor: '0'
},
RateRequest: {
ReturnTransitAndCommit: true,
RequestedShipment: {
DropoffType: 'REGULAR_PICKUP',
PackagingType: 'FEDEX_10KG_BOX',
RateRequestTypes: 'LIST',
PackageCount: '1',
Shipper: {
Contact: {
PersonName: 'Sender Name',
CompanyName: 'Company Name',
PhoneNumber: '5555555555'
},
Address: {
StreetLines: [
'Address Line 1'
],
City: 'Collierville',
StateOrProvinceCode: 'TN',
PostalCode: '38017',
CountryCode: 'US'
}
},
Recipient: {
Contact: {
PersonName: 'Recipient Name',
CompanyName: 'Company Receipt Name',
PhoneNumber: '5555555555'
},
Address: {
StreetLines: [
'Address Line 1'
],
City: 'Charlotte',
StateOrProvinceCode: 'NC',
PostalCode: '28202',
CountryCode: 'US'
}
}
}
}
};
app.get('/describe',function(req,res){
soap.createClient(url, function(err, client) {
if (err) throw err;
res.send(client.describe());
});
});
app.get('/test',function(req,res){
soap.createClient(url, function(err, client) {
if (err) throw err;
client.RateService.RateServicePort.getRates(params, function(err, result) {
res.send(result);
});
});
})
app.listen(port, function(){
console.log('app listening on port '+ port);
})