Reputation: 497
How do you read the actual xml content of a SOAP request? req.body
appears to be empty. The only information I see is req.headers.soapaction
, which gives me some url.
app.use(function(req, res, next){
console.log(req.headers.soapaction); // this gives some url
console.log(req.body); // but nothing here.. how can i see the xml content?
});
Thanks!
Upvotes: 0
Views: 2207
Reputation: 1440
I don't know if my answer is correct, but I was able to get my data (which was XML content). Here's my solution:
const express = require('express');
const app = express();
...
const bodyParser = require('body-parser');
app.use(bodyParser.text({type:'text/*'})); // reads the body as text (see Express 4 API docs)
...
app.get((req,resp) => {
var body = req.body; // Should be a giant object of characters
var data = JSON.stringify(body); // Put all the characters into a single string
console.log("Data: " + data);
});
app.listen(PORT, () => console.log(`App running on ${PORT}`));
Hope this helps!
Upvotes: 1