cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

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

How to define Input and Output for service created remotely using Java Edge SDK?

mkreinin
1-Visitor

How to define Input and Output for service created remotely using Java Edge SDK?

Hi,

I have a server which connects to thingworx server using Edge SDK and creates remote things. I need to add services for these things. The following code works:

    params = new ValueCollection();

    params.SetStringValue("name", "GetHello");

    params.SetBooleanValue("remote", true);

    params.SetStringValue("remoteServiceName", "GetHello");

    client.invokeService(ThingworxEntityTypes.Things, thingName, "AddServiceDefinition", params, 0);

This creates a service and I can invoke this service provided my virtual thing has an appropriate method. However this service does not accept parameters and has no output.

I tried to add the following to define Output:

    params = new ValueCollection();

    params.SetStringValue("name", "GetHello");

    params.SetBooleanValue("remote", true);

    params.SetStringValue("remoteServiceName", "GetHello");

    client.invokeService(ThingworxEntityTypes.Things, thingName, "AddServiceDefinition", params, 0);

    // add Output type

    ValueCollection entry = new ValueCollection();

    entry.SetStringValue("name", "result");

    entry.SetStringValue("description", "just test");

    entry.SetStringValue("baseType", "STRING");

    InfoTable output = new InfoTable();

    output.addRow(entry);

    params.SetInfoTableValue("resultType", output);

But the service is still created without Output. Can somebody please point me to proper documentation or provide some examples on how to do it?

Thanks,

Michael

0 REPLIES 0
Announcements


Top Tags