Documente online.
Zona de administrare documente. Fisierele tale
Am uitat parola x Creaza cont nou
 HomeExploreaza
upload
Upload




Using the BizTalk SQL Adapter to Send a Request to the rfidsink Database

computers


Using the BizTalk SQL Adapter to Send a Request to the rfidsink Database

You can integrate BizTalk Server applications with BizTalk RFID-enabled applications in several ways, including the following:



Using the BizTalk SQL adapter to receive the event data stored in the rfidsink database (receive only scenario)

Using the BizTalk SQL adapter to send a request to the rfidsink database and get the event data as the response (solicit-response scenario)

Using the Web service exposed by BizTalk RFID from a BizTalk orchestration (solicit-response scenario)

The RequestResponseSqlAdapter sample demonstrates how to use the BizTalk SQL adapter to send a request to the rfidsink database and get back the event data as a response.

The BizTalk RFID product ships with two stored procedures that are useful to integrate with BizTalk Sever applications—GetAndDeleteEventsForBizTalk and GetTagReadEventsWithTimeFilter. The GetAndDeleteEventsForBizTalk stored procedure returns all rows in the TagEvents table for a process and then deletes them. The GetTagReadEventsWithTimeFilter stored procedure returns all TagEvents received by an RFID process within a start time and an end time.

The SimpleReceive sample uses the GetAndDeleteEventsForBizTalk stored procedure, and this sample uses the GetTagReadEventsWithTimeFilter stored procedure.

What This Sample Does

This sample contains a BizTalk orchestration that performs the following sequence of steps:

Picks up the Input.xml file from C:, which contains the name of the RFID process, start sink time, and end sink time. The sink time is the time at which the events are sinked to the rfidsink database.

Sends a request to the SQL adapter to execute the GetTagReadEventsWithTimeFilter stored procedure with the process name, start time, and end time as parameters.

Receives the results from executing the stored procedure as a response from the SQL adapter. The result data is an XML text containing all the event data that is stored between the start sink time and the end sink time.

Creates an output file, OutRequestResponse.xml, if the file does not exist, and adds the event data received from the SQL adapter in XML format to the file.

How This Sample Was Designed and Why

The main purpose of this sample is to show you how to use the BizTalk SQL adapter to send a request to the rfidsink database and get the event data back as the response. In this sample, the orchestration uses the SQL adapter to send a request to execute the GetTagReadEventsWithTimeFilter stored procedure with the process name, start sink time, and end sink time as the parameters. The SQL adapter returns the results from executing the stored procedure to the orchestration. The result data contains all the event data that is stored between the start sink time and the end sink time. The GetTagReadEventsWithTimeFilter stored procedure deletes the event data as well.

The sample orchestration in this sample simply drops the response it received from the SQL adapter as an XML file (outRequestResponse.xml) in the C: folder. The sample is designed so that you can extend or modify the orchestration to include any business logic and test it further.

To understand how to use the BizTalk SQL adapter to generate schemas needed to execute a stored procedure from an orchestration, see the walkthrough 'Using the SQL Adapter with a Stored Procedure in an Orchestration' in the BizTalk Server documentation at https://go.microsoft.com/fwlink/?LinkId=86001.

Where to Find This Sample

You can find the download package for this sample online at https://go.microsoft.com/fwlink/?LinkId=83460. The following table shows the files in this sample and describes their purpose.

File(s)

Description

RequestResponseSqlAdapter.sln, RequestResponseSqlAdapter.btproj, BizTalk Server Project1.snk

Solution, project, and key files for the RequestResponseSqlAdapter sample.

RequestResponseSqlAdapter.odx

BizTalk orchestration file.

SQLServiceSend.xsd

Schema for the XML request and the response.

Bindings.xml

XML file containing the binding information for the orchestration in the sample.

Request.xml

Sample XML file for testing the BizTalk application.

Prerequisites

The following list contains the prerequisites for understanding and running the sample.

You must have BizTalk Server 2006 installed on your computer to build and test the sample.

The user account under which the BizTalk Host hosting the SQL adapter is running must have read/write access to the rfidsink database. Giving the BizTalk Application Users group on your computer permissions to read/write to the rfidsink database would also help.

You must configure the BizTalk Hosts as trusted by following the steps described in the MSDN topic at https://go.microsoft.com/fwlink/?LinkId=86000.

To understand how to use the BizTalk SQL adapter to generate schemas needed to execute a stored procedure from an orchestration, see the walkthrough 'Using the SQL Adapter with a Stored Procedure in an Orchestration' in the BizTalk Server documentation at https://go.microsoft.com/fwlink/?LinkId=86001.

How to Use This Sample

You can use this sample to understand how to use the BizTalk SQL adapter to send a request to the rfidsink database to execute a stored procedure and get the response back. You can extend the orchestration in this sample to implement the workflow of business logic that needs to be executed based on the response received.

Building and Initializing This Sample

The following procedures explain how to build and deploy the BizTalk solution for the sample, and how to bind and start the orchestration.

To build and deploy the RequestResponseSqlAdapter project

Open RequestResponseSqlAdapter.sln in Visual Studio 2005.

In the Solution Explorer window, right-click RequestResponseSqlAdapter, and then click Properties

Expand Configuration Properties, and then click Deployment

Verify that the server name and the database name are correct.

Type SQLSolicitResponseToRfidSink for the Application Name

Click OK in the RequestResponseSqlAdapter Property Pages dialog box.

In the Solution Explorer window, right-click RequestResponseSqlAdapter, and then click Deploy

Important

If you copy the application name from this document and paste it to the project properties window in Visual Studio, make sure that an empty space character is not copied at the end of the application name. If the space character exists, delete it.

Note

When you deploy a BizTalk Server project, Visual Studio 2005 builds the project automatically before deploying the project.

To bind, deploy, and start the BizTalk application

Click Start, point to All Programs, point to Microsoft BizTalk Server 2006, and then click BizTalk Server Administration

Expand Console Root, expand BizTalk Server 2006 Administration, expand BizTalk Group, and then expand Applications

Right-click SQLSolicitResponseToRfidSink, point to Import, and then click Bindings

Navigate to the sample directory, select Bindings.xml, and then click Open

Note

Importing the bindings XML file creates the physical ports, and binds the physical ports to the logical ports in the orchestration.

Click Yes on the warning message that says 'The application name does not match the binding file. Do you wish to continue

Expand SQLSolicitResponseToRfidSink, and then click Send Ports

Right-click SqlSendPort from the list of send ports, and then click Properties

Click Configure

Click the ellipsis ( ) button for the Connection String

Type your computer name for the server name, and then click Test Connection

If Test Connection fails, give the interactive user account (logged-in user account) full access to the rfidsink database.

Click OK in the Data Link Properties dialog box.

Click OK in the SQL Transport Properties dialog box.

Click OK in the SqlSendPort - SendPort Properties dialog box.

Right-click SQLSolicitResponseToRfidSink, and then click Start

Click Start in the Start 'SQLSolicitResponseToRfidSink' Application dialog box.

Note

By default, starting a BizTalk application automatically enables receive locations, enlists and starts send ports, and enlists and starts orchestrations in the application. Any host instance associated with the application is also automatically started by default.

To create an RFID Test process

Click Start, point to All Programs, point to Microsoft BizTalk RFID, and then click RFID Manager

Expand RFID Services Administration, and expand your machine name

Expand Processes, and verify that the Test process exists. If the Test process does not exist, continue with the remaining steps in the procedure. If it already exists, skip the remaining steps in this procedure, and make sure that the Test process is running.

Right-click Processes, and then click New Process

Type Test for the Process Name, and then click OK

Click Next on the Welcome to Bind Wizard page.

Click New on the Bind Process to Logical Devices page.

Type mylogicaldevice for the name of the Logical Device

Click OK in the Logical Device Name dialog box.

Click Next on the Bind Process to Logical Devices page.

Click New Component

Select the SqlServerSink component from the list of available components, and then click Add

Type SqlSinkComponent for the Instance Name, and then click OK

Click Close in the Add Component dialog box.

Click Next in the Configure Components dialog box.

Select Start the process option when I click Finish, and then click Finish

Testing This Sample

The following procedure shows you how to send a sample tag event from a Test process to the rfidsink database, and how to send a request to execute a stored procedure in the rfidsink database, and get the response back by using the BizTalk SQL adapter.

To stop the SqlReceiveFromRfidSink application if it is running

In the BizTalk Administration console, verify that the SQLReceiveFromRfidSink application exists. If it exists, continue with the steps in this procedure. Otherwise, skip the remaining steps in this procedure.

Right-click SQLReceiveFromRfidSink, and then click Stop

Note

You must stop the SQLReceiveFromRfidSink application to test the SQLSolicitiResponseToRfidSink application. If you do not stop the SQLReceiveFromRfidSink application, it receives the event data from the rfidsink database, and the SQLSolicitResponseToRfidSink application may not find any event data.

Select the Full Stop option, and then click Stop in the Stop 'SQLReceiveFromRfidSink' Application dialog box.

To send a sample tag event to the Test process

In RFID Manager, right-click the Test process, and then click View Tags

Click Send Tags in the View Tags - Test dialog box.

Click Send in the Send Tags dialog box.

Click Refresh to see the Tag in the list of Tags

Execute the following SQL query by using SQL Query Analyzer:

Select Id, DeviceName, TagId, SinkTime from rfidsink..TagEvents

Where ProcessName='Test'

Verify that the event you posted by using the Send Tags dialog box exists in the rfidsink database.

To test the BizTalk sample application

Open the Request.xml file in Notepad.

Change the values of the start time and end time elements to make sure that the SQL adapter picks up the event that you posted. In the Request.xml file, the end time element is ahead of the start time element. Make sure that you specify the end time to be later than the start time as shown in the following fragment:

<ns0:RequestRoot xmlns:ns0='https://SQLSendPort'>

<ns0:GetTagReadEventsWithTimeFilter ProcessName='Test' end='2007-03-17 08:00:00 PM' start='2007-03-17 06:00:00 PM'/>

</ns0:RequestRoot>

Copy the Request.xml file from the sample directory to C:

Verify that the OutRequestResponse.xml file is created in C:

Note

If you do not see the OutRequestResponse.xml file, check the event log for any error messages. If the error message states that the account does not have permissions to write to the folder, give the account under which the BizTalk Host is running the permission to write to the folder. If you do not see any error message in the event log, verify that the BizTalk Host instance is running.

Open OutRequestResponse.xml in Notepad and verify that you see XML output similar to the following output:

<?xml version='1.0' encoding='utf-16'?>

<ResponseRoot xmlns='https://SQLSendPort'>

<events Id='81'

DeviceName='mylogicaldevice'

TagId='dbobject/dbo.TagEvents[@Id='81']/@TagId'

TagType='1'

TagTypeDescription='EPC Class 0 tag'

TagSource=''

TagTime='2007-03-17T19:24:43.227'

TagData='dbobject/dbo.TagEvents[@Id='81']/@TagData'

SinkTime='2007-03-17T19:24:43.223'

ProcessName='Test'

ExtData='&lt;VendorSpecificInformation xmlns:i=&quot;https://www.w3.org/2001/XMLSchema-instance&quot; xmlns=&quot;https://schemas.datacontract.org/2004/07/System.IO.SensorServices.Rfid.Client&quot;&gt;&#xD;&#xA;&lt;dictionary xmlns:d2p1=&quot;https://schemas.microsoft.com/2003/10/Serialization/Arrays&quot; /&gt;&#xD;&#xA;&lt;/VendorSpecificInformation&gt;'

LogicalDeviceName='mylogicaldevice'

TagIdAsHex='0x3784'

TagDataAsHex='0xabcd3784' />

</ResponseRoot>

See Also

BizTalk Server 2006 R2 Beta 2 Code Samples


Document Info


Accesari: 908
Apreciat: hand-up

Comenteaza documentul:

Nu esti inregistrat
Trebuie sa fii utilizator inregistrat pentru a putea comenta


Creaza cont nou

A fost util?

Daca documentul a fost util si crezi ca merita
sa adaugi un link catre el la tine in site


in pagina web a site-ului tau.




eCoduri.com - coduri postale, contabile, CAEN sau bancare

Politica de confidentialitate | Termenii si conditii de utilizare




Copyright © Contact (SCRIGROUP Int. 2024 )