Base Setup
Once the sharedconfig.properties are set, continue setup by following the steps below:
-
Context Mode: To ensure that the OIEP always sends cross context formatted Advanced STEPXML to PDX, set the 'Context Mode' to 'Cross Context Format' as highlighted below:
-
Number of Events to Batch: In the Event Queue Configuration flipper, set the 'Number of Events to Batch' parameter to a maximum of 500 for optimal performance of the integration.
-
Output Templates: Set the format for the PDX integration to Advanced STEPXML and the ensure template contains the following tags:
-
ContextList
-
CrossReferenceTypes
-
UnitList
-
AttributeList
The following is an example template:
Copy<STEP-ProductInformation ResolveInlineRefs="true" FollowOverrideSubProducts="true">
<ContextList ExportSize="Minimum"/>
<CrossReferenceTypes ExportSize="Minimum"/>
<UnitList ExportSize="Minimum"/>
<AttributeList ExportSize="Minimum"/>
<Products ExportSize="Minimum" FlattenHierarchy="false">
<Product/>
</Products>
<Assets ExportSize="Referenced"/>
</STEP-ProductInformation>
-
-
Pre-processor: In the Output Templates flipper for the PDX OIEP, set the pre-processor option to 'PDX Pre-processor 2.'
For the Only Changes parameter:
-
No - means all products in the event queue will be sent.
-
Yes - means only products with a changed revision will be sent.
-
-
Delivery Method: In the Delivery Method flipper for the PDX OIEP, choose 'Product Data Exchange 2.'
The following parameters are valid for all authentication methods:
-
Server URL - Select the appropriate target PDX environment.
-
Proxy Config - If an HTTP Proxy has been configured, choose it from dropdown list. For more information on how to configure a proxy, refer to the topic HTTP Proxy Configurations in the Data Exchange documentation here.
-
Default Context - Specify which of the contexts included in the OIEP configuration is the default. The data in this context is used to populate the default language layer in PDX. The STEP Name in this default context will be the name of the master data product in PDX since the STEP Name in PDX does not have language layers.
Important: Channel assignment rules in PDX are evaluated based on the values available in the default language layer.
-
Upload Assets - determine the appropriate setting based on how you transfer assets to PDX.
-
Set to 'Yes' to send assets by the delivery method.
-
Set to 'No' to exclude asset binary content, while still sending asset metadata.
-
-
Upload only changed assets - This parameter is only effective when the Upload Assets parameter is set to 'Yes'.
-
Set to 'Yes' to only include referenced asset objects where either the attribute values or the asset content has changed.
-
Set to 'No' to upload all existing assets.
-
The Basic Authentication section is required for API access via user name and password:
-
API User Name - Enter the API user name of a PDX user associated with a relevant account on the targeted environment.
-
API Password - Enter the API password of a PDX user associated with a relevant account on the targeted environment.
The Token-based Authentication section is required for token access via OAuth 2.0 authorization protocol:
-
Auth Header Value Function - Select a business function that produces the required authentication headers. For general information about business functions, refer to the Business Functions topic in the Business Rules documentation. For examples using basic authentication or proxy, refer to the Token-based Authentication Function Example section below.
-
Token-based Authentication Function Example
Use the steps below to create an example business function for token-based authentication with or without using a proxy.
-
In PDX, go to Manage team / User management / API keys and generate a key. Refer to PDX Help Center / Documentation for more information.
-
In STEP, create a JavaScript Function with:
-
Bind for secret (add variable name; Binds to = Secret; Parameter = ClientSecret (generated via PDX 'API keys' option)
-
Return Type = 'Map<String,String>'
-
JavaScript = example code below
-
-
Make necessary updates in the JavaScript for your system:
-
YourClientID = 'ID' of the generated API key
-
Verify the URL variable is aligned with the appropriate PDX environment (QA or PROD)
-
To use a proxy, uncomment the 'Proxied token request' section and modify as required
-
Add your secret Bind variable (pdxSecret is used in this example)
-
-
Test your integration.
logger.info("================== PDX Auth has been called ==================");
var clientID = "YourClientID";
var url = new java.net.URL("https://auth.pdx.stibosystems.com/auth/realms/pds/protocol/openid-connect/token");
/// Proxied token request
//var proxy = new java.net.Proxy(java.net.Proxy.Type.HTTP, new java.net.InetSocketAddress(java.net.InetAddress.getByName("proxy.host.name"), proxyPortNumber));
//var http = url.openConnection(proxy);
// non proxied token request
var http = url.openConnection();
http.setRequestMethod("POST");
http.setDoOutput(true);
http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
http.connect();
var os = http.getOutputStream()
try {
os.write(new java.lang.String("grant_type=client_credentials&client_id="+clientID+"&client_secret="+pdxSecret).getBytes());
} finally {
os.close();
}
var input= http.getInputStream();
try {
var reader = new java.io.BufferedReader(new java.io.InputStreamReader(input));
var string ="";
while (reader.ready()){
string=string+reader.readLine();
}
var json = JSON.parse(string)
var map = new java.util.HashMap();
map.put("Authorization",json.token_type + " " + json.access_token);
logger.info("Authorization "+json.token_type + " " + json.access_token);
return map;
} finally {
reader.close();
}