Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Want to define a ThingShape that has a local java method (not java script) exposed as service. Hence the ThingShape class has the required method with annotation ThingworxServiceDefinition/ThingworxServiceResult..
Want to expose The same method is then added in metadata.xml so that service is available to things. Tried to use Reflection Handler definition and it lists the service on thing shape as well as thing created using the thing shape defined. However when we test, it return the error ..
Unable to Invoke Service PTCGetAllThingsData on Mt2 : No service handler defined for service PTCGetAllThingsData on thing [Mt2]
----------------------------------------
Server method declaration in Thing Shape ...
@ThingworxServiceDefinition( isLocalOnly=true, name="PTCGetAllThingsData", description="Get implementing things" )
@ThingworxServiceResult( name="Result", description="Result", baseType="STRING" )
public String PTCGetAllThingsData () throws Exception {
-...........
}
---------------------------
The example metadata.xml
<Entities>
<ExtensionPackages>
.....................
</ExtensionPackages>
<ThingPackages>
<ThingPackage name="PTCThingShapeExtPackage" description="Sample Extension" className="com.ptc.exps.PTCThingShapeExp" aspect.isSystemObject="false" aspect.isCreatable="true" >
<HandlerDefinitions>
<HandlerDefinition name="Reflection" className="com.ptc.exps.PTCThingShapeExp"/>
</HandlerDefinitions>
<JarResources>
<FileResource type="JAR" file="thingworx-ptcthingshape-extension.jar" description="PTC ThingShape Extension Package JAR" />
</JarResources>
</ThingPackage>
<ThingShapes>
<ThingShape name="PTCThingShapeExp" description="PTC Thing Shape Extension" className="com.ptc.exps.PTCThingShapeExp" aspect.isSystemObject="false" thingPackage="PTCThingShapeExtPackage">
<ServiceDefinitions>
<ServiceDefinition aspect.isAsync="false" description="sds" isAllowOverride="false" isLocalOnly="false" isOpen="false" isPrivate="false" name="PTCGetAllThingsData">
<ResultType baseType="STRING" description="" name="result"/>
</ServiceDefinition>
</ServiceDefinitions>
<ServiceImplementations>
<ServiceImplementation handlerName="Reflection" name="PTCGetAllThingsData" allowOverride="false" />
</ServiceImplementations>
</ThingShape>
</ThingShapes>
I am also looking for an answer to this question.
I am also looking for an answer to this question.
If somebody could answer, it would be better.