Trading Networks 10.7 | Administering and Monitoring B2B Transactions | webMethods Module for EDI | Forming EDI Documents to Send Outbound When Using Trading Networks | Delivering the Outbound EDI Document | Routing the Outbound EDI Document to Trading Networks | Creating a BizDocEnvelope for the Outbound EDI Document
 
Creating a BizDocEnvelope for the Outbound EDI Document
This section describes how to create the createEDIBizDoc service that is used in the code sample in Adding Logic to the Service that Forms the EDI Document that Routes through Trading Networks .
The service creates a BizDocEnvelope and adds the outbound EDI document to the BizDocEnvelope as a content part.
The following table lists the input parameters for the createEDIBizDoc service:
Input Parameter
Description
OutboundEDIDoc
The outbound EDI document in string format.
sender
The sender ID for the sender of the outbound EDI document. This is the sender at the interchange or transmission level.
senderQualifier
The EDI ID qualifier for the sender, for example, 01 if you specify a D-U-N-S number for sender.
receiver
The receiver ID for the receiver of the outbound EDI document. This is the receiver at the interchange or transmission level.
receiverQualifier
The EDI ID qualifier for the receiver, for example, 01 if you specify a D-U-N-S number for receiver.
standard
The EDI standard of the outbound EDI document; standard should be one of the following:
*X12 for an ANSI X12 document
*UNEDIFACT for a UN/EDIFACT document
*VDA for a VDA document
*TRADACOMS for a TRADACOMS document
controlNumber
The interchange or transmission control number to use for the Trading Networks DocumentID and GroupID system attributes.
encoding
Optional. The name of a registered IANA character set (for example, ISO-8859-1) that is used as input to the pub.string:stringToBytes service and then used to convert the EDI document into byte[] format. To use the default encoding, set this value to autoDetect. If you specify an unsupported encoding, an exception will be thrown.
The following table shows the output parameter for the createEDIBizDoc service:
Output Parameter
Description
bizdoc
The BizDocEnvelope for the outbound EDI document. This is a Document Reference to the IS document type, wm.tn.rec:BizDocEnvelope.
The following figure illustrates the flow operations used for the service that creates a BizDocEnvelope for the outbound EDI document.
Flow operation
Description
1
Invoke the pub.string:stringToBytes service to convert the outbound EDI document from string format to a byte[]. Map the input parameters of the createBizDoc service, OutboundEDIDoc and encoding, to the input parameters of the stringToBytes service, string and encoding, respectively.
Map the output of the stringToBytes service (bytes).
Convert the format to a byte[] because the service to add the content part to the BizDocEnvelope requires the content part to be in byte[] format.
2
Invoke the wm.b2b.editn:ediPartnerIDToTNPartnerID service to retrieve the Trading Networks internal ID for the sender. Map the input parameters of the createBizDoc service, sender and senderQualifier, to the input parameters of the ediPartnerIDToTNPartnerID service, identifier and qualifier, respectively.
Map the output of the ediPartnerIDToTNPartnerID service (id), to senderID, which is a parameter that you define in Pipeline Out.
3
Use a BRANCH operation to branch based on whether the senderID is null. If senderID is null, use a MAP flow operation to set the value of senderID to 000000000000000000000000 (24 zeros), which indicates the Unknown partner.
4
Invoke the wm.b2b.editn:ediPartnerIDToTNPartnerID service to retrieve the Trading Networks internal ID for the receiver. Map the input parameters of the createBizDoc service, receiver and receiverQualifier, to the input parameters of the ediPartnerIDToTNPartnerID service, identifier and qualifier, respectively.
Map the output of the ediPartnerIDToTNPartnerID service, id, to receiverID, which is a parameter that you define in Pipeline Out.
5
Use a BRANCH operation to branch based on whether the receiverID is null. If receiverID is null, use a MAP flow operation to set the value of receiverID to 000000000000000000000000 (24 zeros), which indicates the Unknown partner.
6
Invoke the wm.tn.doctype:view service to determine the Trading Networks internal ID for the TN document type to use for the outbound EDI document. Specify the name of the TN document type as input, and you can retrieve the internal ID from the output.
The name of the TN document type will be either 1) X12 Envelope, 2) UNEDIFACT Envelope, or 3) TRADACOMS Transmission. For example, to set this value at run time, set the value of the typeName input parameter for the view service as follows:
The variable substitution %standard% picks up the value of the standard input parameter of the createBizDoc service, which should be X12, UNEDIFACT, or TRADACOMS.
7
Invoke the wm.tn.doc:createNewEnvelope service to create the BizDocEnvelope for the outbound EDI document. To set the inputs to the createNewEnvelope service, map:
*The Trading Networks internal IDs for the sender and receiver, which are in Pipeline In in the senderID and receiverID parameters, to the Service In variables, senderID and receiverID, respectively.
*The controlNumber input parameter of the createBizDoc service, which is in Pipeline In, to the Service In variables, documentID and groupID.
*The Trading Networks internal ID for the TN document type, which is in Pipeline In in the type/TypeID variable to the Service In typeID parameter.
8
Invoke the wm.tn.doc:addContentPart service to add the outbound EDI document (in byte[] format) to the BizDocEnvelope. To set the inputs to the addContentPart service:
*Map the content of the outbound EDI document that is in byte[] format, which is in Pipeline In in the EDIcontent parameter to the Service In partBytes parameter.
*Set the value of the Service In partName parameter to EDIdata.
*Set the value of the Service In storageType parameter to database.