Walkthrough: Receiving EDI over AS2 with an Asynchronous MDN

This walkthrough provides a set of step-by-step procedures that creates a solution for receiving EDI messages over AS2 transport, returning synchronous MDNs.

How the Solution Receives an EDI Interchange and Returns an Asynchronous MDN

The solution will do the following:

  1. Receive an AS2 message containing an EDI interchange over HTTP from the trading partner, and decode the interchange from EDIINT/AS2.

    Bb727975.note(en-us,BTS.20).gifNote
    The events in this list may not occur in the order shown.

  2. Generate an MDN response, and drop it in the MessageBox.

  3. Pick up the message MDN by a send port.

  4. Return the asynchronous message MDN to the trading partner.

  5. Convert the EDI format of the interchange to internal XML format, and drop it in the MessageBox.

  6. A send port with a PassThruTransmit pipeline picks up the message XML file from the MessageBox.

  7. The send port sends EDI interchange XML file to a folder at the Contoso party.

The following figure shows the architecture for this solution.

AS2 receiving with an asynchronous MDN

The Functionality in this Solution

The following applies to the functionality of this walkthrough:

  • An EDI acknowledgment is not generated. Generating an EDI acknowledgment is demonstrated in Walkthrough: Receiving EDI Interchanges. Sending an EDI acknowledgment over AS2 transport is described in Walkthrough: Sending EDI over AS2 with an Asynchronous MDN.

  • The solution is designed for interchanges using X12 encoding, not EDIFACT encoding.

    Bb727975.note(en-us,BTS.20).gifNote
    The configuration used for EDIFACT encoding is closely parallel to that used for X12 encoding.

  • EDI type and extended validation will be performed on the incoming interchange.

  • AS2 and EDI reporting will be enabled, and transaction sets will be saved for viewing from the interchange status report.

  • This solution does not configure signing, compression, encryption, or message storage in the non-repudiation database. For procedures on configuring those properties, see Configuring AS2 Party Properties.

Configuration Steps

The procedures required for this solution include the following:

  • Create a party for the trading partner Fabrikam that the AS2 message is received from. Configure the AS2 properties for receiving an AS2 message, sending a synchronous MDN in return. Configure the EDI properties for BizTalk to receive an EDI interchange from that party.

  • Build and deploy a BizTalk project with the required message schema, making the schema available for use by BizTalk Server in processing the received interchange.

  • Enable the BTS ISAPI filter used in receiving the AS2 message.

  • Create a Contoso virtual directory that receives the AS2 message from Fabrikam, as configured in the receive location.

  • Create a Fabrikam virtual directory that receives the MDN from Contoso.

  • Specify that the Contoso and Fabrikam virtual directories are not managed by Windows SharePoint Services.

  • Create a static one-way HTTP receive port for BizTalk Server to receive the AS2 message containing the EDI business document from the trading partner. Configure the receive pipeline to be the AS2EDIReceive pipeline.

  • Create a dynamic one-way HTTP send port for BizTalk Server to send the MDN responding to the received AS2 message.

    Bb727975.note(en-us,BTS.20).gifNote
    This send port subscribes to the MDN based on the EdiIntAS.IsAS2AsynchronousMDN property (which was set to True by the AS2EdiReceive pipeline) and correlation tokens. The send port must be dynamic, so it will send the MDN to the address in the Receipt-Delivery-Notification line in the header of the message.

  • Create a static one-way FILE send port to route the EDI payload (in XML format) to a local folder. Create the local folder.

Testing the Walkthrough

You can test the solution by using the HTTP Sender utilities that is shipped as part of the AS2 tutorial files. This utility sends a test AS2 message containing an EDI interchange over AS2 transport. This utility sends a test AS2 message containing an EDI interchange over AS2 transport (X12_00401_864-Sync.edi, also shipped with the AS2 tutorial). The HTTP Sender and the test message that you use for this walkthrough are the same as the versions that shipped for the tutorial.

The following are prerequisites for performing the procedure in this topic:

  • You must be logged on as a member of the BizTalk Server Administrators group.

  1. Right-click the Parties node in the BizTalk Server 2006 Administration Console, point to New, and then click Party to create a party that BizTalk will receive the interchange from.

  2. Enter Fabrikam for the party in the Name text box.

  3. In the first open line of the Aliases list, type EDIINT-AS2 From Value for Name, enter AS2-From for Qualifier, and enter Fabrikam for Value. Click OK.

    Bb727975.note(en-us,BTS.20).gifNote
    An entry for AS2-From is required in the alias list of the party's general properties because BizTalk Server matches this value to the AS2-From header in the incoming message to perform party resolution on the receive side.

  4. Right-click Fabrikam in the Parties pane of the BizTalk Server 2006 Administration Console, and then select AS2 Properties.

  5. In the General pane, click Activate AS2 Reporting.

  6. Click Party as AS2 Message Sender in the console tree, and then do the following in the detail pane:

    1. Select Override inbound message properties.

      Bb727975.note(en-us,BTS.20).gifNote
      Selecting the Override inbound message properties property enables you to send the MDN to the Fabrikam virtual directory, instead of the Receipt-Delivery-Option in the message.

    2. Select Generate MDN.

    3. Clear Sign MDN.

    4. Select Transmit MDN asynchronously.

    5. For Receipt-Delivery-Option, enter http://localhost/Fabrikam/Default.aspx?Destination=

      _MDNToFabrikam.

  7. Click Party as AS2 Message Receiver in the console tree, and then do the following in the detail pane:

    1. In AS2-From, enter Contoso.

    2. In AS2-To, accept the default of Fabrikam.

  8. Right-click Fabrikam in the Parties pane of the BizTalk Server 2006 Administration Console, and then select EDI Properties.

  9. In the console tree of the EDI Properties dialog box, select X12 Interchange Processing Properties (for Party as Interchange Sender).

  10. Enter values for the qualifier and identifier fields for sender and receiver. For ISA5 enter ZZ; for ISA6 enter 7654321; for ISA7 enter ZZ; and for ISA8 enter 1234567.

    Bb727975.note(en-us,BTS.20).gifNote
    BizTalk requires the qualifier and identifier fields for sender and receiver in order to perform party resolution. It matches their values in the message with the value in the party definition.

  11. Clear Check for duplicate ISA13 (Interchange control number), so you can send multiple test input messages.

  12. In the Default Target namespace field, verify that the value selected is http://schemas.microsoft.com/BizTalk/EDI/X12/2006.

  13. Click ISA Segment Definition (for the party as interchange receiver) in the console tree, and then do the following:

    1. In the ISA5-6 (Sender qualifier and identifier) fields, select ZZ - Mutually Defined in the left-hand field (qualifier) and enter 1234567 in the right-hand field (identifier).

    2. In the ISA7-8 (Receiver qualifier and identifier) fields, select ZZ - Mutually Defined in the left-hand field (qualifier) and enter 7654321 in the right-hand field (identifier).

    3. For Suffix, select CR LF.

  14. Click GS and ST Segment Definition in the console tree, and then do the following:

    1. In the first row of the grid, check Default.

    2. In the For ST1 field, select 864 - Text Message.

    3. In the Version/Release field, enter 00401.

    4. In the Target namespace field, select http://schemas.microsoft.com/BizTalk/EDI/X12/2006.

    5. In the GS1 field, verify that TX - Text Message (864) is selected.

    6. In the GS2 field, enter 01.

    7. In the GS3 field, enter 7654321.

    8. In the GS4 field, select CCYYMMDD for the format for the date.

    9. In the GS5 field, select HHMMSSdd for the format for the time.

    10. In the GS7 field, select T - Transportation Data Coordinating Committee (TDCC).

    11. In the GS8 field, verify that 00401 is entered.

  15. Click OK to accept the configuration settings and close the dialog box.

  1. In Visual Studio 2005, create or open a BizTalk project.

    Bb727975.note(en-us,BTS.20).gifNote
    This project, which is shipped for the AS2 tutorial, includes an 864 schema for use with the test message.

    Bb727975.note(en-us,BTS.20).gifNote
    This topic assumes that you have already added a reference from your application to the BizTalk EDI Application, which contains EDI schemas, pipelines, and orchestrations. If not, see How to Add a Reference to the BizTalk Server EDI Application.

  2. Right-click your project, point to Add, and then click Existing Item. Move to the folder that your schema is in in <drive>:\Program Files\Microsoft BizTalk Server 2006\XSD_Schema\EDI, and then double-click your schema.

    Bb727975.note(en-us,BTS.20).gifNote
    If the EDI schemas have not been unzipped into the \XSD_Schema\EDI folders, execute the MicrosoftEdiXSDTemplates.exe file in the \XSD_Schema\ EDI folder to unzip the schemas into the default folder.

  3. Set the assembly key file, and then build and deploy the assembly.

  1. Click Start, point to Programs, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.

    Bb727975.note(en-us,BTS.20).gifNote
    The procedures in this walkthrough that enable the BTS ISAPI filter, configure the Contoso Web page, and specify that your virtual directory is not managed by Windows SharePoint Services are also included in the AS2 Tutorial.

  2. In the IIS Manager dialog box, right-click Web Service Extensions, and then click Add a new Web service extension.

  3. In the New Web Service Extension dialog box, enter BTS Http Receive ISAPI Filter in Extension Name.

  4. Click Add.

  5. In the Add file dialog box, browse to <drive>:\Program Files\Microsoft BizTalk Server 2006\HttpReceive. Select BTSHTTPReceive.dll, and then click Open.

  6. In the Add file dialog box, click OK.

    Bb727975.note(en-us,BTS.20).gifNote
    When you perform step 6, you may receive the following (or a similar) message: "This file is already required by HWSMessages HttpReceive.". If so, click Cancel, and then click Cancel again. In this case, the BTSHTTPReceive.dll file is already required by another Web service extension, and you do not have to complete this "Add File" or "Add a new Web service extension" procedure.

  7. In the New Web Service Extension dialog box, click OK.

  8. In the Web Service Extension pane of IIS Manager, right-click BTS Http Receive ISAPI Filter, and then click Allow.

  1. In IIS Manager, click Web Sites. Right-click Default Web Site, point to New, and then click Virtual Directory.

  2. In the Welcome to the Virtual Directory Creation Wizard page, click Next.

  3. On the Virtual Directory Alias page, enter Contoso as the Alias, and then click Next.

  4. On the Web Site Content Directory page, browse to <drive>:\Program Files\Microsoft BizTalk Server 2006\HttpReceive for the Path. Click Next.

  5. On the Virtual Directory Access Permissions page, select Execute (such as ISAPI applications or CGI). Leave Read selected. Click Next.

  6. On the page indicating successful completion, click Finish.

  7. In IIS Manager, right-click the Contoso virtual directory, click Properties, and note the Application pool associated with the virtual directory. Close the Contoso Properties dialog box.

    Bb727975.note(en-us,BTS.20).gifNote
    If the application pool is the same application pool that is associated with the Fabrikam virtual directory, step 8 is not required.

  8. Under the Application Pools node in IIS Manager, right-click the application pool noted in step 7 under the Application Pools node of IIS Manager, and then click Properties. In the Properties dialog box, click the Identity tab. Verify that the user name listed under Configurable is an administrator on the server, then click Cancel.

  9. Right-click the Contoso virtual directory, and then click Properties. In the Contoso Properties dialog box, click the Directory Security tab. In the Authentication and access control section, click Edit. In the Authentication Methods dialog box, select Enable anonymous access, click OK, and then click OK again.

  1. In IIS Manager, open the Web Sites folder. Right-click Default Web Site, point to New, and then click Virtual Directory.

  2. On the Welcome to the Virtual Directory Creation Wizard page, click Next.

  3. On the Virtual Directory Alias page, enter Fabrikam as the Alias, and then click Next.

  4. On the Web Site Content Directory page, browse to <drive>:\Program Files\Microsoft BizTalk Server 2006\SDK\AS2 Tutorial\Fabrikam for the Path. Click Next.

  5. On the Virtual Directory Access Permissions page, select Read and Run scripts (such as ASP), and then click Next.

  6. On the page indicating successful completion, click Finish.

  7. In IIS Manager, right-click the Fabrikam virtual directory under the Web Sites\Default Web Sites node, click Properties, and note the Application pool associated with the virtual directory. Close the Fabrikam Properties dialog box.

  8. Under the Application Pools node in IIS Manager, right-click the application pool for the Fabrikam virtual directory, and then click Properties. In the Properties dialog box, click the Identity tab. Verify that the user name listed under Configurable is an administrator on the server, then click Cancel.

    Bb727975.note(en-us,BTS.20).gifNote
    If the user name listed under Configurable is not an administrator, you can click Browse to select another user that is an administrator or you can add the user to the Administrators group in the Computer Management dialog box.

  9. Right-click the Fabrikam virtual directory under Default Web Site, click Properties, and then click the Directory Security tab. In the Authentication and access control section, click Edit. Select Enable anonymous access, click OK, and then click OK again.

  1. If Windows SharePoint Services is installed on your computer, click Start, point to Programs, point to Administrative Tools, and then click SharePoint Central Administration.

    Bb727975.note(en-us,BTS.20).gifNote
    This procedure is required if Windows SharePoint Server is installed on the same computer that you are setting the walkthrough up on. In that case, you must specify that your IIS virtual directory is not being managed by Windows SharePoint Server.

  2. On the Central Administration page, under Virtual Server Configuration, click Configure virtual server settings.

  3. On the Virtual Server List page, click Default Web Site.

  4. On the Virtual Server Settings page, under Virtual Server Management, click Define Managed Paths.

  5. In the Define Managed Paths page, under Add a New Path, in the Path text box, enter Contoso. Under Type, click Excluded Path, and then click OK.

  1. In BizTalk Server 2006 Administration Console, right-click the Receive Ports node under the BizTalk Application 1 node, point to New, and then click One-way Receive Port.

  2. Name the receive port, and then click Receive Locations in the console tree.

  3. Click New.

  4. Name the receive location, select HTTP for Type, and then click Configure.

  5. Enter /Contoso/BTSHTTPReceive.dll for Virtual directory plus ISAPI extension.

  6. For Receive pipeline, select AS2EDIReceive.

  7. Click OK, and then click OK again.

  8. In the Receive Locations pane of the BizTalk Administration Console, right-click the receive location, and then click Enable.

  1. In Windows Explorer, create the _MDNToFabrikam local folder.

  2. In BizTalk Server 2006 Administration Console, right-click the Send Ports node under the BizTalk Application 1 node, point to New, and then click Dynamic One-way Send Port.

  3. In the Send Port Properties dialog box, name the send port.

  4. In the Transport section, select AS2Send for Send Pipeline.

  5. In the console tree, select Filters. For Property, enter EdiIntAS.IsAS2AsynchronousMDN; for Operator, enter ==; and for Value , enter True.

  6. Click OK.

  1. In Windows Explorer, create a Contoso local folder named \EDI_to_Contoso to send the EDI payload to.

  2. In BizTalk Server 2006 Administration Console, right-click Send Ports, point to New, and then click Static One-Way Send Port.

  3. In the Send Port Properties dialog box, name your send port, for example, Send_Payload. Select FILE for Type, and then click Configure.

  4. In the FILE Transport Properties dialog box, for Destination folder, browse to and select the \EDI_to_Contoso folder that you created in step 1. Leave File name as %MessageID%.xml. Click OK.

  5. Accept the default of PassThruTransmit for Send Pipeline.

  6. Click Filters in the console tree. For Property, enter BTS.MessageType. For Operator, enter ==. For Value, enter the message type for your message, http://schemas.microsoft.com/BizTalk/Edi/X12/2006#X12_00401_864.

  7. Click OK.

  8. In the Send Ports pane of the BizTalk Administration Console, right-click the send port, and then click Start.

  1. In Visual Studio 2005, open the Sender.csproj project in the <drive>:\Program Files\Microsoft BizTalk Server 2006\SDK\AS2 Tutorial\Sender folder.

  2. In HttpSender.cs, make sure that the following line is not commented out (immediately below the //Request Asynchronous MDN comment line):

    Stream sr = new FileStream(Environment.GetEnvironmentVariable("PROGRAMFILES") + @"\Microsoft BizTalk Server 2006\SDK\AS2 Tutorial\X12_00401_864.edi", FileMode.Open, FileAccess.Read);
    
  3. Make sure that the following line is commented out (immediately below the //Request Synchronous MDN comment line):

    Stream sr = new FileStream(Environment.GetEnvironmentVariable("PROGRAMFILES") + @"\Microsoft BizTalk Server 2006\SDK\AS2 Tutorial\X12_00401_864-Sync.edi", FileMode.Open, FileAccess.Read);
    
  4. Build this project.

  5. In Windows Explorer, move to <drive>:\Program Files\Microsoft BizTalk Server 2006\SDK\AS2 Tutorial. Open X12_00401_864.edi in Notepad. Delete the line defining the Disposition-Notification-Options header, and then save the file.

  6. In Windows Explorer, move to <drive>:\Program Files\Microsoft BizTalk Server 2006\SDK\AS2 Tutorial\Sender\bin\debug and execute Sender.exe.

    Bb727975.note(en-us,BTS.20).gifNote
    Running Sender.exe in this instance posts the message X12_00401_864.edi to the Contoso virtual directory (the BTS http receive location).

  7. Open the Contoso local folder that you create to send the EDI payload to (\EDI_to_Contoso). Verify that there is a <URL>.XML file in the folder. Open the XML file and verify that it contains an 864 transaction set.

  8. Open the test message X12_00401_864.edi in Notepad, and verify that the transaction set in the output message in the \EDI_to_Contoso local folder corresponds to the transaction set in the X12_00401_864.edi input message.

Community Additions

ADD
Show: