You may look into developing your own ThingWorx extension in Java. Documentation attached.
I have created a thingworx Thing project in Eclipse which has one service as well. Now I don't know how to export that project as extension so that I can import it in my ThingWorx Studio.
Mayank Rastogi : Hello Mayank, you will have first build your Java extension project code using Gradle or Ant in Eclipse. On successful Build completion you will get a .Zip file created under your eclipse workspace folder \ProjectName\build\distributions\xxx.zip.
This zip file is your extension having required Thing and Service code. You can import this extension in ThingWorx like any other extension.On successful import of extension you can see the required Thing and can execute service.
In ThingWorx Studio, you can add your custom service to your project by clicking + on External Data under DATA.
Hope it helps !!