Click here to Skip to main content
15,867,453 members
Articles / Programming Languages / C#

Fax Adapter

Rate me:
Please Sign up or sign in to vote.
3.62/5 (13 votes)
28 Sep 2006CPOL4 min read 63.4K   994   31   6
Fax Adapter for BizTalk Server 2006

Introduction

One of the primary design goals of BizTalk Server 2006 is to facilitate the exchange of business documents between trading partners. To help meet this goal, BizTalk Server 2006 includes several adapters that provide connectivity between BizTalk Server and trading partners using commonly recognized data protocols and document formats.

BizTalk Server 2006 includes the following adapters, which are referred to as the "native" or "integrated" adapters: Base EDI, BizTalk Message Queuing, FILE, FTP, HTTP, MQSeries, MSMQ, POP3, SMTP, SOAP, SQL, and Windows Sharepoint Services.

I thought of developing a Custom Biztalk Adapter and it lead to the development of the Fax Adapter.

The Adapter Framework

The following figure shows how an adapter and the Adapter Framework work together to connect your application to BizTalk Server.

  1. Data is received through a receive location that is listening for messages of a certain protocol at a specified address. The receive location is associated with an adapter and a receive pipeline. You can configure both the adapter and the pipeline components to perform certain logic on messages having a predetermined protocol.
  2. After the message is received by the receive location, the message is sent to the adapter, which creates a new BizTalk Server message, attaches the data stream to the message (typically in the body part of the message), adds any metadata pertaining to the endpoint over which the data was received, and then submits that message into the Messaging Engine.
  3. The Messaging Engine sends the message to the receive pipeline where the data is transformed into XML, the message sender is authenticated, the message is decrypted, and the XML is validated.
  4. The Messaging Engine publishes the message to the MessageBox. The MessageBox is a Microsoft SQL Server table containing messages to be processed. Both orchestrations and send ports can subscribe to the MessageBox.
  5. The Messaging Engine sends the message to either an orchestration or a send port subscriber based upon the message context properties matching the specifications set in the filter on the subscriber.

If an orchestration is the subscriber, it processes the message and sends it out using a send port. After the send port has it, or is the only subscriber, the message passes through the send pipeline into a send adapter before being transmitted over the wire.

Adapter Framework

Receive Adapters

Receive adapters are responsible for creating a new BizTalk Server message by attaching the network/data source stream to the message body. It also adds any metadata pertinent to the endpoint over which the data was received, then submits that message to the Messaging Engine.

The adapter deletes the data from the receive endpoint or sends the appropriate acknowledgement message to the client indicating that the data has been accepted into BizTalk Server.

The following figure shows the interfaces implemented by receive adapters.

Receive Adapter

Send Adapters

Send adapters are responsible for sending a BizTalk message to the specified endpoint using its specific transport protocol.

The following figure shows the interfaces that batched and non-batched send adapters need to implement:

Send Adapter

FaxAdapter

The FaxAdapter is written on top of the File Adapter Sample in Microsoft Visual C# .NET to work with Microsoft BizTalk Server 2006. It provides code to build either a dynamic or a static adapter. However, the following procedure only outlines the static adapter. A static adapter is an adapter with a static set of schemas and no custom user interface. A dynamic adapter has a custom user interface and potentially a dynamic set of schemas. Both static and dynamic adapters use the Add Adapter Wizard to add their schemas to a BizTalk project.

The dynamic adapter with a custom user interface and potentially dynamic set of schemas will require additional code in the adapter management side.

What This FaxAdapter Does

Fax Console

When the FaxMessage arrives to the Incoming Archive, the Fax Adapter copies the Tiff Image (FaxMessage) to the temporary folder and runs OCR on the Tiff Image and extracts the text and submits to BizTalk as a message, or takes messages from BizTalk Server and sends to the FaxConsole. It provides code to build either a dynamic or a static adapter; however, the following procedure only outlines the static adapter. A static adapter is an adapter with a static set of schemas and no custom user interface. A dynamic adapter has a custom user interface and potentially a dynamic set of schemas. Both static and dynamic adapters use the Add Adapter Wizard to add their schemas to a BizTalk project.

FaxAdapter Environment

  • Windows Server 2003
  • Microsoft Office 2003 (with Microsoft Document and Imaging)
  • Configured FaxConsole with Modem
  • Microsoft SQL Server 2005
  • Microsoft Visual Studio 2005
  • Microsoft BizTalk Server 2006

The FaxAdapter Project has the references of FaxService (ships with OS Windows Server 2003) and Document Imaging (Ships with Office 2003).

Fax Library to access FaxConsole for incoming and outgoing messages
Fax Console Reference
Imaging Library to perform OCR operation on TIFF Image
Imaging Reference

The following tables show the files in this sample and describe their purpose.

FaxAdapterDescription
\Design Time filesContains the design time and management project (FaxAdapterManagement.csproj)
\Runtime filesContains the run-time file-copy receive and transmit projects (FaxAdapter.csproj)

History

  • 29th September, 2006: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
India India
Anil is from Hyderabad, Andhra Pradesh. He is Currently Working with VisualSoft Technologies Ltd., As a Software Engineer.

Anil has more than 4 yrs of experience in the IT industry working on Microsoft Technologies. He is involved in various project activities like System Architecture, Design, and Development. Technical experience most specifically ASP.NET , Javascript, Biztalk 2004/2006, Webservices, C# and .NET framework. He has have worked on various language and platforms. He is Microsoft Certified professional.

The author has won several programming awards within the organizations worked and is well-recognized.


--

Comments and Discussions

 
GeneralUsing the Fax Class Pin
Mohammad Riazi9-Aug-08 22:20
Mohammad Riazi9-Aug-08 22:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.