One of the things which changed is the location where the .desktop file will be located, in the case of KDE4 this should be placed in the ~/.kde/share/kde4/services/ServiceMenus directory. In order to find out what are the directories where the service menus can be put you can run this command:
kde4-config --path services
Which, on my Kubuntu 9.04 system outputs:
embryo@kubu:~$ kde4-config --path services
Also, the syntax of the desktop file changed a little. Here is a basic example of the .desktop file:
[Desktop Action OpenAsRoot]
Exec=kdesu dolphin %U
Name=Open as Root
Save the file under a name like action_root.desktop inside ~/.kde/share/kde4/services/ServiceMenus and then right-click any directory inside Dolphin or Konqueror, go to Actions -> Open as Root and enter your user password (in Ubuntu) or root password in order to open that directory as root. I had to reload the tabs in Dolphin for the service menu to appear.
Here's how it looks like:
In Dolphin and KDE 4.2.1
In Konqueror and KDE 4.2.1
You may find these two tutorials very useful if you plan to create various service menus in KDE4: this tutorial from KDE TechBase and this forum discussion from KubuntuForums.net.
You can also download and explore a complete script hosted on www.kde-apps.org, called Root Actions Servicemenu.
3 Popular Tips for Konqueror 3.5.9
Review: Dolphin 1.2.1 File Manager