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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Thingworx Directory Services - Issue In Invoking AD Services From Other Things

mdeshpande-2
10-Marble

Thingworx Directory Services - Issue In Invoking AD Services From Other Things

Hello,

 

I have this scenario wherein I have to configure the Thingworx Directory Service  settings programmatically.

 

So, when a user specifies a setting from the UI, I need to update it into the respective configuration table on the Directory service.

However, I need to call these services from inside another thing.

 

When I invoked the services from another thing, all services from my Directory Service entity errored out with -  Error executing service <serviceName>. Message :: ReferenceError: "DirectoryServices" is not defined. 

 

For example even the GetConfigurationTables services gives an error -

 

// result: INFOTABLE dataShape: "EntityList"
var result = DirectoryServices["Test.ActiveDirectory"].GetConfigurationTables();

 

Is this the default working for directory services in Thingworx or is there anything I am missing ?

 

Any help is highly appreciated.

Thanks!

 

Note: Thingworx version is 8.5.6.

ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:mdeshpande-2)

If I'm not mistaken you are running into a bug unfortunately.

https://www.ptc.com/en/support/article/CS303447?&language=en&posno=1&q=%22DirectoryServices%22%20is%20not%20defined.&source=search

As a work around that you can potentially use is to invoke it using the content loader functions (REST call)

However this bug is fixed in 9.0.x ? so I recommend using a more recent version of Thingworx.

View solution in original post

5 REPLIES 5
PaiChung
22-Sapphire I
(To:mdeshpande-2)

I don't have an instance with AD set up to check this but check the following

<server>/Thingworx/DirectoryServices/Test.ActiveDirectory

And then go into Service Definitions to see if there are any.

Although I imagine you got the service using the 'Browse'?

Could you at all be running into any permissions issues?

Hi Pai,

 

I checked and yes, I get all the service definitions listed for the Active Directory instance.
If I execute the service from the Active Directory Entity directly, then it works.

 

The problem is only when I try to execute the services from inside another thing.

 

The user I am using is a member of Administrators group.

PaiChung
22-Sapphire I
(To:mdeshpande-2)

If I'm not mistaken you are running into a bug unfortunately.

https://www.ptc.com/en/support/article/CS303447?&language=en&posno=1&q=%22DirectoryServices%22%20is%20not%20defined.&source=search

As a work around that you can potentially use is to invoke it using the content loader functions (REST call)

However this bug is fixed in 9.0.x ? so I recommend using a more recent version of Thingworx.

Hi Pai, 

 

Yes, seems to be a bug.

I tried the work-around and used the REST API method with Content Loader functions.

 

I can get the configuration tables values using both the GetConfigurationTable(s) services.

However if I want to set the configuration table values, I am running into issues.

 

Tried using Postman , details as below - 

 

Service- SetConfigurationTable / SetConfigurationTableRows

Input - Sent a body as a JSON having three input params as - tableName, persistent and configurationTable / values (depending on the service used).

Method type - Post 

Authentication - Basic Authentication (Administrator user) 

 

The configurationTable / values is in itself an infotable type, so the value of this input parameter I sent as a JSON representation of an infotable (including the datashape definition and the rows array) 

 

I am having problems executing these rest calls, it gives 400 (Bad Request) (SetConfigurationTable) or 403 (Forbidden) (SetConfigurationTableRows) 

 

Am I missing any step/ maybe doing something wrong ?

 

PaiChung
22-Sapphire I
(To:mdeshpande-2)

For the set ... that might be hard since it is of type infotable.

I would try it using the PostJSON in Thingworx so you at least you can do a get of the configuration table, edit it and then post it.

 

Announcements


Top Tags