I need to download or process a file from a soap based web service in node.js. can someone suggest me on how to handle this in node.js
I tried with \'node-soap\' or
Use ws.js
Here is how to fetch the file attachments:
const ws = require('ws.js')
const { Http, Mtom } = ws
var handlers = [ new Mtom(), new Http()];
var request = '' +
'' +
'' +
' ' +
' ' +
' ' +
' '
var ctx = { request: request
, contentType: "application/soap+xml"
, url: "http://localhost:7171/Service/mtom"
, action: "http://tempuri.org/IService/EchoFiles"
}
ws.send(handlers, ctx, function(ctx) {
//read an attachment from the soap response
var file = ws.getAttachment(ctx, "response", "//*[local-name(.)='File1']")
// work with the file
fs.writeFileSync("result.jpg", file)
})
Two limitations:
.
xpath = "//*[@href='cid:" + encodeURIComponent(id) + "']//parent::*"
with:
xpath = "//*[@href='cid:" + id + "']//parent::*"