javascript - node JS POST using soap in apigee -
i having trouble in posting using node js in apigee.
the response blank []. if push error, error [error: connect einval]
i guess can't read soap when call it. used post reference, doesn't seem work.
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 elements @ 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 elements @ 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 listening'); });
Comments
Post a Comment