Trading Networks 10.3 | Administering and Monitoring B2B Transactions | webMethods Module for EDI | Preparing to Process Inbound Non-TRADACOMS Documents Using Trading Networks | Coding Services to Process Transaction and Group Documents | Logic to Process a Transaction Document
 
Logic to Process a Transaction Document
The following sample code shows the logic you might want to apply when creating a service that will process a Transaction document that contains a single transaction set from an inbound EDI document. The processing in this example shows how to map information from the transaction set to an internal-format and send the document to an internal application.
Flow operation
Description
1
Invoke thewm.b2b.editn:getTspace service to retrieve the content of the Transaction document from the BizDocEnvelope (in the bizdoc variable) and use it to populate the edidata variable.
You can use the getTspace service regardless of whether the document is considered large. For more information about large document handling, see Handling Large Documents When Using Trading Networks .
For more information about the getTspace service, see webMethods Module for EDI Built-In Services Reference .
2
Invoke the wm.b2b.edi:convertToValues service to:
*Convert the content of the Transaction document (in the edidata variable) from either String or InputStream object into an IData object.
*Validate the structure of the EDI transaction.
The inputs to the convertToValues service include the flat file schema for the EDI transaction. The convertToValues service uses the flat file schema to determine how to parse the transaction set into an IData object and to validate its structure.
For more information about the convertToValues service, see webMethods Module for EDI Built-In Services Reference .
3
Map the data from the EDI transaction set into a document in internal format.
Now that the transaction set is an IData object, you can access the data in the transaction set to map it to an IData object for the internal-format document. Depending on the complexity of your mapping requirements, you might need to add more logic than a MAP flow operation, or create a separate service to perform the mapping.
4
Invoke the wm.b2b.edi:convertToString service to convert the document in internal format from an IData object into a String.
The input to the convertToString service includes the IData object, which contains the data and the flat file schema for the internal-format document. convertToString uses the flat file schema to determine how to form the internal-format document. Alternatively, convertToString can use an IS document type to define the structure of the internal-format document.
For more information about convertToString, see webMethods Module for EDI Built-In Services Reference .
5
Branch based on the value of the EDI Processing Mode custom attribute. This attribute is in the bizdoc/Attributes/EDI Processing Mode variable. Module for EDI sets the value of the EDI Processing Mode custom attribute based on the setting of the EDITPA processingMode variable. For more information, see processingMode Variable.
6
If the value of the EDI Processing Mode custom attribute is:
* Production—Send the internal-format document to the internal (back-end) system, by adding your own logic or invoking a service that you created.
*A value other than Production (for example, Testing)—Invoke wm.pub.flow:debugLog to log a message to the server log. For example, the message may be, “Testing document was received but not sent to back-end system.”