Invoking Custom Code to Complete a Purchase Order
The Java Invoke activity can be used to write custom code to get information from a legacy system, retrieve binary data, and so on.
Assume, for example, information from an ERP system is sent to a business partner using a B2B XML protocol such as CXML or RosettaNet. If some fields required by the protocol are not available from the ERP system, the missing information can be retrieved using the Java Invoke activity. The activity can access, for example, a CSV file. You can then combine the information coming from the ERP system and the CSV file and send it to the business partner.
Procedure
Result
Understanding the Configuration
The sample uses the Read File activity to read and parse an XML file into an XML tree. The Java Invoke activity gets customer information from the csvFile.log file and makes it available to the process. A Map activity combines the Read File and Java Invoke output to build a complete schema, which contains the purchase order and customer information. The combined information is passed to the RenderPOXML activity that converts the information to XML string, using the specified schema. The process then publishes the XML string by writing it to the CompletePo.xml file in C:\tmp\InvokeCode.
- PurchaseOrderSchema used by ParsePO XML, which parses the PO.
- CustomerSchema referenced by CompletePO, which contains customer information.
- CompletePO used by Render PO XML and has information on both the purchase order and the customer. CompletePO is a combination of PurchaseOrderSchema and CustomerSchema.
To view the Java source, fully expand the src directory and double-click JavaProcessJavaCode.java.