A REST utility for uploading file to a SOAP WebService. It is configurable and works as is with Oracle Managed file transfer (MFT).
npm install mft-uploadImplemented
* SOAP inline XML or Binary base64 encoded data
* Upload to SOAP service using SOAP attachments (SwA)
* HTTP Formdata for upload to arbitray web apps
* Chaining of requests for upload and notify SOAP service use cases
* Custom payload templates using templatedir property
* Allow removal of passwords from the config file
* Support respfile argument for template development and improved debugging
Future use cases include the following:
* Upload to HTTP servers using MTOM attachments
It is assumed you have knowledge and a working MFT server installed such as Oracle MFT.
The SOAP interface communicates with an MFT SOA or SOAP Source that must be configured on the MFT server that implements the MFT SOAP WSDL.
npm install mft-upload --save
node upload.js file=index.js config=req.json | passwords=
file: Required pointer to the file to be uploaded.
config: Optional points to the config file described below. Default location is $HOME/.mft/upload.json
passwords: Optional space delimited array of passwords substituted into the config or templates
```
{
"type": "SOAP",
"maxsize": 20214400,
"request": {
"url": "http://HOSTNAME:7901/mftapp/services/transfer/SOAP2File",
"method": "POST",
"headers": { "Content-Type": "text/xml; charset=utf-8" },
"auth": { "user": "USERNAME", "pass": "PASSWORD" }
}
}
Following type support SOAP with Attachments.
``
{
"type": "WSA",
"maxsize": 5242880026214400,
"request": {
"uri": "http://HOSTNAME.com:7901/mftapp/services/transfer/SOAP2File",
"method": "POST",
"headers": {
"FileName": "",
"Content-Type": "multipart/related;type=\"text/xml\""
},
"multipart": [
{
"Content-Type": "text/xml;charset=UTF-8",
"auth": { "user": "USERNAME", "pass": "PASSWORD" }
},
{
"Content-Type": "application/octet-stream"
}
]
}
}
Config "template" allows user provided template using any file name or location.
``
{
"type": "SOAP",
"template": "my-payload", // template file is at "my-payload"
"request": {
"url": "http://localhost:7901/mftapp/services/transfer/SOAP2File",
"method": "POST",
"headers": { "Content-Type": "text/xml; charset=utf-8" },
"auth": { "user": "USERNAME", "pass": "PASSWORD" }
}
}
Config "templatedir" allows user provided template location of filename "
``
{
"type": "SOAP",
"templatedir": "mytemplates", // template file is at "mytemplates/SOAP-PAYLOAD"
"request": {
"url": "http://localhost:7901/mftapp/services/transfer/SOAP2File",
"method": "POST",
"headers": { "Content-Type": "text/xml; charset=utf-8" },
"auth": { "user": "USERNAME", "pass": "PASSWORD" }
}
}
Illustrates chaining of requests using "cfgarr config array element for upload followed by a SOAP notification call.
``
{
"type": "SOAP",
"cfgarr": [
{ "config": "wsa.json", "file": "package.json"}
],
"request": {
"url": "http://HOSTNAME:7901/mftapp/services/transfer/SOAP2File",
"method": "POST",
"headers": { "Content-Type": "text/xml; charset=utf-8" },
"auth": { "user": "USERNAME", "pass": "PASSWORD" }
}
}
If a config argument is not provided, upload.js looks for one at ~/.mft/upload.json using process.argv[1].
``
getRequestConfig(process.argv, function(err, retargs, cfgfile, cfgjson) {
if (err) {
console.log(err);
process.exit(1);
}
args = retargs;
filepath = args.file;
reqOptions = cfgjson;
});
`
fileUpload(filepath, reqOptions, function(er, respcode, jsonbody, stats) {
if (er) {
console.log(er);
process.exit(1);
}
console.log('Response code is: ' +respcode);
console.log(stats.summary);
});
`
``
upload(process.argv, function(err, respcode, jcfg, stats) {
if (err) {
console.log('Upload Error: ' +err);
process.exit(1);
};
});
npm install chai
npm test
1. Fork it!
2. Create your feature branch: git checkout -b my-new-featuregit commit -am 'Add some feature'
3. Commit your changes: git push origin my-new-feature`
4. Push to the branch:
5. Submit a pull request :D
Created: May 6, 2015
Dave Berry A.K.A (bigfiles)
ISC