Editar

Partilhar via


Walkthrough (AS2): Sending EDI over AS2 with an Asynchronous MDN

This walkthrough provides a set of step-by-step procedures that creates a solution for sending EDI messages over AS2, with an asynchronous MDN. You can create and test the full solution in this walkthrough on a single computer

Prerequisites

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

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

  • The computer that runs the walkthrough must have Internet Information Services (IIS) 7 installed.

  • If the computer that runs the walkthrough is installed with a 64-bit version of Windows, you must ensure that the BizTalk hosts are marked as 32-bit only. You must also ensure IIS has the Enable 32-Bit Application Setting for the Application Pools set to True. For more information, see Tutorial 3: AS2 Tutorial.

How the Solution Sends an EDI/AS2 Message and Returns an Asynchronous MDN

The solution will do the following:

  1. A one-way FILE receive port receives an EDI interchange from Contoso.

    Note

    The events in this list may not occur in the order shown.

  2. Using a passthrough receive pipeline, the receive port drops the test message into the MeassageBox unchanged.

  3. A static one-way send port picks up the EDI interchange and encodes it into AS2 format.

  4. The send port sends the EDI interchange over AS2 transport to the Fabrikam party.

  5. The one-way receive port at Fabrikam receives the AS2 message using the Fabrikam virtual directory. The receive pipeline decodes the EDI interchange from AS2, and drops the EDI interchange into the MessageBox.

  6. The same one-way receive port also generates an MDN and drops the MDN into the MessageBox.

  7. A static one-way send port pick up the EDI message.

  8. The static one-way send port sends the EDI message to a local folder.

  9. A one-way dynamic send port picks up the asynchronous MDN.

  10. The one-way dynamic send port sends the MDN to Contoso.

  11. A one-way receive port receives the MDN, and drops it into the MessageBox.

  12. A static one-way send port with a passthrough send pipeline picks up the MDN.

  13. The one-way send port sends the MDN to a local folder.

    The following figure shows the architecture for this solution.

    AS2 sending with an asynchronous MDN

The Functionality in this Solution

The following applies to the functionality of this walkthrough:

  • This walkthrough deals with AS2 functionality, not EDI functionality. As a result, all ports involved in AS2 processing use either AS2Receive or AS2Send pipelines, not AS2EdiReceive or AS2EdiSend. Ports that are not involved in AS2 processing use PassThruReceive or PassThruTransmit pipelines.

  • Status reporting is not enabled.

  • 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 Properties.

Configuring and Testing the Walkthrough

The procedures required for this solution include the following:

  • 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 Fabrikam virtual directory that receives the AS2 message from Contoso, as configured in the receive location.

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

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

  • Create a one-way FILE receive port to receive the EDI test message that will be sent via AS2 transport. Create the local folder to receive the test message.

  • Create a static one-way HTTP send port for BizTalk Server to send the AS2 message containing the EDI business document to Fabrikam. Configure the send pipeline to be the AS2Send pipeline.

  • Create a one-way HTTP receive port for BizTalk Server to receive the AS2 message. Configure the receive pipeline to be the AS2Receive pipeline. Configure the receive location to receive the AS2 message via the Fabrikam virtual directory.

  • Create a static one-way FILE send port (with a passthrough send pipeline) to route the message payload to a local folder. Create the local folder.

    Note

    If you do not have a send port to subscribe to the message payload, it will be suspended in the MessageBox.

  • Create a dynamic one-way HTTP send port to return the MDN to Contoso.

    Note

    The test solution is on a single computer; as a result, the one-way send port sending the AS2 message (from Contoso) and the one-way send port sending the MDN response (from Fabrikam) are on the same computer.

  • Create a one-way receive port for BizTalk Server to receive the MDN response from Fabrikam.

  • Create a static one-way FILE send port (with a passthrough send pipeline) to route the MDN to a local folder. Create the local folder.

  • Create a party (trading partner) for both Fabrikam and Contoso.

  • Create a business profile each for both the trading parties.

  • Create an AS2 agreement between the business profiles for Fabrikam and Contoso. The AS2 agreement would contain properties to send an AS2 message and receive an asynchronous MDN in return.

  • Test the walkthrough using a test EDI interchange.

    Note

    For a test message, you can use the SamplePO.txt file that is used in the EDI Interface Developer tutorial. That file is shipped in the \Program Files (x86)\Microsoft BizTalk Server <VERSION>\SDK\EDI Interface Developer Tutorial\ folder. This is an X12 850 message.

Configuring the Walkthrough

This section describes the procedures to configure the walkthrough.

To deploy the message schema
  1. In Visual Studio, create or open a BizTalk project.

    Note

    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 Add a Reference to the BizTalk Server EDI Application.

  2. Right-click your project, point to Add, and then click Existing Item. To use the SamplePO.txt file to test your solution, move to the \Program Files (x86)\Microsoft BizTalk Server <VERSION>SDK\EDI Interface Developer Tutorial\Inbound_EDI folder. Select the X12_00401_850.xsd schema, and then click Add.

    Note

    To use a different EDI schema, go to the \Program Files (x86)\Microsoft BizTalk Server <VERSION>XSD_SchemaEDI folder. If the EDI schemas have not been unzipped into the XSD_SchemaEDI folders, execute the MicrosoftEdiXSDTemplates.exe file in the XSD_SchemaEDI folder to unzip the schemas into the default folder.

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

To enable the BTS ISAPI Filter
  1. Click Start, point to All Programs, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.

    Tip

    Depending on the operating system, the Administrative Tools start menu option may not be available. In such cases, click Start, click Run, and enter inetmgr to open Internet Information Services (IIS) Manager.

  2. Select the root Web Server entry and in the Features View, double click Handler Mappings and then in the Actions pane click Add Script Map.

    Note

    Configuring the script mapping at the Web Server level will cause this mapping to apply to all child Web Sites. If you wish to restrict the mapping to a specific Web Site or Virtual Folder, select the target site or folder instead of the Web Server.

  3. In the Add Script Map dialog box, enter BtsHttpReceive.dll in the Request path field.

  4. In the Executable field, click the ellipsis (…) button and browse to \Program Files (x86)\Microsoft BizTalk Server <VERSION>HttpReceive. Select BtsHttpReceive.dll and click OK.

  5. Enter BizTalk HTTP Receive in the Name field, and then click Request Restrictions.

  6. In the Request Restrictions dialog box, select the Verbs tab and then select One of the following verbs. Enter POST as the verb.

  7. On the Access tab, select Script and then click OK.

  8. Click OK and when prompted to allow the ISAPI extension, click Yes.

To configure the Fabrikam Web page
  1. In IIS Manager, right-click Application Pools and select Add Application Pool.

  2. In the Add Application Pool dialog box, enter BizTalkAppPool in Name, and then select .NET Framework V4.0.30210 in the .NET Framework version dropdown list. Click OK.

    Note

    The version number may vary depending on the version of .NET Framework 4.5 installed on the machine.

  3. Select Application Pools, in the Features View select BizTalkAppPool, and then click Advanced Settings in the Actions pane.

  4. In the Advanced Settings dialog box, select Identity and then click the ellipsis (…) button.

  5. In the Application Pool Identity dialog box, select Custom account and then click Set.

  6. Enter the User name and Password for a user account that is a member of the administrators group, enter the password in Confirm password and then click OK three times to return to the IIS Manager.

  7. In IIS Manager, open the Sites folder. Right-click the Default Web Site and then select Add Application.

  8. In the Add Application dialog box, enter Fabrikam in Alias, and then click Select.

  9. In the Select Application Pool dialog box, select BizTalkAppPool and click OK.

  10. Click the ellipsis (…) button and browse to \Program Files (x86)\Microsoft BizTalk Server <VERSION>HttpReceive for the Physical path.

  11. Click Test Settings and verify that there are no errors displayed in the Test Connection dialog box. Click Close, and then click OK.

  12. In IIS Manager, select the Contoso virtual directory and in the Features View, double-click Authentication.

  13. In Authentication, select Anonymous Authentication and verify that the Status is Enabled. If the Status is Disabled, click Enable in the Actions pane.

To configure the Contoso Web page
  1. In IIS Manager, open the Sites folder. Right-click the Default Web Site and then select Add Application.

  2. In the Add Application dialog box, enter Contoso in Alias, and then click Select.

  3. In the Select Application Pool dialog box, select BizTalkAppPool and click OK.

  4. Click the ellipsis (…) button and browse to \Program Files (x86)\Microsoft BizTalk Server <VERSION>HttpReceive for the Physical path.

  5. Click Test Settings and verify that there are no errors displayed in the Test Connection dialog box. Click Close, and then click OK.

  6. In IIS Manager, select the Contoso virtual directory and in the Features View, double-click Authentication.

  7. In Authentication, select Anonymous Authentication and verify that the Status is Enabled. If the Status is Disabled, click Enable in the Actions pane.

To specify that the Fabrikam and Contoso virtual directories are not managed by Windows SharePoint Services
  1. If Windows SharePoint Services is installed on your computer, click Start, point to All Programs, point to Administrative Tools, and then click SharePoint 3.0 Central Administration.

    Note

    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 Central Administration, click Application Management.

  3. On the Application Management page, click Define managed paths.

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

  5. Repeat step 4 for the Contoso virtual directory.

  6. Close the Define Managed Paths page.

To create a receive port to receive the EDI test message
  1. In Windows Explorer, create a local folder to receive the EDI interchange from Contoso.

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

  3. Name the receive port as RecvISAFromCont, and then click Receive Locations in the console tree.

  4. Click New.

  5. Name the receive location, select FILE for Type, and then click Configure.

  6. For Receive folder, enter the name of the folder that you created in step 1.

  7. For File mask, enter the extension of your file. If you are using the SamplePO.txt file as your test message, enter *.txt. Click OK.

  8. For Receive pipeline, accept the default of PassThruReceive.

  9. Click OK, and then click OK again.

  10. Click the Receive Locations node, right-click your receive location, and then click Enable.

To create a send port to send the EDI interchange over AS2 to Fabrikam
  1. In the BizTalk Server Administration console, right-click the Send Ports node under the BizTalk Application 1 node, point to New, and then click Static One-way Send Port.

  2. In the Send Port Properties dialog box, name the send port as SendISAToFab.

  3. In the Transport section, select HTTP for Type, and then click Configure.

  4. In the HTTP Transport Properties dialog box, for Destination URL, enter http://localhost/Fabrikam/BTSHttpReceive.dll.

  5. Clear Enable Chunked Encoding, and then click OK.

  6. In Send pipeline, select AS2Send.

  7. In the console tree, select Filters. For Property, enter BTS.ReceivePortName; for Operator, enter ==; and for Value enter the name of the receive port that will receive the EDI interchange (RecvISAFromCont).

  8. Click OK.

  9. Click the Send Ports node in the Administration Console, right-click your send port, and then click Start.

To create a receive port for Fabrikam to receive the AS2 message
  1. In the BizTalk Server Administration console, under the BizTalk Application 1 node, right-click Receive Ports, point to New, and then click One-way Receive Port.

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

  3. Click New.

  4. In the Receive Location Properties dialog box, name your receive location, select HTTP for Type, and then click Configure.

  5. In the HTTP Transport Properties dialog box, enter /Fabrikam/BTSHttpReceive.dll for Virtual directory plus ISAPI extension. Clear Return correlation handle on success and select Suspend failed requests. Click OK.

  6. Select AS2Receive for the Receive Pipeline. Click OK, and then click OK again.

  7. Click the Receive Locations node, right-click your receive location, and then click Enable.

To create a send port to send the EDI payload to a local folder
  1. In Windows Explorer, create a local folder to send the EDI interchange to.

  2. In BizTalk Server 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 as SendEDIToFab. Select FILE for Type, and then click Configure.

  4. In the FILE Transport Properties dialog box, for Destination folder, enter the local folder that you created for the EDI payload.

  5. For File name, enter the file name. If you are using the SamplePO.txt file as your test message, enter %MessageID%.txt. Click OK.

  6. Accept the default of PassThruTransmit for Send Pipeline.

  7. Click Filters in the console tree, and add filter properties for picking up the EDI payload. On the first line, for Property, enter BTS.ReceivePortName; for Operator, enter ==; for Value, enter the name of the receive port that receives the AS2 message (RecvAS2ForFabrikam); and for Group by, accept And. On the second line, for Property, enter EdiIntAS.IsAS2PayloadMessage; for Operator, enter ==; and for Value, enter True.

  8. Click OK.

  9. Click the Send Ports node, right-click your send port, and then click Start.

To create a dynamic one-way send port to return the MDN
  1. In BizTalk Server Administration console, right-click Send Ports, point to New, and then click Dynamic One-Way Send Port.

  2. In the Send Port Properties dialog box, name your send port as Send_MDN.

  3. For Send Pipeline, enter AS2Send.

  4. Click Filters in the console tree, and add filter properties for picking up the EDI payload. On the first line, for Property, enter BTS.ReceivePortName; for Operator, enter ==; for Value, enter the name of the receive port that receives the AS2 message (RecvAS2ForFabrikam); and for Group by, accept And. On the second line, for Property, enter EdiIntAS.IsAS2AsynchronousMDN; for Operator, enter ==; and for Value, enter True.

  5. Click OK.

  6. Click the Send Ports node, right-click your send port, and then click Start.

To create a receive port to receive the MDN from Fabrikam
  1. In the BizTalk Server Administration console, under the BizTalk Application 1 node, right-click Receive Ports, point to New, and then click One-way Receive Port.

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

  3. Click New.

  4. In the Receive Location Properties dialog box, name your receive location, select HTTP for Type, and then click Configure.

  5. In the HTTP Transport Properties dialog box, enter /Contoso/BTSHTTPReceive.dll for Virtual directory plus ISAPI extension. Clear Return correlation handle on success and select Suspend failed requests. Click OK.

  6. Select AS2Receive for the Receive Pipeline. Click OK, and then click OK again.

  7. Click the Receive Locations node, right-click your receive location, and then click Enable.

To create a send port to send the MDN to a local folder
  1. In Windows Explorer, create a local folder to send the MDN to.

  2. In BizTalk Server 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. Select FILE for Type, and then click Configure.

  4. In the FILE Transport Properties dialog box, for Destination folder, enter the local folder you created to send the MDN to.

  5. For File name, enter %MessageID%.msg. Click OK.

  6. Accept the default of PassThruTransmit for Send Pipeline.

  7. Click Filters in the console tree. For Property, enter BTS.ReceivePortName; for Operator, enter ==; for Value, enter the name of the receive port that receives the MDN (RecvMDNFromFab); and for Group by, accept And. On a second line, for Property, enter EdiIntAS.IsAS2MdnResponseMessage. For Operator, enter ==. For Value, enter True.

  8. Click OK.

  9. Click the Send Ports node, right-click your send port, and then click Start.

To create a party and a business profile for Fabrikam
  1. Right-click the Parties node in the BizTalk Server Administration Console, point to New, and then click Party.

  2. Enter a name for the party in the Name text box, and then click OK.

    Note

    By selecting the Local BizTalk processes messages received by the Party OR supports sending messages from this party check box, you can specify that the party being created is for the same organization that is also hosting BizTalk Server. Based on that, some properties will be enabled or disabled when you create an agreement. However, for this walkthrough, you can leave this check box selected.

  3. Right-click the party name, point to New, and then click Business Profile.

  4. In the Profile Properties dialog box, on the General page, enter Fabrikam_Profile in the Name text box.

    Note

    When you create a party, a profile is also created. You can rename and use that profile instead of creating a new one. To rename a profile, right-click the profile and select Properties. In the General page, specify a name for the profile.

To create a party and a business profile for Contoso
  1. Right-click the Parties node in the BizTalk Server Administration Console, point to New, and then click Party.

  2. Enter a name for the party in the Name text box, and then click OK.

    Note

    By selecting the Local BizTalk processes messages received by the Party OR supports sending messages from this party check box, you can specify that the party being created is for the same organization that is also hosting BizTalk Server. Based on that, some properties will be enabled or disabled when you create an agreement. However, for this walkthrough, you can leave this check box selected.

  3. Right-click the party name, point to New, and then click Business Profile.

  4. In the Profile Properties dialog box, on the General page, enter Contoso_Profile in the Name text box.

    Note

    When you create a party, a profile is also created. You can rename and use that profile instead of creating a new one. To rename a profile, right-click the profile and select Properties. In the General page, specify a name for the profile.

To create an AS2 agreement between the two business profiles
  1. Right-click Contoso_Profile, point to New, and then click Agreement.

  2. In the General Properties page, for the Name text box, enter a name for the agreement.

  3. From the Protocol drop-down list, select AS2.

  4. In the Second Partner section, from the Name drop-down list, select Fabrikam.

  5. In the Second Partner section, from the Profile drop-down list, select Fabrikam_Profile.

    You will notice that two new tabs get added next to the General tab. Each tab is for configuring a one-way AS2 agreement.

  6. Perform the following tasks on the Contoso->Fabrikam tab.

    1. On the Identifiers page, enter values for AS2-From and AS2-To. For AS2-From, enter Contoso. For AS2- To, enter Fabrikam.

    2. In the Acknowledgements (MDNs) page, do the following:

      1. Select the Process inbound MDN into MessageBox for routing/delivery options check box.

        Note

        Checking the Process inbound MDN into MessageBox for routing/delivery options is required for the testing of this walkthrough, because only then will the returned MDN be dropped into the MessageBox. That enables you to create a send port to subscribe to the MDN, and to send the MDN to a local directory, so you can verify the AS2 transmission.

      2. Select the Request MDN check box.

      3. Make sure the Request Signed MDN check box is cleared.

      4. Select the Request asynchronous MDN check box.

      5. In Receipt-Delivery-Option (URL), enter http://localhost/Contoso/BTSHttpReceive.dll.

      6. The Disposition-Notification-To is by default set to the value you specified for Receipt-Delivery-Option (URL) property. The value of this field is not used during AS2 processing.

    3. On the Send Ports page, associate the two-way send port that will be sending the EDI interchange to Fabrikam. In the Send ports grid, under the Name column, click an empty cell, and from the drop-down list, select the send port SendISAToFab.

  7. Perform the following tasks on the Fabrikam->Contoso tab.

    Note

    In this walkthrough, we specify the required value in the tab so that an agreement can be successfully created. To successfully create an agreement, both one-way agreement tabs must have values defined for AS2_From and AS2-To.

    1. On the Identifiers page, enter values for AS2-From and AS2-To. For AS2-From, enter Fabrikam. For AS2- To, enter Contoso.
  8. Click Apply.

  9. Click OK. The newly added agreement is listed in the Agreements section of the Parties and Business Profiles pane. The newly added agreement is enabled by default.

Testing the Walkthrough

This section provides information on how to test the walkthrough.

To test the solution
  1. In Windows Explorer, move to \Program Files (x86)\Microsoft BizTalk Server <VERSION>SDK\EDI Interface Developer Tutorial. Copy the SamplePO.txt file.

  2. Paste the SamplePO.txt file into the local folder that you created to receive the test message from Contoso.

  3. Move to the local folder that you created to send the EDI payload to. Confirm that the folder contains an EDI file. Open the file and the original test message, and verify that they have the same content.

  4. Move to the local folder that you created to send the resulting MDN to. Confirm that the folder contains a test file; open the file, and confirm that it is an MDN file.

See Also

Developing and Configuring BizTalk Server AS2 Solutions