B2B Integration 10.2 | Administering and Monitoring B2B Transactions | webMethods Module for EDI | Processing Inbound TRADACOMS Documents Using Trading Networks | Coding Services to Process File and Batch Documents When Using TRADACOMS | Logic to Process a File Document
 
Logic to Process a File Document
The following sample code can be invoked by a processing rule to process a file document. This service creates one file document type that contains all the detail messages contained in the file. Alternatively, you can write a service that creates a file document type for each detail message, as described in Storage Options for File Document Types.
Flow operation
Description
1
Invoke the EDI built-in service wm.b2b.edi.tradacoms.doc:isFileEnvelope to determine whether a BizDocEnvelope contains a TRADACOMS File document.
2
Invoke the wm.b2b.edi.tradacoms.doc:getFFSchemaNames service to return the name of the flat file schemas that can be used to parse the parts of the TRADACOMS file. This service returns up to four flat file schemas: a header schema, a detail schema, a VAT schema (if present), and a trailer schema.
3
Invoke the wm.b2b.edi.tradacoms.doc:getDocumentPartInfo service to return the number of detail messages contained in the TRADACOMS file and to determine whether the file contains VAT information.
4
Invoke the wm.b2b.edi.tradacoms.doc:getDocumentPart service to return the content part object representing the header message.
5
Invoke the wm.b2b.editn.util:getContentPartDataAsInputStream service to obtain the data, as an input stream, from the content part. This service determines whether the document is stored in memory or on disk.
6
Invoke the wm.b2b.edi.tradacoms:convertToValues service to convert the content part input stream to an IS document (IData object) based on the input flat file schemas.
7
Determine whether the file contains a VAT message. If it contains a VAT message, parse the VAT message by invoking the getContentPartInfo, getDocumentPartDataAsInputStream, and convertToValues services, as you did for the header message.
8
Parse the trailer message by invoking the getContentPart, getDocumentPartDataAsInputStream, and convertToValues services, as you did for the header message.
9
Parse the detail messages by executing a loop and invoking the getContentPart, getDocumentPartDataAsInputStream, and convertToValues services for each detail message, as you did for the header message. In addition, invoke the wm.b2b.edi.util.documentList:addDocToDocumentList service to put all detail messages into a document list.
10
Append the documents to a document list by invoking the pub.list:appendToDocumentList service.
For more information about these built-in services, see webMethods Module for EDI Built-In Services Reference .

Copyright © 2016- 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.