I have an issue that is happening in 1 of 2 servers.
I would like to dynamically load a model from a file repo thing in Thingworx on public mode.
In 1 server, it works correctly but on the other it does not and prompts me for a login instead of loading the file.
I have checked and the permissions seem to be correct, as do the app keys. I was successfully able to get a property to display correctly and to trigger a service on the file repo thing to show a string without it prompting me for a login but when I try to load the pvz dynamically it prompts me for a login.
The FileRepo Thing permissions are correct, as are the datatable and the standard permissions needed.
Is there an additional back end permission required to download a pvz?
To add: The same thing happens when I use GetFileListingWithLinks.
Hello @JR_10569306 ,
I checked that in the current version 9.25 Studio and ES 9.23 (not latest but also not so old)to see if there an issue
- so one point I remember that possibly have the TWX data stability is the setting of the option on ES nohttp2”: true
in previous releases it was documented in PTC Vuforia Studio Help for the Camera widget. I could not find it in the current Help there and possibly is not required or set by default. On my ES 9.23 is that option not set but it still work
please see
saying:
nohttp2 Flag Needs to Be Added Manually
An issue was resolved where a nohttp2 flag had to be manually added to the configuration.json file to enable communication between the Experience Service and ThingWorx. Therefore, beginning in 9.23.0, you will no longer need to manually add the flag to your configuration.json file.
and
https://www.ptc.com/en/support/article/CS439719
so means that sinse Experience Service Version9.23 we do not need to set this option
But what I think is more relevant point is to add the used TWX services in the Vuforia Studio External data section. I tested it with different services and it will not work (also when all TWX permission are set correctly ) when the called services are not added in the Studio External data section:
anyway when you follow the suggested techniques described in Vuforia Studio Help : Create an Experience with Dynamic Model Loading it should work
Another point I remember if you connect to 2 different TWX objects and you are using services with the same name -e.g. myTestSrv - when you have this case and you added services 2 times from different objects - it internally Studio will rename the second service as myTestSrv_2 or _3 when 3 times ans so on .. but Vuforia Studio will display myTestSrv - so you need to call the correct service in that case.myTestSrv_2 in the JS code or in complete service all.
I will try to update the nonworker server's configuration.json with "nohttp2":true. The working server has that but the nonworker server does not so that could be the issue.
Here I want to add an example I used to test that where you can download the example.
To get it working on your server you need to setup the following steps:
-remove the External data and add you External data section object for the file repository where you saved /from where you want to downlaod the pvz files, then you can adopt the widget and file repository names
//////////////////////////////////////////////////////////////
$scope.wdgName='model-1' //set you model widget
$scope.SOURCE_PROP='src'
const TWXmodelID = 'CADtestFileRep1' // the name of the File Repository
const serviceName = 'LoadBinary'
and your pvz list - what you want to download dynamically:
$scope.app.ListeMods=[
{'name':'3dgauge1','pvz':'/PVZ/3dgauge1.pvz','scale':3},
{'name':'Coffee Maker Model_High','pvz':'/PVZ/Coffee Maker Model_High.pvz','scale':3},
{'name':'engine_test_exp','pvz':'/PVZ/engine_test_exp.pvz','scale':0.5},
{'name':'HLBtn','pvz':'/PVZ/HLBtn.pvz','scale':1},
{'name':'remote-control','pvz':'/PVZ/remote-control.pvz','scale':2},
{'name':'ventil_bg_creosave','pvz':'/PVZ/ventil_bg_creosave.pvz','scale':3},
{'name':'wandregal','pvz':'/PVZ/wandregal.pvz','scale':0.5}
]
That is all ,then should work. Thanks
... an additional change to work with your repository - use the variable also in the complete event callback
TWXmodelID
so it needs the also the change that
//===========================================================
// functon calling TWX service LoadBinary
//===========================================================
$scope.app.LadeModel = function(widgetName,path ) {
console.warn("$scope.app.LoadModel(",widgetName,",src,",path,")")
$scope.wdgName=widgetName
$scope.serviceName='LoadBinary'
console.log("calling LoadModel");
var parameters = {"path":path} ; console.warn(parameters)
console.log(JSON.parse(JSON.stringify( parameters)))
//change that below
//twx.app.fn.triggerDataService('CADtestFileRep1','LoadBinary',JSON.parse(JSON.stringify( parameters)));
//to this below ... so use variable for the TWX repository instead of fix string
twx.app.fn.triggerDataService(TWXmodelID,'LoadBinary',JSON.parse(JSON.stringify( parameters)));
$scope.$applyAsync();
console.log("after callLoadBinaryContent wdgName:"+$scope.wdgName)
};
after some discussion I extend the example provided in the previous post with functionality. Now in the new example it will get the list of all objects (pvz's) of specific FileRepository folder. To use that example :
1.) import it to Vuforia Studio
2.) remove from External Data section -all object
3.) add you repository object and the following services : LoadBinary and GetFileListingWithLinks
4.) Open the Home.js and change:
//////////////////////////////////////////////////////////////
$scope.wdgName='model-1' // your model widget
$scope.SOURCE_PROP='src'
const TWXmodelID = 'CADtestFileRep1' // your repository TWX thing
const TwxSrvRepPVZ = 'LoadBinary' // src TWX 1
const TwxSrvRepFolderList = 'GetFileListingWithLinks' // src TWX 2
const TwxRepFolder='/PVZ' //here you folder in the Cad Repository e.g. /data/CAD/pvz
//===========================================================
also added userpick which popup for 4.5 seconds a info about the clicked object. There is no metadata json dynamicaly loaded but the PTC metadata api seems to work. Verified that last version in preview but it should work also on mobile
Roland,
Thank you for all your help. I was able to work with a colleague to find a solution that worked.
1.CS264349 - Error "ApplicationKey Is Not Allowed As A URL Parameter" received while trying to use an Application Key in a URL to run a ThingWorx Service I had to go to the platform subsystem and allow it to use an application key as a url parameter
2. I added the es-public-access url to the download link that I was creating in my service. It looked like:
jsonlink=jsonlink +'?<appkey>';
That allowed this experience to work on both servers without prompting the user for a login.
Thank you again for your help
Hi @JR_10569306,
I wanted to see if you got the help you needed.
If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Of course, if you have more to share on your issue, please pursue the conversation.
Thanks,
Anurag