與其他應用程式整合 > 數位產品追溯 > 在 ThingWorx 中配置 Windchill 數位產品追溯 (DPT) 延伸功能 > 先決條件
  
先決條件
已啟用 ThingWorx 以允許匯入 Windchill 延伸功能。
依預設,在 ThingWorx 中針對所有使用者匯入延伸功能為禁用。欲啟用匯入,請配置 platform-settings.json 檔案。如需詳細資訊,請參閱「ThingWorx Platform 說明中心」的 platform-settings.json Configuration Details
1. 開啟 platform-settings.json 檔案。依預設,此檔案位於 ThingworxPlatform 資料夾中。
2. 新增下列 ExtensionPackageImportPolicy 參數,或將其更新為 true,以允許匯入延伸功能。
* 
依預設,所有參數都設定為 false。有關每個參數的詳細資訊,請參閱 platform-settings.json
"ExtensionPackageImportPolicy": {
"importEnabled": false,
"allowJarResources": false,
"allowJavascriptResources": false,
"allowCSSResources": false,
"allowJSONResources": false,
"allowWebAppResources": false,
"allowEntities": false,
"allowExtensibleEntities": false
},
3. 儲存並關閉 platform-settings.json 檔案。
如需瞭解有關組態的最佳作法,請參閱「ThingWorx Platform 說明中心」的匯入延伸功能
* 
請參閱所支援版本的 ThingWorx 應用程式的文件集。
請將 ThingWorx 配置為允許跨原始來源請求。
將 CORS (跨原始來源資源共用) 篩選器新增至 ThingWorx Flow 伺服器,可啟用跨原始來源請求。此設定可讓外部 OSLC 伺服器從 ThingWorx Flow 伺服器存取資料。
完成下列步驟,可讓網站對 ThingWorx Flow 進行 REST 呼叫:
1. 關閉任何執行中的 Nginx 實例。
2. 從 Nginx 安裝目錄中的下列位置開啟 vhost-flow.conf 檔案。
Windows:C:/Program Files/nginx-<版本>/conf/conf.d
Linux:/etc/nginx/conf/conf.d
3. vhost-flow.conf 檔案中的 location /Thingworx 部份下,找到 proxy_set_header X-Content-Type-Options nosniff; 一行,然後新增下列行:
set $cors '';
# Right side of condition can be regular expression:
# if ($http_origin ~ '^https?://(localhost|www\.yourdomain\.com|www\.yourotherdomain\.com)')
if ($http_origin = '<Origin_that_calls_ThingWorx_Flow>') {
set $cors 'true';
}
if ($cors = 'true') {
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
}
# OPTIONS indicates a CORS pre-flight request
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '$http_origin';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
4. <Origin_that_calls_ThingWorx_Flow> 取代為嘗試存取 ThingWorx Flow 之網站的 URL。
5. 重新啟動 Nginx 服務。
如需瞭解有關「跨原始來源資源共用」(CORS) 設定的詳細資訊,請參閱 ThingWorx Platform 說明中心內的從外部網站對 ThingWorx Flow 進行 REST 呼叫
* 
請參閱所支援版本的 ThingWorx 應用程式的文件集。
Windchill 伺服器作為安全網域新增到 OSLC 伺服器的白名單中。
Windchill 作為安全網域新增到配置了 Windchill RV&SWindchill ModelerIBM Rational Doors NG 的 OSLC 伺服器中,以便能夠從 Windchill 存取委派的介面。如需有關如何將網域新增為安全網域的詳細資訊,請參閱參考文件中的 Windchill RV&S OSLC Server (Windchill RV&S OSLC 伺服器) 指南 (從 12.3.0.0 開始),以及「Windchill Modeler 說明中心」內的 OSLC integration with Integrity ModelerOSLC integration with IBM Rational DOORS Next Generation 主題。
* 
請參閱所支援版本的 Windchill RV&SWindchill Modeler 應用程式的文件集。
從 PTC.com 的 PTC 軟體下載頁下載 Windchill_Digital_Product_Traceability_Bundle 壓縮檔 (12.0.0.0)。此壓縮檔可在 Windchill PDMLink 產品系列下找到,其內容包括:
1. Windchill_Digital_Product_Traceability-extension - Windchill DPT 延伸功能壓縮檔。
2. Windchill_Digital_Product_Traceability_Config_Things - 範例物件 XML 檔案的壓縮檔。
* 
如果您在瀏覽器中收到了憑證錯誤訊息,請使用由可信任的憑證機構 (CA) 頒發及核對的標準 SSL 憑證。如果您有自行簽名憑證,請在您的瀏覽器中將自行簽名憑證匯入為可信任憑證。
如需有關 ThingWorx 使用者設定檔所需權限的資訊,請參閱 ThingWorx Platform 實體的權限
如需有關配置 DPT 延伸功能的詳細資訊,請參閱配置 Windchill DPT 延伸功能