var url = "http://10.1.1.1:30080/apigateway/apinizerlog/InsertLog";
var date = new Date().toISOString();
var serviceName = 'Service Name To Be Written';
var application = 'Application Name To Be Written';
var ip = headerMap.get('X-Forwarded-For');
var userName = headerMap.get('username');
var parameter = JSON.stringify(bodyText);
var data = JSON.stringify({
"Date": date,
"ServiceName": serviceName,
"IP": ip,
"UserName": userName,
"Parameter": parameter,
"Application": application
});
try {
var con = new java.net.URL(url).openConnection();
con.setConnectTimeout(15000);
con.setReadTimeout(15000);
con.setRequestMethod("PUT");
con.setUseCaches (false);
con.setDoInput(true);
con.setDoOutput(true);
con.setRequestProperty("Content-Length", data.length);
var wr = new java.io.DataOutputStream(con.getOutputStream());
wr.writeBytes(data);
wr.flush();
wr.close();
con.getResponseCode();//important not to be deleted
} catch (err) {
}
JS