Forum Discussion
AKUMA_234040
Apr 29, 2019Nimbostratus
How to use irule or iRule LX to call external soap web service which use wss4j for security
How to use irule or iRule LX to call external soap web service, the web service which use wss4j for authentication, the following is the soapenv:Envelope which can be used to call the webservice: ...
May 02, 2019
If you just want to do the POST and do something with the data you can use iRulesLX. It could look like something like this. Please note, that this is just an example. This code is not tested and will need probably need some modification to fit your needs.
iRule:
when SOME_EVENT {
set var1 "var1"
set var2 "var2"
set var3 "var3"
set rpc_handle [ ILX::init xml_plugin ext_xml ]
if {[ catch { ILX::call $rpc_handle sendXML $var1 $var2 $var3 } result ] } {
log local0. "sendXML failed, ILX failure: $result"
return
}
do something with the result
log local0. "Result: $result"
}
iRuleLX
const http = require("http");
var f5 = require("f5-nodejs");
var ilx = new f5.ILXServer();
ilx.addMethod('sendXML', function(req, res) {
var var1 = req.params()[0];
var var2 = req.params()[1];
var var3 = req.params()[2];
var postData = ' ... ';
var options = {
hostname: 'cnsvwshvm01023.csvw.com',
port: 80,
path: '/cmit/services/dataService.dataServiceHttpSoap11Endpoint/',
method: 'POST',
headers: {
'Content-Type': 'text/xml',
'Content-Length': postData.length,
}
};
var request = http.request(options, (response) => {
response.on('data', (d) => {
/* data received, maybe do something with the data */
return res.reply('successful');
});
});
request.on('error', (e) => {
console.log(e);
return res.reply('failed');
});
request.write(postData);
request.end();
});
ilx.listen();
- Nikoolayy1Jan 22, 2023MVP
That is great and if Content-Type is changed to something like
then also REST calls probably could be send as I see no issues! Just postData should also be json not xml.application/json
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects