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.
- 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.
- 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.
- 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.
- The Messaging Engine publishes the message to the
MessageBox is a Microsoft SQL Server table containing messages to be processed. Both orchestrations and send ports can subscribe to the MessageBox.
- 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.
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.
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:
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
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.
- 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
Imaging Library to perform OCR operation on TIFF Image
The following tables show the files in this sample and describe their purpose.
|\Design Time files||Contains the design time and management project (FaxAdapterManagement.csproj)|
|\Runtime files||Contains the run-time file-copy receive and transmit projects (FaxAdapter.csproj)|
- 29th September, 2006: Initial post