Node.js Apigee中未定义NodeJS异步http请求ArrayBuffer
这是我在nodeJS中的代码。。当我将它部署到本地时,它总是正常运行,但当我将它部署到生产环境时,总是出现错误“ArrayBuffer未定义”。有人能告诉我是什么原因吗?我将尝试添加ArrayBuffer,但出现了相同的错误。谢谢Node.js Apigee中未定义NodeJS异步http请求ArrayBuffer,node.js,apigee,Node.js,Apigee,这是我在nodeJS中的代码。。当我将它部署到本地时,它总是正常运行,但当我将它部署到生产环境时,总是出现错误“ArrayBuffer未定义”。有人能告诉我是什么原因吗?我将尝试添加ArrayBuffer,但出现了相同的错误。谢谢 var svr = http.createServer(function(req, resp) { var response = []; var calls = []; var windowLiveId; var huaweiReturnCod
var svr = http.createServer(function(req, resp) {
var response = [];
var calls = [];
var windowLiveId;
var huaweiReturnCode;
var serviceId = apigeeAccess.getVariable(req,'subscription.serviceid');
var ericssonRequestBody = {"offerId":serviceId,"generateBillingRecord":true };
calls.push(function(callback) {
http.get('http://butcha-test.apigee.net/v1/accounts/', function (resource) {
resource.setEncoding('binary');
resource.on('data', function (data) {
windowLiveId = JSON.parse(data).AccountId;
request.post({
url:'http://butcha-test.apigee.net/v1/erickson/'+windowLiveId,
method: 'POST',
headers:{
'Content-Type': 'application/json'
},
body: JSON.stringify(ericssonRequestBody)
}, function(error,res,body){
apigeeAccess.setVariable(req,"ericsonStatus",(/2[0-9][0-9]/.test(res.statusCode)) ? "success":"fail");
apigeeAccess.setVariable(req,"ericsonStatusCode",res.statusCode);
callback();
});
});
});
});
calls.push(function(callback){
request.post({
url:'http://morning-sea-3467.getsandbox.com/mockOverseaBossServiceSoapBinding',
method: 'POST',
headers: {'content-type' : 'application/xml'},
body: huaweiSoapRequest
}, function(error,res,body){
response.push(body);
var tag = "<bean:returnCode>";
var x = body.indexOf(tag) + tag.length;
huaweiReturnCode = body.substring(x, (x+1));
apigeeAccess.setVariable(req,"huaweiReturnCode",huaweiReturnCode);
apigeeAccess.setVariable(req,"huaweiStatusResult",(huaweiReturnCode =="0")? "success":"fail");
callback();
});
});
async.parallel(calls, function(){
resp.end(str2ab(response.toString));
});
});
var svr=http.createServer(函数(req,resp){
var响应=[];
var调用=[];
var-windowLiveId;
var-Huawei返回码;
var serviceId=apigeeAccess.getVariable(req,'subscription.serviceId');
var ericssonRequestBody={“offerId”:serviceId,“generateBillingRecord”:true};
calls.push(函数(回调){
http.get('http://butcha-test.apigee.net/v1/accounts/,功能(资源){
setEncoding('binary');
资源.on('data',函数(data){
windowLiveId=JSON.parse(data).AccountId;
请寄({
网址:'http://butcha-test.apigee.net/v1/erickson/“+windowLiveId,
方法:“POST”,
标题:{
“内容类型”:“应用程序/json”
},
正文:JSON.stringify(ericssonRequestBody)
},函数(错误、恢复、正文){
apigeeAccess.setVariable(请求,“ericsonStatus”(/2[0-9][0-9]/.test(res.statusCode))?“成功”:“失败”);
apigeeAccess.setVariable(req,“ericsonStatusCode”,res.statusCode);
回调();
});
});
});
});
calls.push(函数(回调){
请寄({
网址:'http://morning-sea-3467.getsandbox.com/mockOverseaBossServiceSoapBinding',
方法:“POST”,
标题:{'content-type':'application/xml'},
正文:华威
},函数(错误、恢复、正文){
反应。推(体);
var tag=“”;
var x=body.indexOf(tag)+tag.length;
huaweiReturnCode=body.substring(x,(x+1));
setVariable(req,“huaweiReturnCode”,huaweiReturnCode);
setVariable(请求,“huaweiStatusResult”,(huaweiReturnCode==“0”)?“成功”:“失败”);
回调();
});
});
parallel(调用,函数(){
分别结束(str2ab(response.toString));
});
});
可能是因为您的Apigee版本?因为旧版本的Apigee不受支持nodeJs可能是因为您的Apigee版本?因为nodeJs不支持Apigee的旧版本