Rooting Xperia Ray (ST18i) with 4.1.B.0587 build
Do these:


Download flashtool(I did from 4shared).
Turn on Usb Debugging
Turn on Unknown Sources
Install flashtool in C: drive.
Extract doomlord's zergrush tool in C:.
Download both the kernels and first paste first one, which is 4.1.a.0.562 in firmware folder of flashtool.
Switch off phone.
Start flashtool, select flash icon, select flashmode.
When window gets open,double click on the kernel name.
When prompt window open,connect your phone pressing volume down key.
Make sure that your adb drivers are installed, then flashing will happen.
Disconnect phone when completed and restart it.
After 15 second(even Sony logo won't be shown, only backlight), connect phone to system. Wait for the adb drivers to be installed.
Go to where you extracted your doomlord's tool and double click runme.bat file.
Wait for around five minutes until it says DONE.
Disconnect phone and remove battery.
Replace the kernel in flashtool firmware folder with 4.1.b.0.587.
Open flashtool and click flash icon.
DoubleClick kernel file then connect phone in flashmode.
Disconnect phone when flashing completed.
Disconnect phone and restart it.


Your Ray is rooted now. Then install clockworkmod by using CWM installer.exe from the same system. Enjoy romz...