Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hello,Everyone!
I want to use SDK to create many thing in Thingworx,How do use sdk to invoke service?
Thank you very much!
Solved! Go to Solution.
Hi Ju Bin, could you please comment more on the use case you have as there are lot of ways with which you can call the services and as we discussed in your other thread How do you batch create things? you have the possibility to call those services available in Resources. Which SDK are you planning to use for your use case?
Best place to begin with, i.e. if you have not yet tried any SDKs would be to check the ThingWorx Edge SDK Help Center . For e.g. if you are looking to begin with Java you can check the API documentation on EntityServices using which you can create needed entities.
Sushant
Hi Ju Bin, could you please comment more on the use case you have as there are lot of ways with which you can call the services and as we discussed in your other thread How do you batch create things? you have the possibility to call those services available in Resources. Which SDK are you planning to use for your use case?
Best place to begin with, i.e. if you have not yet tried any SDKs would be to check the ThingWorx Edge SDK Help Center . For e.g. if you are looking to begin with Java you can check the API documentation on EntityServices using which you can create needed entities.
Sushant
I'm so sorry,The problem description is not detailed enough,Because my English is not good enough,The documentation is very helpful, thank you!
No problem, but I think i got it right anyway glad it helped.
Hi Mr. Guo,
There must be a service on Platform for you to create Things. We just need to call this service from SDK. Invoke service must be used.
Below code is used for invoke service on Java SDK:
//A ValueCollection is used to specify a service's parameters
ValueCollection params = new ValueCollection();
params.put("path", new StringPrimitive("/simple.txt"));
params.put("data", new StringPrimitive("Here is the contents of the file."));
params.put("overwrite", new BooleanPrimitive(true));
// Use the SystemRepository Thing to create a text file on the Platform.
// This service's result type is NOTHING, so we can ignore the response.
client.invokeService(ThingworxEntityTypes.Things, "SystemRepository",
"CreateTextFile", params, 5000);
// If a service does have a result, it is returned within an InfoTable.
params.clear(); // Clear the params used in the previous service invocation.
I suggest you to read Java SDK Developer guide. page 24 is very important. If you still have concern, please let me know.
BR,
Lily