Service for Inserting a service into entities
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Service for Inserting a service into entities
How can i go for duplicating a service of a specific thing inside other entities like things or thing templates?
- Labels:
-
Design
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I'm not sure why you need to duplicate a service.
You could just create a central helper Thing with services and then invoke that service from the other Entities.
Especially if it is doing the same evaluation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Why not implement the shared service in a ThingShape and both entities will implement that shape?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You might also like to try:
// result: INFOTABLE dataShape: "ServiceDefinition"
var result = ThingTemplates["YouThing"].GetServiceDefinition({
name: "serviceToCopy" /* STRING */
});
//see ServiceDefinition data shape for the below paramter inputs
ThingTemplates["OtherThing"].AddServiceDefinition({
name: undefined /* STRING */,
description: undefined /* STRING */,
remoteServiceName: undefined /* STRING */,
category: undefined /* STRING */,
remote: undefined /* BOOLEAN */,
parameters: undefined /* INFOTABLE */,
resultType: undefined /* INFOTABLE */,
timeout: undefined /* INTEGER */
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Actually, i needed a help with a default service 'AddServiceDefinition()'. With this service i'm being able to insert a service inside an entity, but being unable to insert a code in that inserted service. Can u help me on this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I'm sorry but I'm not sure how or if it is even possible to "inject" code to a new Service.
The code can come from different places, from Jars or Composer Js and so on.
Please try the ThingShape approach and see if it can help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
This will only work with Remote Services, ie Services on a connected Thingworx Agent
it will not allow you to create new regular defined services.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@PaiChung Actually, with the available snippet, i'm being able to insert a service in the desired entity (like Thing or Thing Template) but being unable to insert a code into that service. So, this way i'm quite sure that there could be some way for inserting a code too. Kindly help me on this.