我在apigee中使用节点js发布时遇到了一些麻烦。
我得到的回答是空白[]。现在如果推错误,我得到的错误是 [错误:连接EINVAL]
我想我打电话时不能读肥皂。我使用此post作为参考,但它似乎无法正常工作。
var http = require('http');
var request = require('request');
var async = require('async');
var querystring = require('querystring');
var body = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:over="http://oversea.interfaceBOSS.iptv.sample.com" xmlns:over1="http://oversea.common.iptv.sample.com" xmlns:bean="http://bean.oversea.interfaceBOSS.iptv.sample.com">'+
'<soapenv:Header/>'+
'<soapenv:Body>'+
'<over:changeOrderInfo>'+
'<over:changeOrderInfoReq>'+
' <!--Optional:-->'+
'<over1:extensionInfo>'+
' <!--Optional:-->'+
'<over1:namedParameters>'+
' <!--Zero or more repetitions:-->'+
'<over:item>'+
' <!--Optional:-->'+
' <over1:key>?</over1:key>'+
' <!--Optional:-->'+
' <over1:value>?</over1:value>'+
'</over:item>'+
'</over1:namedParameters>'+
'</over1:extensionInfo>'+
'<!--Optional:-->'+
'<over1:sequenceID>?</over1:sequenceID>'+
'<!--Optional:-->'+
'<over1:version>?</over1:version>'+
'<!--You may enter ANY elements at this point-->'+
'<!--Optional:-->'+
'<bean:subscriberID>?</bean:subscriberID>'+
'<!--Optional:-->'+
'<bean:orderBean>'+
'<!--Optional:-->'+
'<over1:extensionInfo>'+
' <!--Optional:-->'+
'<over1:namedParameters>'+
' <!--Zero or more repetitions:-->'+
'<over:item>'+
' <!--Optional:-->'+
'<over1:key>?</over1:key>'+
'<!--Optional:-->'+
'<over1:value>?</over1:value>'+
'</over:item>'+
'</over1:namedParameters>'+
'</over1:extensionInfo>'+
'<!--Optional:-->'+
'<bean:productID>?</bean:productID>'+
'<!--Optional:-->'+
'<bean:terminalID>?</bean:terminalID>'+
'<bean:operationType>?</bean:operationType>'+
'<!--You may enter ANY elements at this point-->'+
'</bean:orderBean>'+
'</over:changeOrderInfoReq>'+
'</over:changeOrderInfo>'+
'</soapenv:Body>'+
'</soapenv:Envelope>"';
var svr = http.createServer(function(req, resp) {
var response = [];
var calls = [];
var myJSONObject = { "msisdn":"9177440311"};
var buffer = "";
calls.push(function(callback){
request.post({
url:'http://10.23.22.104',
method: 'POST',
port:'8080',
path:"/mockOverseaBossServiceSoapBinding",
headers:{
'Cookie': "cookie",
'Content-Type': 'text/xml',
'Content-Length': Buffer.byteLength(body)
},
}, function(error,res,body){
response.push(body);
callback();
});
});
async.parallel(calls, function(){
resp.end("[" + response.toString() + "]");
//response = [];
//for(var i=0; i<response.length; i++){
// response.pop();
// }
});
});
svr.listen(9000, function() {
console.log('Node HTTP server is listening');
});