Reputation: 1194
I am working on a project. Where i need to call a web service which returns a SOAP message. Now the problem is that the webservice is hosted on an IntraNet and i can not access it. I have been provided with a txt file that contains a sample response of the web service. I have to manipulate the reply in my code Is there anyway I can call this txt file instead of the web service and get the response and manipulate it ?
Upvotes: 0
Views: 280
Reputation: 28
You can do that using node and Express JS. Install Node from www.nodejs.com
after installing and running node, go to your directory and install express :
npm install express
then create a file called app.js and run it with node : node app.js
var express = require('express')
, app = module.exports = express();
app.get('/', function(req, res){
res.send('<p>Static File Server for files</p>');
});
app.get('/txt/:file(*)', function(req, res, next){
var file = req.params.file
, path = __dirname + '/public/txt/' + file;
res.sendFile(path);
});
if (404 == err.status) {
res.statusCode = 404;
res.send('File Does Not Exist!');
} else {
next(err);
}
});
if (!module.parent) {
app.listen(8023);
console.log('Express started on port 8023');
}
put the folder that has your txt file in /public/txt/ so public and the app.js are in the same directory. you should run the app.js with node after this is done. go to your web browser : navigate to localhost:8023/txt/yourfile.txt and if everything is working find you should be able to get the file.
Upvotes: 1