Update : I finally managed to recreate the whole Java code as required for the third party service. I must add that some of the libraries used are deprecated but I cannot do anything because that is what the other side is using and I must comply.
Java Code
SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(),
"AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(1, secretKeySpec);
byte[] aBytes = cipher.doFinal(inputString.getBytes());
Input Key : xxxxxxxxyyyyyyyy
Input Text: maryhadalittlelamb
Output : Z22GETg3Anl92%2BoyqdVWs9haQveaZxkDn8sQYP08iCY%3D
node.js Code
var cipher = crypto.createCipher('aes-128-ecb', key);
var encryptedPassword = cipher.update(text, 'utf8', 'base64');
encryptedPassword += cipher.final('base64');
console.log(encryptedPassword);
Input Key : xxxxxxxxyyyyyyyy
Input Text: maryhadalittlelamb
Output: mnqrpA2eqAhmseTrkBtH3YSGMoFs+ECPUamVd8/bgAQ=
The output for same inputstring and key is different for both. In fact the node.js is different but the base64 one looks identical nevertheless.
I am fairly new to these things therefore I have lost my may.