Base Setup

Configure the PDX OIEP with the following settings:

  1. 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:

  2. 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.

  3. 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>
  4. Pre-processor: In the Output Templates section 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.

  5. Delivery Method: In the Delivery Method flipper for the PDX OIEP, choose 'Product Data Exchange 2.' Refer to the Product Data Exchange 2 Delivery Method topic for details on configuring the required sharedconfig.properties and setting the parameters.

  6. Review additional set up and configuration implementation based on your product record information as defined in the Setting Up the PDX OIEP topic.

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.

  1. In PDX, go to Manage team / User management / API keys and generate a key. Refer to PDX Help Center / Documentation for more information.

    Important: Existing PDX integrations moving to OAuth must not enter a source system ID when creating keys (which causes duplication of attribution created in the previous integration setup).

  2. 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

  3. 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)

  4. Test your integration.

Copy
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();