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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

[Java SDK Tutorial] FileTransfer example and Simplethingclient, Invoke error

Clement_D
10-Marble

[Java SDK Tutorial] FileTransfer example and Simplethingclient, Invoke error

Hello,

 

I did SDK tutorial. I have some error with FileTransfer example and Simplethingclient.
I have no issue with ExampleClient and Tunnel Example and I am stuck on the following error. How could I try to solve it ?
I don't know how to solve them. I have already retry configuration of eclipse three times with different project but no progress :/


I am able to connect to the hosted thingworx server because I receve this message :
>  [main] INFO c.t.s.simplething.SimpleThingClient - ****************Connected to ThingWorx Server****************

However, I have for the two example the same kind of error :
(SimpleThingClient example )

> com.thingworx.common.exceptions.GenericHTTPException: Unable to dispatch [ uri = /Things/SimpleThing_1/Services/CreateNewThing/]: Unable to Invoke Service CreateNewThing on SimpleThing_1 : Execution error in service script [CreateNewThing] :: Entity [EntityServices] does not exist
at com.thingworx.communications.client.BaseClient.invokeService(BaseClient.java:422) ~[thingworx-communications-client-development.server.build-b679.jar:na]
at com.thingworx.communications.client.BaseClient.invokeService(BaseClient.java:372) ~[thingworx-communications-client-development.server.build-b679.jar:na]
at com.thingworx.sdk.simplething.SimpleThingClient.main(SimpleThingClient.java:101) ~[bin/:na]

 


(FileTransferExample)

>com.thingworx.common.exceptions.GenericHTTPException: Entity SystemRepository does not exist or is not yet associated with a Thing
at com.thingworx.communications.client.BaseClient.invokeService(BaseClient.java:422)
at com.thingworx.communications.client.BaseClient.invokeService(BaseClient.java:372)
at com.thingworx.sdk.examples.FileTransferExample.main(FileTransferExample.java:47)

 

Thanks in advance for your help

ACCEPTED SOLUTION

Accepted Solutions

This is likely a permissions issue. Does the user you created the application key for have access to run CreateNewThing on EntityServices?

 

To test this, log in as the user (set their password first if you haven't already) and try to run the service. If you can't then update their permissions to allow it. Another test you can do, which shouldn't be done in a production system, is to create the app key for the administrator and test the application using the new app key.Instructions for running CreateNewThing:

 

1. Go to Resources on the left.

2. Find EntityServices.

3. Go to Services.

4. Find and run the CreateNewThing service.

View solution in original post

6 REPLIES 6

I am still stuck. I have made many try but I know no clue for the cause of the error. I am using SDK 6.1.0.679 and example download on thingworx.

This is likely a permissions issue. Does the user you created the application key for have access to run CreateNewThing on EntityServices?

 

To test this, log in as the user (set their password first if you haven't already) and try to run the service. If you can't then update their permissions to allow it. Another test you can do, which shouldn't be done in a production system, is to create the app key for the administrator and test the application using the new app key.Instructions for running CreateNewThing:

 

1. Go to Resources on the left.

2. Find EntityServices.

3. Go to Services.

4. Find and run the CreateNewThing service.

Ok, i followed your advice and I am able to create manually a thing by using the service on my online hosted server. As you can see on my capture.
I also check the application key and it seems correct.
I am only using the administrator sessions to make the tutoriel.
I try with admin key and the two example are now working however I don't understand why my application key is not working as it should. The application key isn't allow to access create new thing ?
creation_test.JPGcreation_test_res.JPG

The issue isn't the application key, but the User you assigned the key too. The application key is connected to a user, who has a set of permissions. Based on those permissions, says whether a person can access certain Resources and functionality.

 

To get your application key to work, update that permissions for that user it is attached to. You'll have to play with the permissions/user groups to find the right configuration for you. OR if you're just trying to test and not in a production environment, add that user to the Administrators user group.

Thank you a lot, I was stuck and now i know where to look !
I will make some test with the user and the groups.

I doesn't always understand what user i am using. For instance, on the example there is :
> ClientConfigurator config = new ClientConfigurator();

Is this line says that I am using the default configuration with default user.

You can always see which user you're using for the connection by looking at the String appKey value (or a variable similar to this), which contains a bunch of letters, numbers, and dashes ('-'). This value will match one of the applications keys you have in your Composer. Check the keyId value of your keys...when you see one that matches, look at the user attached.

Announcements


Top Tags