5 Replies Latest reply on Sep 19, 2016 4:39 PM by wposner-2 RSS
    leisel Explorer

    Correct strategy for creating simple services?

    I wanted to practice creating services to get a better understanding of what type of things I could do with services for my project. The services I imagine myself needing should not end up being too complex, but as of now I'm hung up on a couple of things.

    Unfortunately I am not able to take a Fundamentals Course and am limited to the resources found through elearning.



    The actual thing I wanted this service to do seemed pretty simple:

    I'd have a list of things(they share the same template)

    I'd select a row, and then push a button to run my service.

    The service would take(as the input) the name of the selected row(the thing's name), and find out a specific property value of that thing to be output to a 'value display' widget.

    therefore in the future i would know I could change values, or compare them etc.. I just wanted to do this to prove I could access the correct info.



    I'm guessing the problem is knowing the correct way to start. This was my process:

    I created this service on the template of the things I am interested in(not sure if this is a good strategy?)

    The code was simple, just for finding out the string value of a Thing's property:


    var params = {

      propertyName: StringName /* STRING */




    // result: STRING

    var result = me.GetStringPropertyValue(params);


    To test it I checked the Services of one of these Things that implemented this template, and I clicked the 'Test' button.

    I entered the input, which is just any String property that has a string value, and it correctly returned the string value of that property.


    Mashup Implementation

    The way I envisioned it above for my Mashup was a different story.

    I have a list of the implemented things,

    for the Selected Row, I chose the same string property that I entered for testing, and dragged it to the service's input parameter.

    I used a button to act as the event that would trigger the service and have the 'result' display on a value display widget.


    One strange thing about any self-created services from a ThingTemplate, is that i can only ever select them by adding the Template entity as Dynamic(the small checkbox to the right while adding an entity.) And doing so requires an extra input directly under the newly added entity. It's called 'Entity Name'

    I assumed it would need the name of one of it's implemented things, the one who would be using it's service, so i chose the 'name' from Selected Rows to be the input for Entity Name.


    This method never worked, and not having an Entity Name input never worked as well. The only info I've seen on this is posted here Made a template, added a service to it. Service is 'Dynamic' - why? and doesn't exactly solve my problem.




    Is there a simpler way of creating a non-complex service like this? or am I doing anything incorrectly? is there a better way of thinking about a simple thing like this?


    Thank you in advance.