Contents
Tutorial: Order Fulfillment
Prerequisites
In This Section
Lesson 1: Create an RFID Process
In This Section
Step 1: Create an RFID Process by Using RFID Manager
Prerequisites
Overview of This Step
Procedures
Comments
Next Steps
Step 2: Test the RFID Process by Using RfidClientConsole
Prerequisites
Overview of This Step
Procedures
Comments
Next Steps
Lesson 2: Create a Custom Event Handler and Add It to the Process
In This Section
Step 1: Create a Custom Event Handler
Prerequisites
Overview of This Step
Procedures
Comments
Next Steps
Step 2: Modify the Process to Use the Custom Event Handler
Prerequisites
Overview of This Step
Procedures
Comments
Next Steps
Step 3: Test the Process
Prerequisites
Overview of This Step
Procedures
Comments
Next Steps
Lesson 3: Add the RuleEnginePolicyExecutor Event Handler to the Process
In This Section
Step 1: Create a Sample Database
Prerequisites
Overview of This Step
Procedures
Next Steps
Step 2: Create a Business Rule Engine (BRE) Policy
Prerequisites
Overview of This Step
Procedures
Comments
Next Steps
Step 3: Configure the RFID Process to Use the BRE Policy
Prerequisites
Overview of This Step
Procedures
Comments
Next Steps
Step 4: Test the Process
Prerequisites
Overview of This Step
Procedures
Comments
Next Steps
Lesson 4: Create and Use a Device Provider
In This Lesson
Step 1: Create a Skeleton Provider by Using the Provider Template
Prerequisites
Overview of This Step
Procedures
Next Steps
Step 2: Start the Provider
Prerequisites
Overview of This Step
Procedures
Next Steps
Step 3: Add an RFID Device and View Its Properties
Prerequisites
Overview of This Step
Procedures
Next Steps
Step 4: Test the Process
Prerequisites
Overview of This Step
Procedures
Next Steps
Lesson 5: Use the RFID Management API
In This Section
Step 1: Remove a Process, a Device, and a Device Provider from BizTalk RFID
Prerequisites
Overview of This Step
Procedures
Next Steps
Step 2: Add a Process, a Device, and a Device Provider to BizTalk RFID
Prerequisites
Overview of This Step
Procedures
Next Steps
Step 3: Test the Process
Prerequisites
Overview of This Step
Procedures
Next Steps
Lesson 6: Use the RfidClientConsole Utility
In This Section
Step 1: Remove a Process, a Device, and a Device Provider from BizTalk RFID
Prerequisites
Overview of This Step
Procedures
Next Steps
Step 2: Add a Process, a Device, and a Device Provider to BizTalk RFID
Prerequisites
Overview of This Step
Procedures
Next Steps
Step 3: Test the Process
Prerequisites
Overview of This Step
Procedures
Next Steps
Lesson 7: Create and Use a Device Simulator
In This Section
Step 1: Create a Device Translator
Prerequisites
Overview of This Step
Procedures
Comments
Next Steps
Step 2: Modify the Provider to Use the Simulator
Prerequisites
Overview of This Step
Procedures
Comments
Next Steps
Step 3: Run the Device Simulator
Prerequisites
Overview of This Step
Procedures
Next Steps
Step 4: Test the Process
Prerequisites
Overview of This Step
Procedures
Next Steps
Lesson 8: Print a Tag
In This Section
Step 1: Modify the Translator to Support Printing a Tag
Prerequisites
Overview of This Step
Procedures
Comments
Next Steps
Step 2: Modify the Provider to Support Printing a Tag
Prerequisites
Overview of This Step
Procedures
Comments
Next Steps
Step 3: Test the Process
Prerequisites
Overview of This Step
Procedures
Next Steps
Copyright
Tutorial: Order Fulfillment
This tutorial shows you how to implement a Microsoft®BizTalk® RFID solution for the Order Fulfillment Scenario [RFID11] in an incremental fashion (lesson-by-lesson). At the end of each lesson, you can test the solution to verify that it works correctly. You will develop a solution for the shipping station and then develop a solution for the commissioning station.
Prerequisites
Before you perform the steps in this tutorial, review the Understanding BizTalk RFID [RFID11] section of this documentation for a high-level overview of all the features of BizTalk RFID.
In This Section
Lesson / DescriptionLesson 1: Create an RFID Process / In this lesson, you create an RFID process named TutorialProcess by using RFID Manager. The process contains a logical device and a SqlServerSink event handler.
Lesson 2: Create a Custom Event Handler and Add It to the Process / In this lesson, you create a custom event handler named MyEventHandler that generates an advance shipment notice (ASN) message, and add the event handler to the RFID process.
Lesson 3: Add the RuleEnginePolicyExecutor Event Handler to the Process / In this lesson, you create a Business Rule Engine (BRE) policy to match the purchase order numbers, and add a RuleEnginePolicyExecutor component to the process to invoke the BRE policy.
Lesson 4: Create and Use a Device Provider / In this lesson, you create a device provider named TutorialProvider, add a device named TutorialDevice, and bind the logical device in the process to the device.
Lesson 5: Use the RFID Management API / In this lesson, you create two .NET console applications by using the RFID Management API. The first application removes the TutorialProcess, the TutorialDevice, and the TutorialProvider from BizTalk RFID. The second application adds the TutorialProvider, the TutorialDevice, and the TutorialProcess to BizTalk RFID.
Lesson 6: Use the RfidClientConsole Utility / In this lesson, you create two command files that use the RfidClientConsole utility. The first file removes the TutorialProcess, the TutorialDevice, and the TutorialProvider from BizTalk RFID. The second file adds the TutorialProvider, the TutorialDevice, and the TutorialProcess to BizTalk RFID.
Lesson 7: Create and Use a Device Simulator / In this lesson, you create a device simulator for the TutorialDevice, modify the TutorialProvider to use the simulator, run the simulator, and test the process by having the device simulator generate tag-read event messages.
Lesson 8: Print a Tag / In this lesson, you modify the TutorialProvider and the device simulator to support printing a tag, and test the printing of a tag from a .NET console application.
Lesson 1: Create an RFID Process
In this lesson you use RFID Manager to create an RFID process named TutorialProcess, which contains a logical device and a SqlServerSink event handler. When the process receives a tag-read event, the SqlServerSink event handler stores the tag information in the RFIDsink database.
In This Section
Step 1: Create an RFID Process by Using RFID Manager
Step 2: Test the RFID Process by Using RfidClientConsole
Step 1: Create an RFID Process by Using RFID Manager
In this step, you use RFID Manager to perform the following tasks:
Create an RFID process named TutorialProcess.
Add a logical device, shippingreader, to the process.
Add a SqlServerSink event handler to the process.
Start the TutorialProcess process.
Prerequisites
BizTalk RFID must be installed and running.
The Microsoft.Rfid.OobComponents event handler assembly must be registered with BizTalk RFID. See Registering Microsoft.Rfid.OobComponents Assembly with BizTalk RFID for more details.
Overview of This Step
You perform the following procedure in this step.
Procedure / DescriptionTo create the TutorialProcess process by using RFID Manager / This procedure has instructions to create a BizTalk RFID process named TutorialProcess with a logical device and a SqlServerSink event handler.
Procedures
To create the TutorialProcess process by using RFID Manager
1.Click Start, point to Programs, point to Microsoft BizTalk RFID, and then click RFID Manager.2.In RFID Manager, expand RFID Services Administration, and then expand your machine name.
3.Right-click Processes, and then click New Process.
4.For Process Name, type TutorialProcess, and then click OK.
The Bind Wizard opens.
5.On the Introduction page, click Next.
6.On the Logical Devices page, click New.
7.In the Logical Device Name window, for Name, type shippingreader, and then click OK.
8.On the Logical Devices page, click Next.
9.On the Components page, click New Component.
10.From the List of available components, select SqlServerSink, and then click Add.
Note
If you do not see SqlServerSink in the list, you may not have registered the Microsoft.Rfid.OobComponents assembly with BizTalk RFID. See Registering Microsoft.Rfid.OobComponents Assembly with BizTalk RFID for more details.
11.For Instance Name, type MySqlSink, and then click OK.
12.In the Add Component dialog box, click Close.
13.On the Components page, click Next.
14.Select Start the Process when I click Finish.
15.Click Finish.
Comments
The following comments apply to this step:
A process is a high-level object that combines various entities such as logical devices and event handlers.
The Binding Wizard enables you to create two types of bindings: device bindings and component bindings. Device bindings enable a process to declare a set of devices from which to receive events. Device bindings are declared through logical devices. Component bindings represent the configuration of the parameters for components in a process. A component is a module that is located in the process pipeline. Components receive and process events such as tag-reads.
By default the value of the Tag Processing Mode for a process is set to Transactional. For more details on tag processing modes, see Transaction Model [RFID11].
The Microsoft.Rfid.OobComponents assembly contains two event handlers, SqlServerSink and RuleEnginePolicyExecutor.
Next Steps
Now that you have completed Step 1 in this lesson, perform Step 2: Test the RFID Process by Using RfidClientConsole, which gives you step-by-step instructions to test TutorialProcess by using RFID Manager.
Step 2: Test the RFID Process by Using RfidClientConsole
In this step, you use the RfidClientConsole utility to test the TutorialProcess process you created in the previous step.
Prerequisites
You must complete Step 1: Create an RFID Process by Using RFID Manager before performing this step.
The procedures in this step assume that you are using a folder named rfidtutorial that contains a subfolder named testfiles on your C drive. If you use any other drive or folder names, use those names in the appropriate places when performing the procedures.
Overview of This Step
You perform the following procedures in this step.
Procedure / DescriptionTo create a sample tag-read event XML file / This procedure has instructions to create an XML file that contains information about a sample tag-read event. The structure of the XML content in the file is the structure that the RfidClientConsole utility expects for a tag-read event in XML format.
To test TutorialProcess by using the RfidClientConsole utility / This procedure has instructions to test the RFID process, TutorialProcess, by using the RfidClientConsole utility and the sample tag-read event XML file.
To verify that the process received the event / This procedure has instructions to verify that TutorialProcess received the event posted by the RfidClientConsole utility.
To verify that the SqlServerSink event handler executed / This procedure has instructions to verify that the SqlServerSink event handler in the event handler pipeline of TutorialProcess executed successfully upon receiving the tag-read event.
Procedures
To create a sample tag-read event XML file
1.Click Start, and then click Run.2.Type Notepad, and then click OK.
3.Copy the following XML text into Notepad:
<RfidEventBase xmlns:i=" i:type="TagReadEvent" xmlns="
<m_lockObject />
<vendorSpecificData xmlns:d2p1="
<d2p1:dictionary xmlns:d3p1="
<d3p1:KeyValueOfstringanyType>
<d3p1:Key>ItemID</d3p1:Key>
<d3p1:Value xmlns:d5p1=" i:type="d5p1:string">1234</d3p1:Value>
</d3p1:KeyValueOfstringanyType>
<d3p1:KeyValueOfstringanyType>
<d3p1:Key>PONumber</d3p1:Key>
<d3p1:Value xmlns:d5p1=" i:type="d5p1:string">PO123456</d3p1:Value>
</d3p1:KeyValueOfstringanyType>
</d2p1:dictionary>
</vendorSpecificData>
<m_deviceName>MyDevice</m_deviceName>
<m_sourceName>Antenna 1</m_sourceName>
<m_time>2007-06-22T11:37:10.5218784+05:30</m_time>
<data>QgBpAHoAVABhAGwAawAgAFIARgBJAEQA</data>
<dataSelector xmlns:d2p1="
<d2p1:dataSelector>123</d2p1:dataSelector>
</dataSelector>
<id>AQEBAQ==</id>
<numberingSystemIdentifier i:nil="true" />
<type xmlns:d2p1="
<d2p1:description>EPC Class 0 tag</d2p1:description>
<d2p1:enumValue>1</d2p1:enumValue>
</type>
</RfidEventBase>
4.In Notepad, click File, and then click Save.
5.For File name, type TREvent1.xml.
6.Verify that the folder, c:\rfidtutorial\testfiles, exists on your hard disk. If the folder does not exist, create it before performing the next step.
7.Browse to the c:\rfidtutorial\testfiles folder, and then click Save to save the TREvent1.xml file in that folder.
To test TutorialProcess by using the RfidClientConsole utility
1.Click Start, and then click Run.2.Type cmd, and then click OK to open a command prompt window.
Note
On Windows Vista® computers, if the User Access Control feature is turned on, click Start, point to Programs, point to Accessories, right-click Command Prompt, and then click Run As Administrator to run the command prompt with administrator privileges.
3.Switch to the c:\rfidtutorial\testfiles folder, and then execute the following command from the command prompt:
rfidclientconsole.exe AddEventToProcessPipeline TutorialProcess TREvent1.xml shippingreader
Note
The AddEventToProcessPipeline command posts a tag-read event based on the XML content in the input file to a process.
Note
You can view the help for the RfidClientConsole utility by executing the rfidclientconsole /h command. To view more details about using a specific command, execute rfidclientconsole /h <command name>.
To verify that the process received the event
1.In RFID Manager, right-click TutorialProcess, and then click View Tags.2.In the View Tags - TutorialProcess dialog box, click Refresh to refresh the list, and verify that the tag you posted appears in the list.
3.Click Close to close the View Tags dialog box.
To verify that the SqlServerSink event handler executed
1.Click Start, point to Programs, point to Microsoft SQL Server, and then click SQL Server Management Studio.2.Enter the appropriate credentials, and then click Connect if you see the Connect to Server dialog box.
3.In the Object Explorer window, expand Databases, and confirm that the RFIDsink database exists.
4.Click RFIDsink, and then click New Query on the toolbar.
Note
The SqlServerSink event handler creates the RFIDsink database when the component is invoked for the first time and if the database does not exist on the computer.
5.Type and execute the following query in the query editor:
select * from tagevents where processname='TutorialProcess' order by sinktime desc
Note
The sink time is the date-time stamp at which the process receives the event. The tag time is the date-time stamp in the input XML file.
6.Confirm that the tag you posted to the process appears in the result list.
Note
The value of the tag ID in the XML file is "AQEBAQ==", which is a base64 string representation of the hex2 value "0x01010101". Therefore, look for a tag event with tag ID 0x01010101 in the result list.
Comments
The following comments apply to this step:
The AddEventToProcessPipeline method or the Send Tags dialog box posts a tag-read event directly to the process pipeline. The event is a simulated tag-read event, and there is no physical device or device simulator involved in this scenario.
In a real-world scenario, a tag-reader device sends a message to the device provider when an item with a tag comes within its range, and the provider raises an event for the event processing engine to process. You can also write a device simulator that simulates a real device, and have the simulator send a message to the provider, which in turn raises a tag-read event.
In the order fulfillment scenario, a reader at the shipping station raises a tag-read event for an RFID process when an item is going out the dock door to the distribution center.
Next Steps
Now that you have completed this step, perform the steps in Lesson 2: Create a Custom Event Handler and Add It to the Process.
Lesson 2: Create a Custom Event Handler and Add It to the Process
In Lesson 1: Create an RFID Process, you created the TutorialProcess process with a logical device and a SqlServerSink event handler. In this lesson, you create a custom event handler that generates an advance shipment notice (ASN) message to be sent to the distribution center, and add the custom event handler to the event handler pipeline.
Note
In the Order Fulfillment Scenario [RFID11], the ASN is generated at the shipping station when the item goes out at the dock door, and the ASN is sent to the distribution center.
In This Section
Step 1: Create a Custom Event Handler
Step 2: Modify the Process to Use the Custom Event Handler
Step 3: Test the Process
Step 1: Create a Custom Event Handler
In this step, you create a custom event handler that generates an advance shipping notice (ASN) message in XML format.
Prerequisites
You must complete Lesson 1: Create an RFID Process before performing this step.
You must have Microsoft VisualStudio® installed on your computer.
Overview of This Step
You perform the following procedures in this step.
Procedure / DescriptionTo create an event handler class / This procedure has instructions to create a custom event handler class that derives from the RfidEventHandlerBase class.
To implement the GetEventHandlerMetadata method / This procedure has instructions to implement the GetEventHandlerMetadata method to support parameters for the event handler.
To implement the Init method / This procedure has instructions to implement the Init method to support initialization of the event handler.
To implement the ProcessTagReadEvent method / This procedure has instructions to implement the ProcessTagReadEvent method to support processing an event.
To build the event handler assembly / This procedure has instructions to build the event handler assembly (myeventhandler.dll).
Procedures