AS2 Sender Utility
The AS2 Sender utility shipped with BizTalk Server enables you to send an AS2 message to a Web site on a single computer. This utility simulates the sending of an AS2 message from a separate computer.
The AS2 Sender utility files are located in drive:\Program Files\Microsoft BizTalk Server 2010\SDK\AS2 Tutorial\Sender.
You must be logged on as a member of the BizTalk Server Administrators group.
The AS2 Sender utility builds an AS2 message with an EDI payload, and sends that message to a Web site that uses the BTSHTTPReceive ISAPI filter. By default the tutorial does the following:
Sends an AS2 message named X12_00401_864.edi with an 864 X12-encoded payload. This message is located in the drive:\Program Files\Microsoft BizTalk Server 2010\SDK\AS2 Tutorial folder.
Prompts an asynchronous MDN in response to the AS2 message. This is determined by the message sent, and can be changed.
Sends the AS2 message to a receive location through the Contoso virtual directory.
The utility can be modified to change this specific behavior. See the How to Customize the AS2 Sender Utility section below.
To set up a solution to use the AS2 Sender utility, you need to do the following.
|These steps are demonstrated in the AS2 Tutorial and two AS2 send-side walkthroughs. For more information, see Tutorial 3: AS2 Tutorial, Walkthrough (AS2): Sending EDI over AS2 with a Synchronous MDN, and Walkthrough (AS2): Sending EDI over AS2 with an Asynchronous MDN.|
Enable the BTSHTTPReceive ISAPI filter.
Configure a Web page and a receive location to receive the AS2 message. In the default AS2 Sender utility, the Web page is the Contoso Web page.
Deploy the schema for the EDI interchange that you will send as a payload of the AS2 message.
Set the appropriate AS2 and EDI party properties.
The default AS2 Sender utility sends a test 864 EDI interchange over AS2 to a Contoso Web page using the BTSHTTPReceive ISAPI filter. The AS2 message, named X12_00401_864.edi, prompts an asynchronous MDN. The AS2 Sender utility code is located in HttpSender.cs in the drive:\Program Files\Microsoft BizTalk Server 2010\AS2 Tutorial\Sender folder. The following line of code in HttpSender.cs sends the default 864 test file:
Stream sr = new FileStream(getBizTalkInstallPath() + @"SDK\AS2 Tutorial\X12_00401_864.edi", FileMode.Open, FileAccess.Read);
|You can modify this line with a different file name and different path.|
The following line in HttpSender.cs sends an AS2 message named X12_00401_864-Sync.edi. This message prompts a synchronous MDN. By default, this line of code in HttpSender.cs is commented out in favor of the line that sends X12_00401_864.edi. To send X12_00401_864-Sync.edi, uncomment the X12_00401_864-Sync.edi line and comment out the X12_00401_864.edi line.
Stream sr = new FileStream(getBizTalkInstallPath() + @"SDK\AS2 Tutorial\X12_00401_864-Sync.edi", FileMode.Open, FileAccess.Read);
The following line of code in HttpSender.cs sends the message to the Contoso Web page:
HttpSender TestSender = new HttpSender("http://localhost/Contoso/BTSHttpReceive.dll");
|You can modify this line with a different virtual directory and ISAPI filter.|
In Visual Studio, open the Sender.csproj project in the drive:\Program Files\Microsoft BizTalk Server 2010\SDK\AS2 Tutorial\Sender folder.
Open HttpSender.cs in the Sender project, and customize the Sender code with the appropriate receiving Web page and the appropriate EDI filename and path.
Right-click the Sender project, and then click Properties.
Click Signing in the left-hand console. Ensure that Sign the assembly is selected, and the strong name key file is set to Sender.snk. Make sure that Delay sign only is cleared.
Build the project.
Open a command prompt. Move to drive:\Program Files\Microsoft BizTalk Server 2010\SDK\AS2 Tutorial\Sender\bin\debug.
Enter Sender.exe, and then press Enter.
Verify that you see a message indicating that an AS2 message was successfully sent, and then close the command prompt.
© 2010 Microsoft Corporation. All rights reserved.