ERP Connector Customization Examples
Using a JMS queue as a distribution target
This requires performing the following steps:
1. Create a soft extension of ESITarget using the Type and Attribute Management UI, to represent a JMS queue type distribution target. This may be achieved via the NewSubtype option that appears upon clicking the right mouse button on the Distribution Target node.
|
Make sure the Instantiable property is set to Yes when creating the soft extension.
|
2. Add a new organizer (named say, JMS_Queue) under > from the Manage Global Attributes UI to define the attributes for the new soft extension created in (1). Add attributes such as queueName, priority etc. as may be required.
3. Associate the attributes defined in (2) to the soft extension, using the Create a new attribute option from the Attributes tab.
4. Associate XSL specific attributes such as XSL DB User, XSL Parameters, XSLPassword and XSL URL as well to the soft extension. These appear as Global Attributes under > >
5. From the Layouts tab, add the required attributes to the selected layout (for example, Create/Edit page).
7. Create an instance of the soft extension using the Manage Distribution UI, setting its attributes queueName and priority to the required values. Set the taskURI attribute to point to the I*E task created in (6), and the other attributes as appropriate.
8. Associate the distribution target instance created in (7) to a business object (such as apart) and release it.
|
The sample task delivers the ESI response message to the specified queue in ESI XML format. Also, see the Windchill Customizer’s Guide and the online help for more information on the Type and Attribute Management UI.
|
Useful Information
The sample task provided in section
Sample I*E task that delivers the ESI response to a JMS queue resides in
<Windchill>/tasks/com/ptc/windchill/esi/examples/ExportToJMS.xml, and makes use of the I*E message webject named Create-Object. Given the content, the webject delivers it to the specified JMS queue.
|
See the Windchill Info*Engine User’s Guide for more information on the Create- Object webject and the associated settings that are required for its functioning.
|
◦ Webject Parameters:
Parameter: QUEUE
Description: The name of the queue to which the message is to be sent.
Parameter: PRIORITY
Description: Specifies an integer priority for the message.
Default value: 4.
Parameter: TYPE
Description: Sets the type of message to create.
Default value: TextMessage.
Parameter: PUT_STRING
Description: The data content to be sent to the queue.
Parameter: GROUP_OUT
Description: Name of output group.
Default value: output.
The sample task essentially does the following:
|
See the Configurable Options section for information on the input parameters that are passed to the task.
|
1. Fetches the queueName and priority attributes on the distribution target that is passed in, by invoking the getSoftAttribute() API on the ESITarget object that is obtained from the target parameter. Adds the parameters QUEUE and PRIORITY to the task using the fetched values
2. Obtains the content to be delivered by invoking getVdb().toXML().
3. Fetches the XSL related attributes from the distribution target, and if they are found set, transforms the content obtained in (2) using the applyXSL() API of com.ptc.windchill.esi.lite.util.XSLTransformer.
4. If steps (1) through (3) could be completed successfully and the ERP Connector preference Enable Response Cache has a value Yes, creates a copy of the response data at a location specified by the preference ESI Response Cache Location.
5. If all of the above steps could be completed successfully, adds the parameter CONTENT to the task using the value fetched in (3). The Create-Object webject is then invoked, passing in the relevant values for its parameters. If the webject was executed successfully and if the ERP Connector preference Enable Post Result has a value Yes, the task in
<Windchill>/tasks/com/ptc/windchill/esi/export/ParseAndProcessResult.xml is invoked. See the ParseAndProcessResult section for information on the input parameters that are passed to the task
|
If any of the steps (1) through (3) resulted in an error, step (4) is not performed. Instead, the task in ParseAndProcessResult.xml is invoked, so as to record the failed transaction status in Windchill.
|