Поделиться через


Download and try the InfoPathBroker sample

Following up on my previous article, I decided to provide a sample that people could try for building InfoPath interfaces to SQL Service Broker applications. The sample is a simple expense report form being submitted to backend HR broker service. You can download the code from here:

(The service broker sample library had to be hacked to make it compatible to .NET 1.1 since the InfoPath Toolkit for Visual Studio is only available with VS.NET 2003 and not with Whidbey beta. This library is not 100% compatible to the original library since I've converted generic collections to object collections and SqlBytes to byte[].)

Requirements:

  • SQL Server 2005 Beta 2
  • Visual Studio .NET 2003 and .NET Framework SDK 1.1
  • InfoPath 2003 (SP1)
  • InfoPath Toolkit for VS.NET (see this article for a quick-start)
  • Microsoft.SqlServer.Broker for .NET 1.1 (run install.cmd to install in GAC)

These were the steps that I followed to create the InfoPathBroker sample:

  1. Created an XML schema for ExpenseReport.
  2. Created a new database with message type, contract, queues and services (install.sql)
  3. Created a new InfoPath project in VS.NET 2003 and designed a form using the schema created above.
  4. Edited the _Startup() method to connect to SQL Server and create a Service object.
  5. Edited the _Shutdown() method to close the SQL Server connection.
  6. Implemented the OnSubmitRequest() method to serialize the xml form data into a message, begin a dialog conversation and send that message on the conversation.
  7. Built the solution.
  8. Followed the steps in this article to grant full-control and register the form (register.js)

I would like to move the code to https://www.sqlservicebroker.com but I'm still figuring out how to use the site.