Enrico's profileEnrico ZerilliPhotosBlogLists Tools Help
There are no photo albums.

Enrico Zerilli

MCTS BizTalker EAI BizTalk 2004 Biztalk 2006

Attach Detach BTS DB

One of the problems we face during the development of BizTalk Application is that lack of space in the main drive C:\, Since we do default installation for MSSQL and BizTalk 2004, the Data File and Log Files is of course is installed in C:\Program Files\Microsoft SQL Server\MSSQL\Data.

To solve this is we have to move all BizTalk's DB from C:\ to another drive. Another thing is, we also do have the CovastDB which is used in X12 parsing which has to be moved also.

Note: Before performing this operation you should first stop the following services:

Enterprise Single Sign-On Services

BizTalk Service BizTalk Group : BizTalkServerApplication

Covast EDI Service

Script:

sp_detach_db 'BAMArchive'
sp_detach_db 'BAMPrimaryImport'
sp_detach_db 'BizTalkDTADB'
sp_detach_db 'BizTalkEDIDb'
sp_detach_db 'BizTalkHwsDb'
sp_detach_db 'BizTalkMgmtDb'
sp_detach_db 'BizTalkMsgBoxDb'
sp_detach_db 'BizTalkRuleEngineDb'
sp_detach_db 'SSODB'
sp_detach_db 'CovastDB'


sp_attach_db 'BAMArchive',
'E:\DBDat\BAMArchive.mdf',
'F:\DBLOG\BAMArchive_log.LDF'

sp_attach_db 'BAMPrimaryImport',
'E:\DBDat\BAMPrimaryImport.mdf',
'F:\DBLOG\BAMPrimaryImport_log.LDF'


sp_attach_db 'BizTalkDTADB',
'E:\DBDat\BizTalkDTADB.mdf',
'F:\DBLOG\BizTalkDTADB_log.LDF'

 

sp_attach_db 'BizTalkEDIDb',
'E:\DBDat\BizTalkEDIDb.mdf',
'F:\DBLOG\BizTalkEDIDb_log.LDF'

 

sp_attach_db 'BizTalkHwsDb',
'E:\DBDat\BizTalkHwsDb.mdf',
'F:\DBLOG\BizTalkHwsDb_log.LDF'


sp_attach_db 'BizTalkMgmtDb',
'E:\DBDat\BizTalkMgmtDb.mdf',
'F:\DBLOG\BizTalkMgmtDb_log.LDF'

sp_attach_db 'BizTalkMsgBoxDb',
'E:\DBDat\BizTalkMsgBoxDb.mdf',
'F:\DBLOG\BizTalkMsgBoxDb_log.LDF'

sp_attach_db 'BizTalkRuleEngineDb',
'E:\DBDat\BizTalkRuleEngineDb.mdf',
'F:\DBLOG\BizTalkRuleEngineDb_log.LDF'

sp_attach_db 'SSODB',
'E:\DBDat\SSODB.mdf',
'F:\DBLOG\SSODB_log.LDF'


sp_attach_db 'CovastDB',
'E:\DBDat\CovastDB.mdf',
'F:\DBLOG\CovastDB_log.LDF'

Luckily, BizTalk 2004 and Covast still work.

Discussione su BAM EventBus Error

 

Citazione

BAM EventBus Error

Either another TDDS is processing the same data or there is an orphaned session in SQL server holding TDDS lock. Either another TDDS is processing the same data or there is an orphaned session in SQL Server holding TDDS lock. SQL Server: \. Database: BizTalkDTADb

 

The above error seems to indicate that more than one TDDS is processing at the same time / on the same data, locking it and preventing access to it. If you experience this error in a clustered / multi-node BizTalk Server environment, follow these steps to ensure that your domain groups are added to the proper SQL Server database rolls that are created when BTS is installed. (NOTE: You will have to do this on each SQL Server instance where BizTalk is installed.)

 

  1. Execute SQL Server Enterprise Manager (EM).
  2. Expand the SQL Server instance we are working with, and expand Databases.
  3. Expand the BAMArchive database, and select Roles.
  4. Double-click (or right-clickàProperties) the BTS_ADMIN_USERS role. If the domain group BizTalk Server Administrators group is not a member of this role, click the Add button to add it. (NOTE: If the group does not appear as available when you click add, you will need to cancel this, select Logins for this database, and add the \BizTalk Server Administrators group as a new login to this database before you can add it as a role.)
  5. Click okay to save.
  6. Select Users on the left and ensure that the BizTalk Isolated Host Users group is a login for this database. If it is not, right-click on the right pane, select New User and add this login to this database.
  7. Select Roles on the left, and double click the BTS_HOST_USERS role. IF the \BizTalk Isolated Host Users group is not a member of this role, click Add and add this login to this role. Click OK when done.
  8. Expand the database BAMPrimaryImport on the left.
  9. Select Users and here we need to add our BizTalk Service Account. This is not done automatically during the ConfigFramework.
  10. Right-click on the right pane, select New User and add our service account login to this database.
  11. Next, click Roles and double click the BAM_EVENT_WRITER role on the right. Add our service (BtsService) account, and the BizTalk Server Administrators logins to this role.
  12. Click OK to save.
  13. Double click the BAMQueryWS role and add our service (BtsService) account and the BizTalk Isolated Host Users accounts to this role.
  14. Click OK to save.
  15. Next, expand the BizTalkDTADb database object, and select Roles on the left.
  16. On the right double-click the BAM_EVENT_WRITER role, and add the BizTalk Server Administrators login and the service (BtsService) login to this role. Click OK to save.
  17. Double-click the HM_EVENT_WRITER role, and add the BizTalk Server Administrators and the service account to this role as well. Click OK to save.
  18. Next, expand the BizTalkMgmtDb database object, and select Roles on the left.
  19. Double-click the BAM_CONFIG_READER role, and add the service account to this role. Click OK to save.
  20. Next, expand the BizTalkMsgBoxDb database object, and select Users.
  21. Right-click on the right pane, select New User and add the service account as a login to this database. Click OK to save. Now select Roles on the left.
  22. Double-click the BAM_EVENT_READER role, and add the service account to this role. Click OK to save.

BAM EventBus Error

Either another TDDS is processing the same data or there is an orphaned session in SQL server holding TDDS lock. Either another TDDS is processing the same data or there is an orphaned session in SQL Server holding TDDS lock. SQL Server: \. Database: BizTalkDTADb

 

The above error seems to indicate that more than one TDDS is processing at the same time / on the same data, locking it and preventing access to it. If you experience this error in a clustered / multi-node BizTalk Server environment, follow these steps to ensure that your domain groups are added to the proper SQL Server database rolls that are created when BTS is installed. (NOTE: You will have to do this on each SQL Server instance where BizTalk is installed.)

 

  1. Execute SQL Server Enterprise Manager (EM).
  2. Expand the SQL Server instance we are working with, and expand Databases.
  3. Expand the BAMArchive database, and select Roles.
  4. Double-click (or right-clickàProperties) the BTS_ADMIN_USERS role. If the domain group BizTalk Server Administrators group is not a member of this role, click the Add button to add it. (NOTE: If the group does not appear as available when you click add, you will need to cancel this, select Logins for this database, and add the \BizTalk Server Administrators group as a new login to this database before you can add it as a role.)
  5. Click okay to save.
  6. Select Users on the left and ensure that the BizTalk Isolated Host Users group is a login for this database. If it is not, right-click on the right pane, select New User and add this login to this database.
  7. Select Roles on the left, and double click the BTS_HOST_USERS role. IF the \BizTalk Isolated Host Users group is not a member of this role, click Add and add this login to this role. Click OK when done.
  8. Expand the database BAMPrimaryImport on the left.
  9. Select Users and here we need to add our BizTalk Service Account. This is not done automatically during the ConfigFramework.
  10. Right-click on the right pane, select New User and add our service account login to this database.
  11. Next, click Roles and double click the BAM_EVENT_WRITER role on the right. Add our service (BtsService) account, and the BizTalk Server Administrators logins to this role.
  12. Click OK to save.
  13. Double click the BAMQueryWS role and add our service (BtsService) account and the BizTalk Isolated Host Users accounts to this role.
  14. Click OK to save.
  15. Next, expand the BizTalkDTADb database object, and select Roles on the left.
  16. On the right double-click the BAM_EVENT_WRITER role, and add the BizTalk Server Administrators login and the service (BtsService) login to this role. Click OK to save.
  17. Double-click the HM_EVENT_WRITER role, and add the BizTalk Server Administrators and the service account to this role as well. Click OK to save.
  18. Next, expand the BizTalkMgmtDb database object, and select Roles on the left.
  19. Double-click the BAM_CONFIG_READER role, and add the service account to this role. Click OK to save.
  20. Next, expand the BizTalkMsgBoxDb database object, and select Users.
  21. Right-click on the right pane, select New User and add the service account as a login to this database. Click OK to save. Now select Roles on the left.
  22. Double-click the BAM_EVENT_READER role, and add the service account to this role. Click OK to save.

Inbound Multiple Idoc from a SAP Enviroment

In BizTalk 2004 it's possible to connect just one Receive Port an SAP enviroment.
This can be a limitation when i want to receive many kinds Idoc (p.es. DELVRY02, ZOIFSEDE01, ... ).
For solve this problem i have create a simple orchestration that receive an inbound document very simple: the figure Inbound_Message explain that.
 
This schema have an simple row that load all Idoc Received from SAP.
The orchestration give inbound document to an external assembly that read the Idoc and in the position 39 on the first row there is tha Idoc Family name. Depends this name the assembly can direct the entire Idoc in the right position (p.es. Folder, HTTP, ... ). The figure Orchestration_Idoc_Message explain that. I conseil of use a configuration file XML where put the rule of binding. P.es. the Idoc DELVRY02 must go in folder D:\DELVRY02, the Idoc ZOIFSEDE01 must go to folder D:\ZOIFSEDE01 and go on.
 
This is a very simple solution for solve the problem with unique Receive Port in binding with SAP enviroment.
 
 
 

Connecting Systems

The effective exchange of messages across different software on different machines is an absolute requirement for integration. Given the diversity of communication styles that exist, the BizTalk Server 2006 engine must support a variety of protocols and message formats. As described next, a significant portion of the engine is devoted to making this communication work. One important fact to keep in mind, however, is that the engine works only with XML documents internally. Whatever format a message arrives in, it must be converted to an XML document after it is received. Similarly, if the recipient of a document can’t accept that document as XML, the engine converts it into the format expected by the target.

Sending and Receiving Messages: Adapters

Because the BizTalk Server 2006 engine must talk to a variety of other software, it relies on adapters to make this possible. An adapter is an implementation of a communication mechanism, such as a particular protocol. A developer determines which adapters to use in a given situation. He might choose one of the built-in adapters BizTalk Server 2006 provides, for example, or use an adapter created for a popular product such as SAP, or even create a custom adapter. In each of these cases, the adapter is built on a standard base called the Adapter Framework. This framework provides a common way to create and run adapters, and it also supports the same tools used to manage all of the adapter types.

Microsoft BizTalk Server 2006 includes the following adapters:

  • Web Services adapter: supports sending and receiving messages using SOAP over HTTP. Because SOAP is the core protocol for Web services, this adapter is critical for BizTalk Server 2006’s ability to interact in a service-oriented world. As usual with Web services, URLs are used to identify the sending and receiving systems.

  • File adapter: supports reading from and writing to files in the Windows file system. Because the applications involved in a business process can often access the same file system, either locally or across a network, exchanging messages through files can be a convenient option.

  • FTP adapter: supports sending and receiving information between a File Transport Protocol (FTP) Server and BizTalk Server.

  • HTTP adapter: supports sending and receiving information using HTTP. The BizTalk Server 2006 engine exposes one or more URLs to allow other applications to send data to it, and it can use this adapter to send data to other URLs.

  • MSMQ adapter: supports sending and receiving messages using Microsoft Message Queuing (MSMQ).

  • MSMQT adapter: supports sending and receiving messages using BizTalk Message Queuing (MSMQT). MSMQT is an implementation of the MSMQ protocol that can receive and send MSMQ messages into the MessageBox. Although BizTalk Server 2006 still includes this adapter, developers should use the MSMQ adapter instead.

  • WebSphere MQ adapter: supports sending and receiving messages using IBM’s WebSphere MQ (formerly known as MQSeries).

  • SMTP adapter: supports sending messages using SMTP. Standard e-mail addresses are used to identify the parties.

  • POP3 adapter: supports receiving e-mail messages and their attachments using version three of the Post Office Protocol (POP3).

  • Windows SharePoint Services (WSS) adapter: supports accessing and publishing documents stored in Microsoft Windows SharePoint document libraries.

  • SQL adapter: supports reading and writing information to a SQL Server database.

  • Base EDI adapter: supports sending and receiving messages in the electronic data interchange (EDI) format.

Adapters for commonly-used business software are also available from Microsoft, including adapters for Siebel, PeopleSoft, Oracle applications and Oracle databases, JD Edwards OneWorld and EnterpriseOne, TIBCO Rendezvous and Enterprise Messaging Service, and Amdocs Clarify.

Whichever adapter is used to receive data, the messages it receives must commonly be processed before they can be accessed by an orchestration. Similarly, outgoing messages produced by an orchestration often need to be processed before they are sent by an adapter.

Processing Messages: Pipelines

The applications underlying a business process communicate by exchanging various kinds of documents: for examples, purchase orders and invoices. For a BizTalk Server 2006 application to execute a business process, it must be able to correctly deal with the messages that contain these documents. This processing can involve multiple steps, and hence is performed by a message pipeline. Incoming messages are processed through a receive pipeline, while outgoing messages go through a send pipeline.

For example, even though more applications are being designed to understand XML documents, many—probably the majority today—cannot. Because the BizTalk Server 2006 engine works only with XML documents internally, it must provide a way to convert other formats to and from XML. Other services may also be required, such as authenticating the sender of a message. To handle these and other tasks in a modular, yet customizable way, a pipeline is constructed from some number of stages, each of which contains one or more .NET-enabled or Component Object Model (COM) components. Each component handles a particular part of message processing. The BizTalk Server 2006 engine provides several standard components that address the most common cases. If these aren’t sufficient, developers can also create custom components for both receive and send pipelines.

The figure above illustrates the stages in a receive pipeline, along with the standard components provided for each one. Those stages and their associated components are:

  • Decode: BizTalk Server 2006 provides one standard component for this stage, the MIME/SMIME Decoder. This component can handle messages and any attachments they contain in either MIME or Secure MIME (S/MIME) format. The component converts both types of messages into XML, and it can also decrypt S/MIME messages and verify their digital signatures.

  • Disassemble: Three standard components are provided. The Flat File Disassembler component turns flat files into XML documents. These files can be positional, where each record has the same length and structure, or delimited, with a designated character used to separate records in the file. The second standard component, the XML Disassembler, parses incoming messages that are already described using XML. The third standard component, one that’s not often used today, is the BizTalk Framework Disassembler. It accepts messages sent using the reliable messaging mechanism defined by the BizTalk Framework, which was implemented in BizTalk Server 2000.

  • Validate: BizTalk Server 2006 provides an XML Validator component for this stage. As its name suggests, this component validates an XML document produced by the Disassemble stage against a specified schema or group of schemas, returning an error if the document doesn’t conform to one of those schemas.

  • Resolve Party: the only standard component for this stage, Party Resolution, attempts to determine an identity for this message’s sender. If the message was digitally signed, the signature is used to look up a Windows identity in the Management database in BizTalk Server 2006. (As described later, this database is also used by BizTalk Server’s management tools.) If the message carries the authenticated security identifier (SID) of a Windows user, this identity is used. If neither mechanism succeeds, the message’s sender is assigned a default anonymous identity.

Outgoing messages can also go through multiple stages, as defined by the send pipeline in use. The figure above shows the stages and standard components for a send pipeline. They are:

  • Pre-assemble: No standard components are provided. Instead, custom components can be inserted here as needed.

  • Assemble: Paralleling the Disassemble stage in a receive pipeline, this stage also has three standard components. The Flat File Assembler converts an XML message into a positional or delimited flat file, and the XML Assembler supports adding an envelope and making other changes to an outgoing XML message. The third option, the BizTalk Framework Assembler, packages messages for reliable transmission using the BizTalk Framework messaging technology.

  • Encode: BizTalk Server 2006 defines only one standard component for this stage, the MIME/SMIME Encoder. This component packages outgoing messages in either MIME or S/MIME format. If S/MIME is used, the message can also be digitally signed and/or encrypted.

BizTalk Server 2006 defines some default pipelines, including a simple receive/send pair that can be used for handling messages that are already expressed in XML. A developer can also create custom pipelines using the Pipeline Designer. This tool, which runs inside Microsoft Visual Studio 2005, provides a graphical interface that enables the developer to drag and drop components to create pipelines with whatever behavior is required.

Choosing Messages: Subscriptions

After a message has made its way through an adapter and a receive pipeline, the next step is to determine where it should go. A message is most often targeted to an orchestration, but it’s also possible for a message to go directly to a send pipeline, allowing the BizTalk Server 2006 engine to be used as purely a messaging system. In either case, this matching of messages with their destinations is done using subscriptions.

When a message is processed by a receive pipeline, a message context is created that contains various properties of the message. An orchestration or a send pipeline can subscribe to messages based on the values of these properties. For example, an orchestration might create a subscription that matches all messages of the type “Invoice”, or all messages of the type “Invoice” received from the QwickBank corporation, or all messages of the type “Invoice” received from the QwickBank corporation that are for more than $10,000. However it is specified, a subscription returns to its subscriber only those messages that match the criteria that the subscription defines. A received message might initiate a business process by instantiating some orchestration or it might activate another step in an already running business process. Similarly, when an orchestration sends a message, that message is matched to a send pipeline based on a subscription that pipeline has established.

  • In BizTalk Server 2006, it is also possible to subscribe to specific error conditions. An error message can be processed in a particular way or routed to a specific destination, such as a Windows SharePoint Services folder.

Business Activity Services [BTS]

As part of running a business process, a business analyst may beed to create a relationship with a new trading partner, for example, that defines the partner’s role, the business agreement between the two firms, and other aspects of this new association. Maybe a purchasing manager needs tools that can wrap together and distribute the artifacts required to let a partner quickly implement and begin participating in a business process. In BizTalk Server 2006, these functions are provided by Business Activity Services (BAS).

As shown below, a common user interface to all of these services is provided through Microsoft Windows SharePoint Services, Internet Explorer, Microsoft Excel, and Microsoft InfoPath. Because Business Activity Services are meant to be used by business people, not developers, it makes sense to expose them through these familiar tools. Behind this common interface are two different software components, both of which expose their services using SOAP. This section describes these two components.

Trading Partner Management

Creating business-to-business connections between trading partners is a common use of BizTalk Server today. Establishing these connections requires agreement on the communication protocol that will be used, the formats of messages that will be exchanged, and the business process that drives the interaction. Managing trading partner relationships can get complex, especially when many organizations are involved or when the players change frequently.

To allow information workers to perform these tasks, Business Activity Services include a Trading Partner Management (TPM) component. This component relies on a TPM database, as shown above, that stores information about trading relationships. Using the common Business Activity Services interface, information workers can create and modify agreements with trading partners who use BizTalk Server 2006. Each agreement describes the relationship between two parties, and the things it contains include:

  • A profile for each of the partners. Each profile contains business information about the organization, such as a contact person and address, along with technical information such as the protocol (which determines the BizTalk Server adapter) that should be used to communicate with them.

  • The business process itself, implemented as one or more orchestrations, along with the role each of the partners plays. One organization might act as the seller, for example, while the other acts as the buyer.

  • An addendum with parameters for the business process that control the behavior of the orchestration implementing it. How these parameters are used is described in the next section.

Profiles, agreements, and addendums are all stored in the TPM database. Using the TPM component (and for addendums, the Business Process Configuration component, described next), all of thedr can be configured directly by an information worker. This allows business people to establish and modify new partner relationships without relying on developers.

Business Process Configuration

Although a business analyst may not be able to create the orchestration that implements a business process,it’s not unreasonable to expect an information worker to set parameters for that orchestration. An example of where this would be useful is when an orchestration will be used with multiple partners, but each partner requires slightly different behavior. Suppose, for instance, that the maximum dollar value of a purchase order is different with different trading partners, or perhaps the maximum quantity that can be requested varies depending on the customer’s credit rating. For this type of change, business analysts could make these small configuration changes themselves.

To enable information workers configure an orchestration, the developer creating it can define parameters for that orchestration. Information workers can then set these parameters as needed, perhaps assigning different values for different business partners or different parts of their own organizations. An information worker sets those parameters using the TPM service, described in the previous section, by specifying their values in the addendum to this partner’s agreement. For agreement that reference multiple orchestrations, an addendum can be created for each orchestration.

Macros BizTalk 2004

Macro name

Substitute value

%datetime%

Coordinated Universal Time (UTC) date time in the format YYYY-MM-DDThhmmss (for example, 1997-07-12T103508).

%datetime_bts2000%

UTC date time in the format YYYYMMDDhhmmsss, where sss means seconds and milliseconds (for example, 199707121035234 means 1997/07/12, 10:35:23 and 400 milliseconds).

%datetime.tz%

Local date time plus time zone from GMT in the format YYYY-MM-DDThhmmssTZD, (for example, 1997-07-12T103508+800).

%DestinationParty%

Name of the destination party. The value comes from message the context property BTS.DestinationParty.

%DestinationPartyID%

Identifier of the destination party (GUID). The value comes from the message context property BTS.DestinationPartyID.

%DestinationPartyQualifier%

Qualifier of the destination party. The value comes from the message context property BTS.DestinationPartyQualifier.

%MessageID%

Globally unique identifier (GUID) of the message in BizTalk Server. The value comes directly from the message context property BTS.MessageID.

%SourceFileName%

Name of the file from where the File adapter read the message. The file name includes extension and excludes the file path, for example, foo.xml. When substituting this property, the File adapter extracts the file name from the absolute file path stored in the FILE.ReceivedFileName context property. If the context property does not have a value, for example, if message was received on an adapter other than File adapter, then the macro will not be substituted and will remain in the file name as is (for example, C:\Drop\%SourceFileName%).

%SourceParty%

Name of the source party from which the File adapter received the message.

%SourcePartyID%

Identifier of the source party (GUID). The value comes from the message context property BTS.SourcePartyID.

%SourcePartyQualifier%

Qualifier of the source party from which the File adapter received the message.

%time%

UTC time in the format hhmmss.

%time.tz%

Local time plus time zone from GMT in the format hhmmssTZD (for example, 124525+530).

Using Dynamic Maps in BizTalk

If you have used maps in BizTalk, by now, you must know that maps are used to transform an XML message into another format. I do not intend to go into the details about BizTalk maps here, but in essence, a map is a transformation on your existing data to the output format you desire. In this article, I will illustrate an interesting feature called Dynamic Maps in BizTalk. If you are a C++ fan like me, you would be amazed at the power of polymorphism and how a call to a function, say Shape.Draw(), differs with each derived class of Shape like Arc, Square, or Circle. So I don't have to explain why dynamic mapping is important.

Quite often in BizTalk, you come across scenarios where you need to transform a message to an output format, which you can decide only after you know some information which is contained in the message itself, like destination recipient. This can be achieved by using maps in the ports itself, but as the number of parties grow and your exception handling requirements kick in, this route has some limitations. This is where dynamic mapping inside orchestrations make sense.

Scenario

For this exercise, I am building an orchestration which identifies the destination party and loads the corresponding map and sends the message to the intended recipient after the desired transformation. For this example, I have two parties ABC and XYZ.

A Bird's Eye View of the Steps

These are the steps for implementing our Dynamic Maps. I am assuming a working knowledge of BizTalk for the solution below, as the concept is what I intend to illustrate. You can skip these steps by downloading the source from above.

  • Create a BizTalk Project for Maps.
  • Create all Schemas and Maps.
  • Create an Orchestration Project.
  • Identify the party and load the Maps dynamically.
  • Set the Destination dynamically and route the message.
  • Deploy and GAC the DLL.
  • Testing.

Getting Down to Business ..

I have broken down the process into a series of logical steps.

Step 1: Creating your Schemas and Maps Project

You need to create a Schema and Maps project. I have all my maps and schemas in a project called Dynamic Maps. I have added three schemas to the project.

  • The Generic Schema (Common Input Schema)
  • ABC Schema (for my party ABC)
  • XYZ Schema (for my party XYZ)

The details of the three schemas are as below. The input schema comes in with some basic information. The output schemas differ for the two parties ABC and XYZ. The three schemas are shown below.

Right click on SubscriberInfo in the GenericSchema and do a Quick promotion. This will add a property schema to the BizTalk project.

Now we build the two maps. Both the maps use some basic information from the sources schema, and add some additional information on the output side. I have used the Time functoid to get the submission time.

Step 2: Signing the DLL with a Key

You need to have a strong name for this assembly to get it loaded in the toolbox. So create a strong name and sign it. Once you have the strong key generated, reference that in the Assembly Key file value in the project properties.

Step 3: Compile and deploy the Maps project

From project properties in the Solution Explorer window, deploy the project. Check in GAC to see if the DLL is deployed. Note down the public key token from the file properties in GAC.

Step 4: Build the Dynamic Maps orchestrations

Add a new BizTalk project OrchestrationForDynamicMaps. Create a new Orchestration and name it Orch_DynamicMaps. In the Orchestration View window, create the following variables and messages. Set the value as in the table below. Leave the rest of the values as their default values.

Message / Variable Identifier Type Comments
Message Generic_In DynamicMaps.GenericInSchema The incoming Message
Message Message_Out System.Xml.XmlDocument The outgoing Message
Variable SubscriberInformation System.String Promoted Subscriber Info
Variable tMap System.Type The Map value

The orchestration built looks as in the figure below. The outline of steps is detailed below. You can download the source and follow the steps conceptually.

  • Add a Receive Port Receive_GenericMessage which accepts the Generic_In message declared above.
  • Add an Expression Shape Identify Subscriber and set the expression value as below:
    SubscriberInformation = 
       Generic_In(DynamicMaps.PropertySchema.SubscriberInfo );
  • Add a Decide and check if SubscriberInformation == "ABC" or SubscriberInformation == "XYZ", and a branch for termination.
  • Add an Expression Shape and name it Set Map and put the value.

    Change the public key token value to the value you noted down previously.

    tMap = System.Type.GetType("DynamicMaps.Map_ABC, 
             DynamicMaps, Version=1.0.0.0, Culture=neutral, 
             PublicKeyToken=f85be9e4dd36fb1d");
  • Add a Message Shape and do the dynamic transformation and dynamically set the Send port. These are the magic lines:
    transform (Message_Out) = tMap(Generic_In);
    Dynamic_Send(Microsoft.XLANGs.BaseTypes.Address) = 
         "FILE://C:\\Ports\\ABC\\%MessageID%.xml" ;
  • In the second branch for subscriber XYZ, we set the map to the map for XYZ and change the public key.
    tMap = System.Type.GetType("DynamicMaps.Map_XYZ, 
             DynamicMaps, Version=1.0.0.0, Culture=neutral, 
             PublicKeyToken=f85be9e4dd36fb1d");
  • Now we need to construct the message like ABC's. Alternately, you can construct the message in the Expression Shape directly, but you would need to add the construct keyword.
    construct Message_Out
    {
        transform (Message_Out) = tMap(Generic_In);
        Dynamic_Send(Microsoft.XLANGs.BaseTypes.Address) = 
                "FILE://C:\\Ports\\XYZ\\%MessageID%.xml" ;
    }
  • Add a Send port which sends out a message of type System.Xml, and use that to send the transformed file to your desired destination.
  • Compile and deploy the project.

Note: In essence, what we have done in the step above is to use the reflection feature in .NET and find the type of the Map. Then we use the variable and invoke the transformation by using the BizTalk internal keyword transform. BizTalk does all the hard work of loading the assembly dynamically for our use and unloading the assembly later, and all that plumbing that you otherwise need to write. Don't you love BizTalk now?

Step 5: Testing and Output

You can drop the two test files and you will get two different outputs for the same file based on changing the subscriber.

I have the inputs and outputs as below:

  • Input file for party ABC

  • Output for party ABC

  • Input file for party XYZ

  • Output for party XYZ

Step 8: A few notes on the output

The output is self explanatory, and you will notice that for identical inputs except for the party name, the output was different based on the maps used. We used a Time functoid to generate the time, and the other values came from fixed strings. And last but not the least, I confess, I am not 22 as the example file indicates or misleads, way older than that! My wife was quick to point that one out.

Points of Interest

Although in this example we have used a simple Decide shape to figure out which map to load, in real life implementations, this could be a database helper class which returns the name of the map assembly from a SQL database or a similar design. This design is useful since you can add more maps and systems even after the original system has gone live. This is possible because you can add a new subscriber into the database and have a new DLL with the corresponding schema and maps. This provides a loose-coupling which is highly desired in these scenarios.

Gotcha's

In the declaration of the variable tMap, I could not get it to be defined as System.Type from the dropdown. I had to open the .odx file in Notepad and set it manually after choosing a random type initially.

Exceptions

A very common exception would be:

Error in accessing the part data or one of its fragments. 
The part or fragment may not exist in the database.

When this happens, make sure you have both the assemblies deployed and they are present in the GAC. Also check that the ports are created and the Receive port uses an XML transmit pipeline and the Send port uses a pass-through transmit pipeline.

BizTalk Server—SOA implementation

BizTalk Server—SOA implementation

The value of implementing BizTalk Server with SOA is apparent when you consider how one might achieve the development and operational benefits specified previously. To begin with, we can examine the inefficiencies of the development process and the ways in which BizTalk Server addresses them.

Traditional programming methodologies do not adequately translate the conceptual model of an application or business process (that is, a design specification) into an executable form. While development notation systems such as UML allow a business analyst to document functional specifications and Use Cases using a structured methodology, a programmer still has to interpret this documentation and translate its intent into a different language and structure. This manual and highly interpretive conversion process is characterized by its inefficiencies—most notably its recursive revision cycles. After the business processes have been accurately translated into procedural code, another issue typically presents itself: the behavior of the code is less predictable than the behavior of the business process it models. This volatility results from the nature of procedural code implementations. Bound to a machine execution model, procedural code is an opaque embodiment of processes that encapsulate multiple levels of tightly coupled, interdependent functionality. Consequently, procedural code is prone to program errors that are often difficult and time-consuming to identify and repair. Understandably, then, when software is operationally stable, subsequent modifications are discouraged—often to the point of requiring modifications to business processes just to accommodate the limitations of the rigid code.

A BPM/EAI development environment allows the business analyst and the programmer to collaborate in a common workspace on a visual model of the process that combines and correlates their respective contributions. The programmer and analyst create the application by arranging high-level objects representing messages, messaging events, business rules and logic, information flows, activities, operations, transformations, and subprocesses, using a drag-and-drop graphical user interface. The model itself directly generates an executable run-time assembly of the process. This methodology provides significant development efficiencies and life cycle flexibility by minimizing the ambiguities and recursive revision cycles inherent in traditional methodologies. Furthermore, the implementation mechanisms for highly complex functions, such as transactions requiring two-phase commit, roll-back ACID transaction support, and nested and parallel operations, are built in functions of the objects; thus, eliminating the need to write complicated procedural code to implement these capabilities.

To better illustrate the SOA development methodology the following steps describe the procedure for creating an application in BizTalk Server that adheres to this paradigm:

1.

Create the documents involved in the application/process as well as their respective schema definitions.

This is accomplished in the Schema Editor, a BizTalk Server module accessed from within Visual Studio .NET. The Schema Editor enables you to define the structure and semantic metadata that “declares” the meaning, functions, and processing requirements of the content of a document (an “instance”) that is created from the schema. When BizTalk Server receives an instance of a document, the process to which the document is associated validates the document content against its schema definition to ensure the document’s form and content conform to the schema and the application’s processing requirements. BizTalk Server Schema Editor creates a W3C-compliant XSD document as well as a visual tree node reference model of the schema.

Following is an example of the Schema Editor that shows the tree node model of the schema in the left panel and the XML representation of the document schema in the right panel.

bizarc01.gif

2.

Create and define the transformation requirements for any document interchanges.

In applications that are composed of loosely coupled interactions between XML objects, document transformation becomes a functionally exposed mapping subprocess. In BizTalk Server this subprocess is created in BizTalk Server Mapper. The transformation maps are used to process and convert the content and structure of any source information (based on its schema representation) into any target document format, such as a report. BizTalk Server Mapper visually displays the source and destination information formats using the schema tree node model used by BizTalk Schema Editor. Information is mapped from one or more nodes in a source schema to one or more nodes in the destination schema by drawing links between the nodes. Functoids, which provide additional conversion, processing, and abstraction capabilities (looping, cumulative, date and time, iteration, and so forth), are graphically implemented by linking one or more source nodes to a functoid, and then linking the functoid to one or more destination nodes.

bizarc02.gif

Each transformation map (as well as the referenced source and target schemas) becomes a BizTalk Server project resource that is subsequently embedded into an orchestration as a process step and compiled into the orchestration assembly. Maps can be reused and modified as needed to implement any number of transformation requirements and they be deployed within any number of orchestrations. The maps created by BizTalk Server Mapper are based on XSLT, an open standards protocol for transforming XML information.

3.

Specify the business logic governing event execution.

If the business logic is simple, it can be embedded as an expression directly within a BizTalk Server orchestration decision step. If the business logic is complex, the BizTalk Server Rules Composer can be used to create and process the sophisticated rule sets. Each rule set (or “Policy”) drives a specific activity or function and becomes a resource object embedded into a BizTalk Server orchestration.

Consistent with the overall BizTalk Server architecture, transparency and loose coupling govern the creation and implementation of business rules. A rule set incorporated within a BizTalk Server orchestration can be viewed, modified, or completely replaced both at design and run time, without affecting any other process operation or interrupting running instances of the affected process. The flexibility that an exposed and componentized rule engine provides for modifying business processes is of fundamental significance. In conventional application development, business rule logic is embedded in procedural code and is not accessible for modification without changing the code itself. Because most modifications to a business process life cycle pertain to changes in business rules (as opposed to technology-related modifications), the ability to isolate business rules entirely from procedural code, or any process implementation mechanisms, dramatically improves the efficiencies of managing and adapting business processes throughout their life cycle.

BizTalk Server Rules Composer supports the creation of domain-specific vocabularies for defining business rules, and its functionality is exposed through public interfaces, making it extremely flexible and extensible. The following is an illustration of the BizTalk Server Rules Composer module.

bizarc03.gif

4.

Determine and implement requirements for message preprocessing and post-processing.

This is accomplished in the BizTalk Server Pipeline Designer module. Accessed through the BizTalk Server orchestration workspace, the Pipeline Designer module is used to implement the interchange requirements for encryption, authentication, and data format conversion with external applications and parties.

A pipeline is a sequence of processing operations that take place before a message is received by, or dispatched from a process orchestration or message data store. A “receive pipeline” accepts an incoming message, decrypts or decompresses it as required, disassembles the message into its parts, converts it into an XML document as specified in the BizTalk Server Schema, validates the message, and authenticates the identity of its sender. When a message passes through a pipeline, it is transferred to the BizTalk Server MessageBox store. A “send pipeline” performs the same operations as the “receive pipeline,” but in reverse. It assembles, formats, encrypts, compresses, and digitally signs a message as required by the external recipient.

bizarc04.gif

5.

Compose and orchestrate the application/process steps.

This takes place in BizTalk Server Orchestration Designer, the main workspace within Visual Studio .NET where an overall BizTalk Server application is developed and implemented. A process orchestration diagram is created by dragging and dropping object shapes found on the Orchestration Toolbox and linking them together. These shapes represent process activities such as receive, invoke, sequence, flow, link, and source. These shapes are used to compose and execute message flows, messaging events, business rules, activities, operations, transformations, and subprocesses.

The following figure illustrates a BizTalk Server orchestration diagram that implements the following workflow process steps:

The process application (a BizTalk Server orchestration) receives an inventory order replenishment request (“Request’).

The process application checks the quantity of items ordered. If the order contains more than 500 items, it is denied. If the order contains 500 or fewer items, it is accepted.

If the order is declined, a notification is created (“ReqDenied”) and sent to the person who placed the order.

If the order is accepted, the original order request is submitted to an ERP system for processing.

bizarc05.gif
See full-sized image

Composing the illustrated process diagram involved dragging and dropping the following shapes from the Toolbox and then modifying them:

Placed a Receive shape at the top of the design surface and named it Receive_Req.

Placed a Decision shape directly beneath the Receive Shape and named it CheckQuantity.

The Decision shape automatically creates two activity branch shapes (If or Else) The If shape is renamed Decline. The Decline shape is linked to an expression editor in which the XPATH expression “RequestInstance.Item.Quantity > 500” is created. This XPATH expression will function as the “If” rule that specifies the denial criteria for the order request.

Placed a Construct Message shape below the Decline shape and named it Construct_ReqDenied.

Placed a Transform shape within the Construct_ReqDenied shape.

Placed a Send shape below the Construct_ReqDenied shape and named it Send_ReqDenied.

Placed a Send shape below the Else shape and named it Send_REQToERP.

6.

Link the design shapes to implementation objects.

When the process steps are diagrammed, the next step involves linking the shapes to the objects required to implement the process. The objects may include the actual message documents, port locations where the messages are sent and received, and transport mechanisms required to move the messages. This linking stage is also performed in the Orchestration Designer.

In the sample orchestration diagram, when a running process receives an instance of a Request document (note the Receive shape that initiates the process), the process will validate the document’s content against its schema definition to ensure the document’s form and content conform to the schema and the application’s processing requirements. If the Request document does not conform, the Transform subprocess embedded in the Construct Message process references an XSLT transformation map that converts the Request document to a ReqDenied document, as described in the second step.

7.

Where applicable, define parties and their respective roles and link to orchestration functions.

This is accomplished in BizTalk Server Explorer, a tool that provides configuration information for the orchestrations and external components that make up a specific BizTalk Server project. Organized in a hierarchical tree structure, Explorer is used to configure the relationships and interactions of the project orchestrations to other project components such as roles, parties, send and receive ports, and receive locations.

After all the logical steps are implemented in an orchestration diagram, a Visual Studio .NET run-time assembly (DLL file) is generated from a “build” of the orchestration diagram. This assembly may be implemented as an application on its own, or included as a component of a larger BizTalk Server solution.

bizarc06.gif

A BizTalk Server solution (a process application) includes one or more Visual Studio .NET projects that contain BizTalk Server components such as schemas, orchestrations, transformation maps, and pipelines. From the example discussed earlier, the schemas for the Request and ReqDenied documents and the transformation map are combined in a discrete BizTalk Server project that builds a compiled assembly.

The BizTalk Server orchestration diagram that details the process workflow is also a discrete BizTalk Server project within the same solution. By referencing (encapsulating) the schema and map assembly, the diagram can incorporate the schemas and map as functional objects. All of the BizTalk Server project assemblies for a solution are then deployed and installed as an executable application under the management of the BizTalk Server run-time engine.

SOA—Underlying Technologies

Having discussed how an application is developed and implemented using the high-level tools within BizTalk Server 2004, we can now relate this development methodology to the underlying technologies that facilitate the Service Oriented Architecture (SOA) paradigm. As noted earlier, the fundamental principles of SOA are exposed functionality, document messaging, loose coupling, and platform independence.

XML provides the transparency and application independence and uses metatags to “declare” the meaning and function of data. The premise of XML is to convert program-dependent data into self-describing, program-independent data. This applies not only to content, but also to instructions for processing the content.

XML Schema provides semantic consistency and interoperability. XML Schema is a specification that formally defines an extensive array of data type primitives and structural components for creating XML documents; it serves as a dictionary of abstract elements, attribute entities, and organizational rules. Creating XML documents that conform to a schema “dictionary” has a significant advantage: the meaning, function and use of a document’s content is comprehensible to, and operable by, any XML-enabled application that can access the document’s underlying schema. Every industry-specific initiative to develop a common vocabulary and set of procedures for the exchange and processing of information is based on XML Schema. In fact, the XML Schema even serves as the basis for Web services protocols.

The Web services protocols, Simple Object Access Protocol (SOAP), and Web Services Definition Language (WSDL) provide the capabilities and messaging facilities required to bind and execute programmatic functionality anywhere, on any platform, without the need for custom code. The significance of the Web services specifications is that they provide the first truly workable architecture for building complex, interoperable computing processes over the Internet.

SOAP is an XML-based messaging protocol used to encode documents for transporting over a network. A “SOAP client” inserts an XML document into a SOAP envelope and posts it using HTTP (referred to as marshalling) to a “SOAP listener” that accepts the delivery. SOAP messaging has a number of benefits:

The SOAP client and listener applications are simple constructs. A SOAP client can be easily embedded as a routine in any program or Web page, and the URL endpoint can serve as the SOAP listener.

By using HTTP as its transport mechanism, a SOAP message can go anywhere, use existing SSL facilities for authentication and encryption, and make the most of the infrastructure scale of the World Wide Web.

Everything in the message, the SOAP envelope, the message header, and the body is expressed in XML, thus making the whole object entirely transparent. Because the semantics and structure of the documents are fully exposed, extensive validation, manipulation, routing, and transformation functions can be applied to the documents without writing application code to do so. Unlike CORBA, a Web services network endpoint (an HTTP, URL, or other address) can support multiple XML formats, providing a real polymorphic interface that will not break down with new versions.

Because HTTP is one of the transport mechanisms used by SOAP, a Web Service method call can be made to and from any Web-enabled computer anywhere in the world. Consequently SOAP has the potential to construct distributed computing processes on the same massive scale as the World Wide Web.

Web Services Definition Language (WSDL) is a specification for describing, communicating, and invoking programmatic functionality through a message exchange or remote procedure call—both of which use the SOAP protocol and XML encapsulated information. A WSDL document resides at a URL location and is linked to the actual program module located elsewhere. Almost any programmatic function within an orchestration, or accessed from an orchestration, can be exposed as a Web service: a database look-up, the invocation of a complex business rule, or the entire orchestration process itself. Because the public Web services interfaces are not dependent on the private implementation of the program, it is easy to construct applications that are highly modular and distributed.

Business Process Exeecution Language

The Business Process Execution Language (BPEL) is a vendor-neutral mechanism for describing the behavior of business processes. Originally created by Microsoft, IBM, and others, the latest version of this technology is currently being standardized by a larger group working through OASIS. The goal of this short paper is to explain the value of BPEL and to briefly describe how Microsoft supports BPEL in Microsoft® BizTalk® Server 2004.

The Value of BPEL

BPEL is focused on describing business processes as interactions among web services. Consider a business process spread across multiple execution environments. In this example, the process runs partially on BizTalk Server 2004 and partially on an integration server from another vendor running on Windows or some other platform. The figure below illustrates how BPEL can be used to describe the interaction between the two implementations.

As the figure shows, a BPEL definition can be used first to formalize the public interactions between the two parties participating in this business process, then to generate a baseline implementation of those interactions. Two implementations are generated in this scenario, one targeting BizTalk Server 2004 and a second targeting the other integration server. Each contains the behavior for the system’s appropriate role in the business process. BizTalk Server 2004 might execute the buying half of the process, for example, while the other integration server executes the selling half. The role of BPEL is to define the web service interactions involved in this process. The focus is on the information exchange that must take place to successfully carry out the process.

This example of a business process split between two integration servers illustrates BPEL’s primary value: facilitating interchange[1] of web services-based business processes. While BPEL doesn’t define a complete business process, it does provide a vendor-neutral way to describe interactions of the process with external web services and complementary processes implemented across multiple systems.

Along with the example just described, there are several other scenarios where BPEL can be useful. They include the following:

n        A large organization such as a retailer or manufacturer might wish to specify the process its suppliers must implement to sell to it. This kind of hub-and-spoke arrangement, common in business-to-business (B2B) interactions, can be made easier using BPEL. The large buyer at the hub might use BPEL to describe the business process that its suppliers must implement, then distribute this definition to those suppliers. The BPEL definition precisely specifies the required interactions with the hub organization, and so each supplier can use it as a starting point for implementing its side of the process.

n        An organization might wish to implement an internal business process that relies on several existing applications, but allow this process to be deployed on any of several different integration servers. To allow this kind of enterprise application integration (EAI), the organization could define the basics of the process in BPEL, then use that common definition as a starting point for implementing the process on servers from one or more vendors.

n        Libraries of best-practice business processes can be created, allowing intellectual property to be captured and reused more effectively. For organizations building a process from scratch, standard BPEL solutions like these can be a useful starting point.

n        An industry-specific standards organization could provide BPEL templates to its members to help ensure industry-wide support for agreements on how to conduct electronic business. 

Microsoft’s support for BPEL is consistent with the other web services standards efforts in which the company participates. All of these standards, including SOAP, the Web Services Description Language (WSDL), and the various WS-* specifications such as WS-Security, are focused on building a common integration fabric across vendor boundaries. None of them, including BPEL, defines an execution environment for implementing applications that use these standards. Instead, this choice is left up to each vendor. For Microsoft, of course, the execution environment is the .NET Framework.    

One way to understand BPEL’s usefulness is to view this business process language in much the same light as WSDL. WSDL is useful because it defines an abstract interface to concrete implementations, exposing only what’s necessary for these implementations to interoperate. One implementation might be built in C# on the .NET Framework, while another might be built in Java on a J2EE-based platform, yet interoperability is possible using WSDL and a standard protocol such as SOAP. Similarly, BPEL is useful because it allows an abstract definition of a business process that can be implemented using the .NET Framework, a J2EE-based platform, or something else. By specifying the web services-based interactions the process requires, BPEL effectively aggregates a business process around multiple WSDL endpoints. It makes interworking possible at the business process level rather than just the level of individual web services.

The Foundations of BPEL’s Value

The value of BPEL is based on two fundamental attributes of the technology. First, because BPEL makes no assumptions about the environment in which a business process will execute the technology is completely platform-neutral. The second fundamental attribute that makes BPEL valuable is the language’s complete focus on process-oriented abstractions. Rather than mix these higher-level concerns with the more detailed constructs found in traditional programming languages such as C# and Java, BPEL allows a clean separation between defining the business process itself and implementing the finer-grained business objects (probably written in C#, Java, or a similar language) that this process invokes.

Once these core attributes are clear, it’s obvious why BPEL does not—and should not—provide language bindings for directly invoking .NET or Java objects. Doing this would destroy BPEL’s value by eliminating both of the attributes just described: the language would no longer be platform-neutral, and it would also no longer allow a clean separation between the higher-level abstractions of process modeling and the low-level details of implementing business objects. In fact, BPEL’s creators deliberately omitted these kinds of implementation-oriented capabilities, focusing instead on coordinating service-level interactions using interchangeable XML. While a BPEL definition can specify a business process’s interactions with services and other processes, it provides only a starting point for fully implementing that process.

The truth is that the name “Business Process Execution Language” is something of a misnomer, since BPEL’s primary value lies more in the interactions it defines than in its execution capabilities. Implementations of business processes depend on capabilities that are specific to a particular execution environment. Because of this, implementing complete business processes in a truly portable way is not one of BPEL’s goals. Even if a vendor claims to provide a “BPEL execution engine”, the reality is that proprietary platform-specific extensions are necessary to support full implementation of business processes. Even process implementations created for these BPEL-based systems are not easily portable to other execution environments. 

BPEL in BizTalk Server 2004

With the release of BizTalk Server 2004, Microsoft is the first platform vendor to support BPEL in an integration server product. In this new version, customers can import a standard BPEL definition that defines the public aspects of a business process, then use the full power of the BizTalk Server 2004 execution environment built on the .NET Framework to implement and run that process. Similarly, customers can define the web service interaction aspects of their business process in the product’s Orchestration Designer, using just the features found in the BPEL specification, then export this process to standard BPEL. Microsoft adds no proprietary extensions to BPEL.  

Given its role as an interchange technology, BPEL will be far more useful when other vendors also support it. In the short run, the initial adoption of BPEL will be slow until these implementations are completed.  Yet because of its broad industry backing, other vendors will support the language in the near future. Once this occurs, BPEL is likely to play an important role in implementing business processes that span multiple execution environments.


[1] The term interchange is more appropriate than interoperability when discussing BPEL. As it’s usually used, interoperability implies a protocol, yet BPEL uses industry standard web services and does not define any new protocols. Instead, BPEL determines what gets sent across the wire by specifying the behavior of a business process, thereby defining the interchange between parts of that process.

Build Better Business Processes with Web Services in BizTalk Server 2004

he potential of the service-oriented enterprise is huge. Service-oriented architecture (SOA) will simplify the building, managing, and maintaining of distributed systems, in part because the technologies you will use to build these new systems are standards-based, thanks to the collaborative efforts of companies like IBM BEA, and Microsoft. Working together has enabled them to establish many Web services specifications, including WS-Security, WS-Addressing, and WS-Policy.

In this article I will focus on one Web services specification that is critical, yet has been largely overlooked: the Business Process Execution Language for Web Services (BPEL4WS, or BPEL).

I will describe why BPEL is important and what it offers you if you are implementing Web services today or planning to in the future. I'll also present concrete examples using BizTalk® Server 2004. I'll discuss the various advantages of BPEL throughout the article, but for a quick look at some of the most important ones, see the sidebar "Benefits of BPEL." For background on all the great benefits of SOA, take a look at Aaron Skonnard's Service Station column in the February issue of MSDN®Magazine.


From Object-Orientation to Service-Orientation

With the ability to easily integrate with and invoke Web services comes the problem of the coordination and management of messages as they are routed from service to service. As time passes, it will become increasingly unlikely that any interesting business processes will execute in a single message exchange. Traditionally, implementing business logic meant writing code (C++ or C#, for example). With BizTalk Server, however, many common requirements can be realized without coding a single line. It seems reasonable to code manually when dealing with a few services, but this becomes more problematic as the number and complexity of services increases. Enter BPEL—the first step towards abstracting the collaboration and sequencing logic out of platform-dependent code and into a formal process definition based on XML, WSDL, and XML Schema.

Successful SOA implementations require reusable logic and service autonomy. In order to achieve them, you need to start thinking of applications as the collaboration of message exchanges. Of course, when you begin exposing application functionality as services, you relinquish a certain amount of control because you no longer know how your services are being employed or even who is using them. I'll take a look at how you can come to grips with that fact later on in this article.

If I were to describe business orchestration in musical terms, the orchestra would be made up of Web services, BPEL would be the sheet music, and the composer would be the coordinator or business process manager (BPM). Designing an application architecture that fits this description using ubiquitous standards in such a way that the specifications themselves do not intrude on the process is the great challenge in Web services today. BizTalk Server is the solution to that problem. Let's look at how BizTalk Server uses Web services, BPEL, and Web Services Enhancements (WSE) as parts of a BPM solution.


The New Lingua Franca

As I mentioned, BPEL is one of a number of technologies that provides a rich Web services infrastructure. Each of the specifications (some still waiting for vendor implementations and consequently widespread adoption) addresses a different area of concern. BPEL was submitted to OASIS last year, where it is currently undergoing finalization (see www.oasis-open.org). However, you can take advantage of a growing number of major specifications right now in your orchestrations and Web services by using WSE and BizTalk Server in tandem.

BPEL gives Web services architects the kind of flexibility that the open database connectivity standard (ODBC) gave database architects. That standard enabled uniform data access regardless of the actual database used. BPEL also enables a process to be defined in one environment and executed in another. Another advantage is that it clarifies business processes and enables the designers of the business processes to define the orchestrations themselves (more on this shortly).

There are a couple of different methods by which the BPEL specification can be implemented. For example, you could run the BPEL through an interpreter the way a scripting language is executed, or you could convert or compile it into a more efficient format prior to execution.

BizTalk Server takes the second approach and realizes a number of benefits from doing so. BizTalk Server enables the import of BPEL 1.1-compliant processes and converts them to XLANG/s, the Microsoft process definition language. XLANG/s has been supported in all previous versions of BizTalk Server, thus it provides important backward compatibility. XLANG/s also provides many of the common facilities required to implement processes such as mapping, conversion, and transformation functions. Currently the BPEL standard only allows such functionality to be exposed as additional services. This can incur performance overhead without runtime optimization.

BizTalk Server goes even further than merely converting to XLANG/s by actually compiling the converted XLANG/s into .NET assemblies prior to execution, resulting in a five-fold performance improvement over the previous version of BizTalk Server.

Perhaps the main reason BPEL has received less attention than other specifications is that most vendors (including Microsoft) do not expect it to be created the same way you create WSDL or XSD—using an XML editor. Instead, tooling in BizTalk Server provides a rich graphical process editor to create orchestrations—the Orchestration Designer.

Support for interoperability in BizTalk Server enables BPEL documents to be imported and turned into orchestration (.odx) files. An orchestration can then be viewed and edited graphically in the designer and even exported back to BPEL if required. This allows companies or business units to share a business process quickly and easily, even if they run on completely different hardware and operating systems. This can make enterprises much more agile, particularly where changing a process could result in taking advantage of a brand new market opportunity.

By focusing on interoperability, BizTalk Server embraces BPEL without being constrained by it. Consider, for example, that the major processing requirement in messaging systems is transformation—the conversion from one format or structure to another. BPEL can't do this in the standard, but BizTalk Server can.

To give you an idea of what's going on behind the scenes, take a look at the code in Figure 1. It's important to bear in mind that BPEL is a substrate that binds pre-existing Web services together and is not intended to be used to implement the services themselves. This is one of the reasons that the feature set in BPEL is constrained to simple expressions and constructs. BPEL allows you to form new Web services through recombination and enables the assembly of complex business processes.


A BPEL definition generally requires two other document types, WSDL and XML schema, and BizTalk Server orchestrations are no exception to this. Figure 2 shows the relationship between them. BPEL extends WSDL to both provide and consume Web services in an abstract way. This enables one of the great strengths of WSDL, namely the ability to separate the abstract message and port information required at composition time from the physical binding and address details required at invocation time. The WSDL and XSD for this example are given in Figure 3 and Figure 4.

A cursory examination of the BPEL vocabulary in Figure 1 reveals many familiar concepts such as scoped variables and type-compatible assignments. BPEL also provides logical constructs such as conditionals, loops, and parallel processing. The BPEL in Figure 1 needs little explanation. The basic constructs are termed activities in BPEL, the full list for which is provided in Figure 5. Because of the flexibility an XML-based representation provides, activities can be combined and nested in interesting ways. This process is particularly suited to a graphical design environment.

Many BPEL features relate to timing and synchronization. The loosely coupled, highly latent world of Web services requires a much more casual attitude to sequence and time than do regular applications. To see what I mean, think about how an orchestration runs. Waiting for a message is a passive activity and something in the orchestration will almost certainly have to wait for the appropriate message to appear. BizTalk Server deals with messages by implementing subscriptions. An orchestration can subscribe to a particular message type, and all messages received go into a persistent store called the message box, implemented using SQL Server. The message box is examined and the subscribed orchestrations are executed by the runtime. This results in orchestration instances being created, each running with its own state. This is important for reasons I'll discuss shortly.

The next activity I want to discuss is the invoke activity. It enables an orchestration to call a Web service to help fulfill the implementation of the process. This functionality is present in BizTalk Server with the Send and Receive shapes. In the example in Figure 1, I am simply invoking a Web service that will add two numbers and return the sum. The expected WSDL definitions are referenced to provide the necessary binding and context. This case is a little contrived, but it does illustrate the ability to decouple externally exposed services from changes to internally defined services.

For example, this internal service could be replaced with another one or the schema changed to alter the message structure without affecting the caller in any way. Such encapsulation is important in order to achieve reuse of existing services as components of a larger orchestration. A public Web service for a bank that enables the transfer of funds between accounts will consist of internal invocation and collaboration of a number of different systems internally. Exposing these internal systems APIs to the outside world often leads to brittleness and can be highly insecure.

Instead, an orchestration can be used to provide a facade to bridge the outside world and your internal systems in a loosely coupled way. This is a common requirement in enterprise application integration (EAI) scenarios and typically employs content-based routing. Bear in mind that orchestrations in BizTalk Server do not have to be exposed as Web services. They can be run by a variety of means using different configurations. An orchestration's trigger may be an XML document dropped via FTP into a watched file system folder, for example.

It should be apparent by now that a messaging system has a large number of requirements that are not directly related to the execution of any one particular service. Because these requirements cut across all services, they are driving the creation of BPM software infrastructure. BizTalk Server is both a BPM and integration product. It consists of around 1.8 million lines of managed code. This gives a good indication of the size of a BPM application—you don't want to start writing one yourself.

If you're going to build business processes using existing services, you need to have those services in place first. But that's not the reality for most companies today, so it's critical to make your services generic and reusable, rather than services targeted to a particular consumer. Adopting an interface-first design approach makes this much easier to achieve.

The visibility of the actual running business processes represents a huge step forward and with BizTalk Server you can create a new process by linking together available "shapes" in the graphical editor. These shapes map naturally to BPEL activities already described and allow a process to be modeled by dragging and dropping these activities onto the designer surface. Developers can do this using Visual Studio® .NET 2003, and business analysts can use Visio® to design orchestrations. As you can see in Figure 6, the receive shape (labeled ReceiveMessage) is synonymous with the BPEL Receive activity. Similarly, the send shape (labeled ReplyMessage) maps to the Reply activity in BPEL. The goal is that each type of user has the best tools for their own familiar environment yet they share the same artifacts.

Figure 6 Orchestration in BizTalk Server 2004
Figure 6 Orchestration in BizTalk Server 2004

Now let's consider a more complex scenario. One of the assumptions made explicit with distributed service-based systems is that they will occasionally fail. By their nature, timeouts can occur due to network latency or the endpoint being unavailable, for example. Messages may not be delivered, may be delivered multiple times, or may be delivered in an unexpected order. These characteristics make transactions problematic as the traditional approach of using atomicity to guarantee consistency and isolation through a two-phase commit scheme (such as that provided by the Microsoft Distributed Transaction Coordinator, or MS DTC) cannot be employed. With the WS-Transaction specification there will be a comparable solution, but even then there are many cases when transactions spanning organizational boundaries are not appropriate. A different approach taken in BPEL is based on the notion of compensation.

Compensation enables long-running transactions (LRTs) to be managed so that if failure occurs, a defined compensatory action will be invoked. One example is an airline reservation system. In booking a ticket, you may have to provide payment before your seat on the flight can be confirmed. This process could take several seconds. If the seat cannot be confirmed, the payment must be refunded so that it appears that the transaction never took place. LRTs are the mechanism by which Web services can achieve this state. Because of this, the term LRT is somewhat of a misnomer as it isn't really a transaction at all. Each action and compensatory action taken is distinct from the others. BizTalk Server implements this scheme and logically ties this unrelated activity coordination together to manage it and attempt to prevent inconsistencies. Note, though, that this is not a fail-safe mechanism because it does not preclude the possibility that inconsistencies could occur. It is also important to realize that this is not a failing of BizTalk Server itself; rather it is due to the pragmatic approach taken in dealing with failures within a loosely coupled distributed system.

Another problem Web services introduce is the lack of shared knowledge or state. This should be viewed as a strength because it reduces any dependency or unnecessary knowledge by one component of another. It does, however, require a different approach to solving a perennial problem. For example, an LRT may consist of a fire-and-forget style of asynchronous message being sent. It may be expected, though, that at some point in the future the service to which the message was directed will respond in a callback-style pattern or "solicit-response." When this occurs, the original orchestration must correlate the inbound message with the original outbound one. BPEL provides support for this with correlation sets. Correlation sets in BizTalk Server are based on the notion of specific process instances, as I mentioned earlier.

You must mark an orchestration in BizTalk Server as able to be activated in order to indicate that it can be the start of a new process instantiation. From that point on, if an activity is executed that causes the orchestration to suspend execution, it can be resumed later when the callback comes in. BizTalk Server supports this BPEL feature by allowing the receipt of a message and correlating it back to the original in-flight suspended orchestration instance. As the callback message is likely to differ from the original one that initiated the orchestration, BizTalk Server also provides the facility to alias correlation information. This allows unique data items to be identified across different message types in order for the BizTalk Server engine to associate them. This is achieved through property promotion, that is, the process of annotating the schema type being used with the relationships between different elements or complex types with the same meaning.

For example, a customer ID may be present in all messages but is unique to a particular customer. Because of this uniqueness property, it can be used to correlate different messages to a single orchestration instance even though in one message type it may be called CustID while in another message type, it may refer to the same entity called Customer.

BPEL contains other examples of synchronization activities all supported in BizTalk Server. One of the more interesting is the pick activity, which BizTalk Server provides via the Listen shape (see Figure 5). This activity allows the selection of a logic path based on the message type received. An orchestration that can receive one of several different messages can use this activity to wait until the first message is received and continue down a particular path based on its type. This is useful when you are dealing with a number of partners using different message structures but the semantics of the actual business process being created are the same for each.


Boundaries

As I've said, BPEL should be viewed purely as an orchestration language, and this is where the interoperability benefits lie. Because of this, BPEL imposes some restrictions on the expressions allowed in conditional activities and assignments. In order to discourage its use in implementing the actual business logic of a service the specification actually mandates that only simple expressions are allowed. This is because its stated purpose is to control the execution of the business logic components, namely the Web services.

Consequently, a BPEL orchestration cannot accomplish much by itself. A BPEL orchestration cannot actually implement a business process. Instead, it acts as a coordinator by passing messages from system to system, employing other services along the way. The orchestration only knows how to call, consume, and manage the calling of the other Web services and nothing more. BPEL is also just a specification, not a product.

For it to be useful, it has to exist as an implementation on a specific platform and that means implementation-specific code will be written to integrate with and extend it. This is likely to change as the specification process continues on to recommendation status, with the possibility that concessions will be made to provide for some of the common requirements in a standard, interoperable way. These current limitations make it possible to define orchestrations in BizTalk Server that cannot be expressed in BPEL. Although this is unavoidable, the extensibility BPEL allows will likely lead to greater improvements in this area over the next few years, and in particular, will lead to greater interoperability.

In arrivo BizTalk Server 2006

 

E' il primo maggio la data fissata da Microsoft per il rilascio di BizTalk Server 2006, la prima major release dal marzo 2004 della piattaforma di BPM (Business Process Management) che punta a facilitare le operazioni di integrazione in modo tale che gli utenti possano effettivamente focalizzarsi sulla gestione dei processi di business. Steven Martin, director of product management per BizTalk, ha spiegato a questo proposito che: “Rendere estremamente semplice l'integrazione di basso livello ha consentito ai clienti di passare più tempo a parlare dei processi di business end-to-end... Ora la maggioranza dei clienti che licenziano il prodotto lo stanno utilizzando per indirizzare le problematiche di gestione dei processi di business, che abbracciano applicazioni o processi totalmente nuovi, erogati attraverso applicazioni composite”. BizTalk Server 2006 supporterà SQL Server 2005, Visual Studio 2005 e Virtual Server 2005, e sarà disponibile in una versione a 64 bit.

Per gli amministratori, ha continuato Martin, BizTalk 2006 include una nuova console di gestione unificata progettata per fornire una vista su un processo di business in una singola finestra. Lato sviluppatori, il nuovo rilascio include invece uno strumento per consentire l'aggregazione di parti di un processo in modo tale da poterlo mettere in produzione come singola applicazione. Gli utenti, infine, avranno la possibilità di monitorare l'attività di business con la realizzazione di un portale per misurare le prestazioni dei processi rispetto a indicatori predefiniti.

Nel pacchetto Microsoft ha inoltre deciso di includere 12 adattatori (tra i quali quelli per le applicazioni J.D. Edwards, Oracle e PeopleSoft) come parte del costo di licenza base anziché richiedere agli utenti di comprarli a parte.

Connecting to the Elemica Network with BizTalk Accelerator for RosettaNet 3.0

To customize BTARN to connect to Elemica, you must follow these steps:

  • Install BTARN Hotfixes

  • Edit the process configuration

  • Edit agreements

  • Download project files

  • Update Microsoft.Solutions.BTARN.RNIFReceive.dll

  • Update Microsoft.Solutions.BTARN.RNIFSend.dll and set the BTARN configuration for client certificates

The changes to Microsoft.Solutions.BTARN.RNIFReceive.dll and Microsoft.Solutions.BTARN.RNIFSend.dll have been made in the RNIFReceive.csproj and RNIFSend.csproj project files that are part of the WebApplication.zip. You can download these projects from http://go.microsoft.com/fwlink/?LinkId=46195. Use these projects as is instead of creating them from scratch.

This document describes the above steps in detail.

Install BTARN Hotfixes

To connect to Elemica, you must install the BTARN Hotfixes listed in Table 1.

Note: These Hotfixes provide support for the RNIF 1.1 schemas, mainly the enumerations, required by Elemica Marketplace.

Table 1 Installing BTARN Hotfixes

Hotfix Number Fix URL

Q889523

FIX: The BizTalk Accelerator for RosettaNet 3.0 does not successfully process RosettaNet Implementation Framework (RNIF) 1.1 acknowledgement messages

http://support.microsoft.com/default.aspx?scid=kb;en-us;889523

Q891072

The BizTalk Accelerator for RosettaNet 3.0 object identifier for MD5 is not correct for the RNIF 1.1 implementation

http://support.microsoft.com/default.aspx?scid=kb;en-us;891072

Q890928

FIX: The BizTalk Accelerator for RosettaNet 3.0 incorrectly uses the local time instead of UTC time in the DateTimeStamp fields of RosettaNet messages

http://support.microsoft.com/default.aspx?scid=kb;en-us;890928

Q890071

FIX: You may receive a validation error message when the BizTalk Server Accelerator for RosettaNet 3.0 processes a signal that contains a value for the GlobalPartnerClassificationCode element that is outside the predefined enumerations

http://support.microsoft.com/default.aspx?scid=kb;en-us;890071

Q896496

Fix for the Preamble namespace for RNIF 1.1

http://support.microsoft.com/default.aspx?scid=kb;en-us;896496

Edit the Process Configuration

In the Process Configuration used for connecting with Elemica, set the standard to CIDX, as shown in Figure 1.

Note: For more information about setting the standard in a Process Configuration, see "How to Create or Edit a Process Configuration" in Microsoft BizTalk Accelerator for RosettaNet 3.0 Help.

Figure 1 Setting the Standard to CIDX

Edit Agreements

For every agreement, add a custom property "AAR" (IsAcceptanceAckRequired), and set its value to False, as shown in Figure 2.

Note: You must add an IsAcceptanceAckRequired custom property because Elemica requires only Receipt Acknowledgement, not Acceptance Acknowledgement.

Note: For more information about adding a custom property to an agreement, see "Creating or Editing an Agreement" in Microsoft BizTalk Accelerator for RosettaNet 3.0 Help.

Figure 2 Adding a Custom Property IsAcceptanceAckRequired

Download the Project Files

To connect to Elemica, you must edit the Microsoft.Solutions.BTARN.RNIFReceive.dll and Microsoft.Solutions.BTARN.RNIFSend.dll files as described in the following topics. These changes have been made in the RNIFReceive.csproj and RNIFSend.csproj project files that are part of the WebApplication.zip file. You can download these project files from http://go.microsoft.com/fwlink/?LinkId=46195. Use these projects as is instead of creating them from scratch.

The RNIFReceive project files include the following:

  • AssemblyInfo.cs

  • RNIFReceive.aspx

  • RNIFReceive.aspx.cs

  • RNIFReceive.aspx.resx

  • RNIFReceive.csproj

  • RNIFReceive.csproj.webinfo

  • StringResources.resx

  • Web.config

The RNIFSend project files include the following:

  • AssemblyInfo.cs

  • RNIFSend.aspx

  • RNIFSend.aspx.resx

  • RNIFSend.csproj

  • RNIFSend.csproj.webinfo

  • StringResources.resx

  • Web.config

Update Microsoft.Solutions.BTARN.RNIFReceive.dll

To connect to Elemica, you must change the return HTTP status setting in Microsoft.Solutions.BTARN.RNIFReceive.dll file. These changes have been made in the RNIFReceive project files that you can download as part of the Elemica Connectivity Pack from http://go.microsoft.com/fwlink/?LinkId=46195.

The original RNIFReceive project is in the BTARN SDK folder under the WebApplication folder. The changes from the original RNIFReceive project are the following:

  • Added a new application setting in the Web.config file (Elemica) that can be set to True or False.

  • Added logic to the RNIFReceive.aspx.cs file to return status 200 if the application setting is set to True.

To compile and use the new RNIFReceive project, continue as follows:

  1. Copy the RNIFReceive project to a local folder on the computer.

  2. Click Start, point to All Programs, point to Microsoft Visual Studio .NET 2003, point to Visual Studio .NET Tools, and then click Visual Studio .NET 2003 Command Prompt.

  3. At the command prompt, move to the folder where that you pasted the project to.

  4. At the command prompt, type "sn -k Signing.snk" to create a key pair needed to compile the project, and then press Enter.

  5. Start Internet Information Services (IIS) Manager.

  6. Create a new application pool and set its identity to Network Services.

  7. Create a new virtual directory running under the newly created application pool. The virtual directory should point to the folder where you pasted the RNIFReceive project.

  8. Change the settings on the new virtual directory to Enable anonymous access and make sure that Integrated Windows Authentication is not selected.

  9. Open the RNIFReceive.csproj project in Visual Studio .NET. Add a reference to the assembly Microsoft.Solutions.BTARN.Shared.dll found under <drive>:\Program Files\Microsoft BizTalk Accelerator for RosettaNet 3.0\Bin, and set the assembly key file for the project to Signing.snk.

  10. Build and compile the project in Visual Studio .NET. Visual Studio will generate a new Microsoft.Solutions.BTARN.RNIFReceive.dll file under the folder Bin.

  11. To enable connectivity to Elemica, edit the Web.config file to uncomment the following line:

    <!-- <add key="Elemica" value="true" /> -->
  12. Restart IIS.

Enable Client Certificate Authentication in BTARN

To connect to the Elemica network, you must create public and private client certificates and import them into BTARN 3.0. For more information about certificates in BTARN 3.0, see "Managing Certificates" and "Step 2: Creating Public and Private Certificates", in the "Preparing for the Double-Action Tutorial" node,in Microsoft BizTalk Accelerator for RosettaNet 3.0 Help.

Update the Microsoft.Solutions.BTARN.RNIFSend.dll and Set the BTARN Configuration for Client Certificates

To connect to Elemica, you must update the Microsoft.Solutions.BTARN.RNIFSend.dll file to support client certificates and set the configuration for client certificates as described in this topic. These changes have been made in the RNIFSend project files that you can download as part of the Elemica Connectivity Pack from http://go.microsoft.com/fwlink/?LinkId=46195.

The original RNIFSend project is in the BTARN SDK folder under the WebApplication folder. The changes from the original RNIFSend project are the following:

  • A new application setting in the Web.config file (CertificateFile) that you can set to point to a DER encoded binary X.509 certificate

  • A change to the Web.config file to allow for Windows Authentication, which enables the RNIFSend.aspx page to load a client certificate from a personal certificate store

  • A reference to the assembly System.Security.Cryptography.X509Certificates has been added

  • A new method LoadCertificate that loads the certificate specified in the Web.config file has been invoked within the method CreateOuterHttpRequest

To compile and use the new RNIFSend project, continue as follows:

  1. Copy the RNIFSend project to a local folder on the computer.

  2. Click Start, point to All Programs, point to Microsoft Visual Studio .NET 2003, point to Visual Studio .NET Tools, and then click Visual Studio .NET 2003 Command Prompt.

  3. At the command prompt, move to the folder that you pasted the project to.

  4. At the command prompt, type "sn -k Signing.snk" to create a key pair needed to compile the project, and then press Enter.

    Note: You can also use the same key pair generated in "Update Microsoft.Solutions.BTARN.RNIFReceive.dll".

  5. Start Internet Information Services (IIS) Manager.

  6. Create a new application pool and set its identity to a new local user, for example, HttpHostSvc.

  7. Add the user HttpHostSvc to the local groups IIS_WPG and STS_WPG.

  8. Create a new virtual directory running under the newly created application pool. The virtual directory should point to the folder where you pasted the RNIFSend project.

  9. Change the settings on the new virtual directory to Enable anonymous access, and make sure that Integrated Windows Authentication is not selected.

  10. Open the RNIFSend.csproj project in Visual Studio .NET. Add a reference to the assembly Microsoft.Solutions.BTARN.Shared.dll found under <drive>:\Program Files\Microsoft BizTalk Accelerator for RosettaNet 3.0\Bin, and set the assembly key file for the project to Signing.snk.

  11. Build and compile the project in Visual Studio .NET. Visual Studio will generate a new Microsoft.Solutions.BTARN.RNIFSend.dll file under the folder Bin.

  12. To enable connectivity using a client certificate, edit the Web.config file to uncomment the following line:

    <!-- <add key="CertificateFile" value="C:\Documents and Settings\HttpHostSvc\Application Data\Microsoft\BizTalk Accelerator for RosettaNet 3.0\ClientCertificate.der" /> -->
  13. Log out from the computer and log back in as the user HttpHostUser. Run the Certificates MMC. Import the client certificate to the "Personal" certificate store.

    Important: Make sure that you have imported the private key. You can verify this by looking at the properties of the certificate in the personal store. You should see a small icon of a key in the lower left part of the Properties dialog box.

  14. Export the certificate to a "DER encoded binary X.509 (.CER)" file. Make sure not to export the private key. Save the .der file as <drive>:\Documents and Settings\HttpHostUser\Application Data\Microsoft\BizTalk Accelerator for RosettaNet 3.0\ClientCertificate.der.

    Note: The path in the code above presumes the user is HttpHostUser.

    Note: When the ASPX page loads, it will assume the security context of HttpHostUser.

  15. On your BizTalk server, edit the value of the following registry key to point to the URL of the new ASPX page in the new virtual directory:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\BizTalk Accelerator for RosettaNet 3.0\Configuration\RNIFSenderURI

    Note: Now when you send a transaction, RNIFSend.aspx will use the client certificate to connect to the destination URL. Make sure that you use the client certificate only with partners who require it. You may still have to edit the .aspx.cs file to accomplish this.

    Note: The new URL, in the registry, will only be applied to new partners that are created. If you have partners that have already been created, you may have to edit the URLs in their corresponding HTTP send ports in BizTalk Explorer. These send ports have the following format: <PARTNER NAME>.Async and <PARTNER NAME>.Sync.

    Note: In case you have to connect to only a few specific partners using a client certificate, you do not have to edit the registry key. Instead, you have to edit the corresponding ports in BizTalk Explorer to point to the URL hosting the updated Microsoft.Solutions.BTARN.RNIFSend.dll file. The connection to the other partners will use the default .dll file in the default BTARNApp virtual directory.

  16. Restart IIS.

Implemeting Service Contract with Biztalk 2004

Microsoft BizTalk Server 2004 offers development tools for designing and implementing business processes as orchestrations. Once you've implemented a BizTalk orchestration, you can publish the orchestration as a Web service through the built-in Web Services Publishing Wizard. The wizard generates an ASP.NET Web services (ASMX) endpoint based on the schema types used in the orchestration. Then consumers can query the generated ASMX endpoint to retrieve the Web Services Description Language (WSDL) definition representing the orchestration's service contract. Once the WSDL contract is accessible, any Web services-enabled consumer can integrate with the orchestration.

This general development process assumes that the service contract is typically an orchestration byproduct defined by the BizTalk Server developer. The reverse scenario, however, is also important—where a pre-existing service contract (in the form of a WSDL definition) must be implemented and adhered to by a new BizTalk orchestration. This article discusses some of the issues surrounding BizTalk Server's support for Web services, while providing helpful guidance and some practical techniques for implementing existing WSDL contracts in your BizTalk orchestrations.

BizTalk Server Messaging Basics

BizTalk Server, at its core, processes XML messages. In order to process XML, however, BizTalk Server must know about the message's structure and types. Developers provide this information to BizTalk Server in the form of XML Schema (XSD) definitions. Developers also model how these XSD types flow through BizTalk orchestrations using logical ports. Developers bind the logical ports to physical ports, which specify concrete transport details and locations. The information provided by the logical and physical ports together defines the external contract of a BizTalk Server system. What happens behind the port boundary is completely hidden from you (see Figure 1). As you can see, the BizTalk Sever development approach is very service-oriented and contract-driven by nature.

The information in an orchestration's logical ports is informative not only to external users, but also to BizTalk Server internally. The logical port information drives the way BizTalk Server's publish and subscribe architecture routes messages. When you enlist an orchestration, the logical port information is used to create BizTalk MessageBox subscriptions for the particular XSD type. When you publish messages to the MessageBox at run time, BizTalk Server uses the subscription information to route messages to the target orchestrations. Applications that wish to interact with a given orchestration only need to know about the XML types it uses along with where and how to send them.

Figure 1 BizTalk Server messages, ports, and orchestrations

Service Contracts and Collaboration

When building service-oriented systems in general, the only artifact shared among parties is the service contract. Today service contracts are expressed and shared using WSDL—a language virtually all platforms and frameworks support. When numerous parties work together on large service-oriented systems, they often collaborate on the shared service contracts. This allows both consumers and implementers to provide valuable input during contract design, well before the implementation begins. Doing so increases interoperability success by bringing more expertise to the table (especially regarding local implementation environments) during the early design stages. Such shared contracts are not always controlled by a single party, but perhaps by a team or central body of sorts.

This type of collaboration is common in large organizations where developers from multiple departments participate in defining the service contracts surrounding business process integration scenarios. It's also common in business partner scenarios where business agreements and contracts are established well in advance, before any implementation, and then simultaneous development ensues against the predefined service contracts. It's even common in some industry verticals where contracts might be promoted or controlled by official standard bodies or consortiums (e.g., HL7 in the healthcare sector). Many of these scenarios are common for BizTalk Server developers.

If you find yourself in any of these scenarios, you'll need to implement an existing WSDL contract in your service implementations. How you accomplish this depends on the framework you're using to implement the services. The most commonly used frameworks among .NET developers are ASP.NET Web services (ASMX) or Web Services Enhancements (WSE) 2.0—these are a good fit for implementing fine-grained services that don't require much in the way of state management or long-running transactions. BizTalk Server is emerging as the preferred framework for implementing coarse-grained business services that typically deal with these more complex issues. The techniques to implement existing service contracts differ greatly across these different frameworks. Implementing existing contracts using BizTalk Server requires developers to understand the mapping between orchestrations and Web services along with the available tool support.

Mapping Orchestrations to Services

When you compare the characteristics of BizTalk orchestrations relative to today's Web services stack, you'll notice many similarities. For example, both orchestrations and WSDL definitions reference XSD types to define the messages that flow in and out of their systems. Both define the concept of a port type, a logical interface that defines groups of operations consisting of message exchanges. Both rely on "bindings" to specify the transport and protocol information used to communicate over a particular port type. Table 1 highlights the mapping between these central concepts.

Table 1 Comparing WSDL definitions to BizTalk orchestrations

Name WSDL Orchestration

Types

WSDL documents import XSD types in order to define the messages that will in turn define the service inputs and outputs.

BizTalk orchestrations reference XSD types in order to define the input and output messages bound to send/receive ports.

Messages

WSDL message elements define the particular elements from the imported XSD that will flow in and out of the service.

BizTalk Server message variables specify exactly which public element from the referenced XSD will be used by the send/receive ports.

PortTypes

WSDL portType elements define groups of logical operations, which consist of input and output messages—effectively an interface definition.

BizTalk PortTypes define groups of logical operations, which consist of input and output messages—effectively an interface definition.

Bindings

WSDL binding elements define additional transport and protocol details relative to a portType.

BizTalk orchestrations are "bound" to physical ports, which the BizTalk Server messaging engine renders using adapters (to encapsulate communication transports) and enhances the messages through the ports using pipeline components.

Services

WSDL service elements define ports. WSDL ports define the physical endpoints (addresses) used to communicate with the service. Each port is associated with a portType/binding.

BizTalk orchestrations define ports. BizTalk Server ports define the logical and physical I/O mechanisms of an orchestration, Each logical port is associated a portType and is later bound.

Table 1 illustrates a direct correlation between the information conveyed by BizTalk orchestrations and WSDL definitions. Therefore, it's logical to assume an automatic mapping between the two worlds is possible, in either direction. In other words, it should be possible to publish an orchestration as a Web service endpoint using WSDL, and it should be possible to automatically generate an orchestration skeleton starting from an existing WSDL definition. BizTalk Server automates these mappings through a variety of different tools.

BizTalk Server provides the Web Services Publishing Wizard (along with a WSE-specific version) to automatically publish orchestrations as Web service endpoints described by WSDL. The publishing wizard also provides an option for publishing schemas as Web service endpoints, which doesn't require an orchestration as a starting point. This option requires you to provide more information about the service contract but also gives you more flexibility in terms of how BizTalk Server uses the service endpoint. In general, the publishing wizard assumes you're starting with BizTalk Server artifacts and publishing them as services.

The publishing wizard does not support the reverse direction, where you need to generate an orchestration from an existing WSDL definition. This is where BizTalk Server's BPEL Import Wizard comes into play. When provided a full Business Process Execution Language (BPEL) definition, the BPEL importer can generate a complete orchestration. However, you can also generate a skeleton orchestration from a WSDL starting point, providing you with the BizTalk Server representation of the service contract needed to get started. However, the BPEL Import Wizard doesn't provide the Web services layer needed to interact with the generated orchestration. Hence, to complete the implementation, you must still figure out a way to produce the orchestration's Web service front end that also conforms to the existing WSDL contract.

These tools make BizTalk Server a compelling framework for implementing Web services, unbeknownst to many developers. Let's discuss how each of these tools work before walking through how to implement existing service contracts using BizTalk Server.

BizTalk Server Web Services Publishing Wizard

The publishing wizard comes with two main options (see Figure 2):

  1. Publish BizTalk orchestrations as Web services.

  2. Publish schemas as Web services.

Both options produce ASMX code that integrates with BizTalk Server.

Figure 2 Web Services Publishing Wizard

When you choose the first option, the wizard prompts you to select the BizTalk assembly containing the desired orchestration. Then you select the public ports you'd like to publish, along with some other Web service details (such as the WSDL target namespace, header processing, etc.), and the wizard subsequently generates the necessary ASMX code needed to integrate with the orchestration. The wizard also generates and configures the Internet Information Services (IIS) virtual directory needed to host the ASMX endpoint, along with the BizTalk Server receive locations if those options are specified.

The generated ASMX code contains a WebMethod for each operation in the selected BizTalk Server port, along with the supporting .NET class definitions that model the various XSD types used by the operations. Once published, you can query the ASMX endpoint using the "?wsdl" convention to retrieve the WSDL definition. The WSDL is generated from the ASMX code, which was itself generated from the original BizTalk Server port type details. At this point, you don't have much control over the WSDL contract – everything is simply derived from the orchestration details.

However, the wizard also has the "Publish schemas as Web services" option, which gives you more flexibility. This option requires you to build the WSDL definition manually using the provided builder (e.g., adding/naming services, operations, etc.). The WSDL builder then asks you to map the WSDL operations to your BizTalk Server schemas (see Figure 3). The wizard generates an ASMX endpoint based on the specified details, along with the supporting .NET class definitions that model the selected XSD types. Although this option offers greater WSDL flexibility, the tradeoff is pretty obvious—you have to build the entire definition by hand.

Figure 3 Publish schemas as Web services

The generated ASMX code performs the same task regardless of which option you use. The code simply processes the SOAP envelope and dispatches the payload (what's in <soap:Body>) to the BizTalk MessageBox. When using an orchestration, one of its logical ports must be bound to the SOAP adapter, specifying the address of the ASMX endpoint. This produces the necessary subscriptions for routing incoming messages to the orchestration.

In the case of "publish schemas," however, you again have more flexibility. You could simply use the generated ASMX to provide a public gateway to the BizTalk MessageBox and rely on subscriptions along with maps and adapters to pick up the messages, perform translation, and move the information around your network without ever using orchestrations. Alternatively, you could manually define orchestrations that subscribe to the incoming messages—it's your choice.

Although this tool provides a productive solution, the use of ASMX in this case comes with an issue worth mentioning. When the ASMX infrastructure receives a SOAP message, it must first translate the SOAP message into a .NET object graph in order to invoke the WebMethod. The WebMethod then takes the object graph and using a custom proxy object, passes the object to BizTalk Server. BizTalk Server, however, is expecting to receive an XML document. Hence, the custom proxy object must translate the object graph back into XML before presenting it to BizTalk Server. The translation occurring here can become troublesome in some situations due to the well-documented mismatch between the XSD and .NET type systems.

The fact is that clients send XML and BizTalk Server consumes XML. The ASMX translation can introduce overhead and risk in this scenario but it is also possible for you to automatically retrieve WSDL definitions from the strongly-typed signatures (using service.asmx?wsdl), which is the most likely reason for doing things this way. When you're implementing existing service contracts, this is the main area that can cause problems (more on this shortly).

BizTalk Server WSE Web Services Publishing Wizard

The BizTalk Server Adapter for WSE 2.0 also provides a publishing wizard that generates WSE 2.0 code instead of ASMX. The same two options exist for publishing orchestrations or schemas as Web services—the main difference here is that you can also specify policy information to configure security (see Figure 4).

What's interesting about the wizard-generated WSE code is that it no longer uses the ASMX programming model. Instead, the WSE 2.0 messaging API is used through a new SoapService-derived class named Microsoft.BizTalk.Adapter.WseReceiver.WseReceiver. It generates a new class that derives from WseReceiver and adds a [SoapMethod] attributed method for each operation. The generated method signatures are defined in terms of SoapEnvelopes, which means .NET object serialization no longer occurs at run time. Now the WSE infrastructure performs all policy/security processing on the raw SoapEnvelope and the generated proxy code simply dispatches the envelope body directly to BizTalk Server.

The generated class is bound to an .ashx endpoint, which you can browse to retrieve the WSDL definition. You might wonder how it could possibly generate WSDL if the signatures are defined in terms of SoapEnvelope. Additional method attributes convey the input/output type information, used solely for WSDL-generation purposes. This solution gives you the best of both worlds.

Both publishing wizards are suitable when you're defining new service contracts and aren't concerned with conforming to an existing WSDL definition. Each provides equivalent functionality to code-first ASMX, where you start by authoring WebMethods and let the infrastructure generate the contract, only here the orchestration is the "code" and the wizard generates the contract. If you're looking for the "wsdl.exe /server" equivalent, you need to use the BPEL import wizard.

Figure 4 BizTalk Server WSE Web Services Publishing Wizard

BizTalk Server BPEL Import Wizard

The BizTalk Server BPEL Import Wizard provides tool support for contract-driven orchestration development today. You access this wizard when creating new BizTalk Server projects in Microsoft Visual Studio .NET. There is a BizTalk Server project template named BizTalk Server BPEL Import Project (see Figure 5). When you select this template, Visual Studio .NET launches the BPEL Import Wizard that walks you through specifying the contracts to generate the new orchestration.

You can specify complete BPEL definitions describing an entire orchestration or just WSDL and schema definitions for generating the orchestration's port types. Although the full-BPEL approach is quite compelling, it's not the most common scenario today. The scenario focused on here is how to handle dealing with a stand-alone WSDL definition that you've been given to implement.

A typical WSDL definition contains two main types of information:

  1. The abstract interface (type, message, portType)

  2. The concrete binding details (binding, service)

A Web service that dispatches to BizTalk Server is concerned with both types of information. Orchestrations, on the other hand, aren't concerned with concrete binding information – they're defined in abstract terms via logical ports. This is important to understand when looking at the BPEL Import Wizard because it only generates the orchestration, not the Web service layer.

Figure 5 BizTalk Server BPEL import project

Let's walk through an example while discussing how this process works. We'll assume that we have an existing WSDL definition that defines a single operation named Multiply. The WSDL definition imports two external schema files: DocIn.xsd and DocOut.xsd. DocIn.xsd defines an element named DocIn, which contains two input elements, Param1 and Param2, as illustrated here:

<xs:schema 
xmlns="http://example.org/docin" 
elementFormDefault="qualified" 
targetNamespace="http://example.org/docin" 
xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="DocIn">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Param1" type="xs:int" />
        <xs:element name="Param2" type="xs:int" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

DocOut.xsd contains an element named DocOut, which contains a Result element to hold the result of the Multiply operation:

<xs:schema 
  xmlns="http://example.org/docout" 
  elementFormDefault="qualified" 
  targetNamespace="http://example.org/docout" 
  xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="DocOut">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Result" type="xs:long" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Both of these schema files are imported and used by the WSDL definition. They are referenced by the WSDL messages, which are in turn referenced by the operation:

<definitions ... 
  xmlns:s0="http://example.org/docin" 
  xmlns:s1="http://example.org/docout"
  xmlns:s2="http://example.org/mathservices" 
  targetNamespace="http://example.org/mathservices"
  xmlns="http://schemas.xmlsoap.org/wsdl/"
  >
  <import namespace="http://example.org/docin" 
    location="DocIn.xsd" />
  <import namespace="http://example.org/docout" 
    location="DocOut.xsd" />
  <message name="InputMessage">
    <part name="parameters" element="s0:DocIn" />
  </message>
  <message name="OutputMessage">
    <part name="parameters" element="s1:DocOut" />
  </message>
  <portType name="MathService">
    <operation name="Multiply">
      <input message="s2:InputMessage" />
      <output message="s2:OutputMessage" />
    </operation>
  </portType>
...

The rest of this WSDL file goes on to bind the portType to SOAP over HTTP using the document/literal style. However, as far as the orchestration is concerned, the important information is shown above. The types, messages, and portTypes are the constructs that generate the new BizTalk orchestration. In fact, the current BPEL Import Wizard is only capable of dealing with these constructs, which means you have to extract the binding/service elements from the WSDL definition before using it with the BPEL Import Wizard.

Once you have the WSDL definition ready to import, run the BPEL Import Wizard and specify it when prompted to "Select BPEL, WSDL, and XSD Files" to import (see Figure 6). Even though the WSDL file imports the XSD files, you must specify the required XSD files as well. Once you've finished, complete the wizard and the skeleton orchestration project is generated.

Figure 6 BPEL Import Wizard - Selecting Files to Import

Initially, the orchestration project looks deceivingly empty. However, upon closer inspection, you'll notice the following things occurred:

  • If you inspect Solution Explorer, you'll see an orchestration was created with the same name as the WSDL file.

  • The XSD files were automatically imported into the project.

  • The wizard generated several BizTalk Server types and messages for use within the orchestration that you'll find via the Orchestration View (see Figure 7) REF _Ref100857356 \h

  • Given our WSDL, a BizTalk PortType was generated with a name of MathService. The PortType contains a single operation named Multiply, which uses a request/response message exchange.

  • The Request message is mapped to InputMessage—a multipart message type also generated from the WSDL. InputMessage contains a single part named parameter, which maps to the DocIn element from the imported XSD. The same is true for the Response message.

  • In addition to the PortType, notice that the wizard also generated two message variables named Message_1 and Message_2 for use within the orchestration. These messages also map to the DocIn and DocOut XSD elements.

Figure 7 Orchestration view

Now all we need to do is define a new logical port based on the MathService PortType and our orchestration is guaranteed to conform to the interface defined in the original WSDL definition. To do this, create a new configured port and select MathService as the existing PortType. Once you finish the wizard, the new port appears containing all of the operations found in the PortType – in this case Multiply. Then you're simply left with the task of implementing the operations in the orchestration logic.

The completed orchestration for this example is shown in Figure 8. Next, we need to generate the Web services layer that implements the original WSDL contract and dispatches messages into our new BizTalk orchestration.

Figure 8 Port Configuration Wizard

Figure 9 Orchestration implementation from WSDL

Implementing a Conforming Web Services Layer

When you expose an orchestration through a Web service, the generated ASMX/WSE code is the BizTalk Server SOAP adapter. The adapter's job is to perform the necessary SOAP and WS-* processing on incoming SOAP messages, extract the payload from the SOAP envelope, and dispatch the payload to the BizTalk MessageBox. When the payload hits the BizTalk MessageBox, the SOAPness is lost and it is no longer considered a Web service message—it's simply an instance of some XSD type that BizTalk Server knows about. Upon arrival, BizTalk Server routes the message to the target orchestration. In the case of request/response operations, the Web service layer must also capture the response message returned by the orchestration, and create an appropriate SOAP response for the client.

Implementing this layer while conforming to an existing WSDL contract is the trickiest step of the overall process, and there are a variety of ways to approach it. First, you could use the built-in ASMX publishing wizard against the new orchestration. Although the publishing wizard produces the code needed to dispatch to the BizTalk MessageBox, the code won't conform to the original WSDL definition. The names of the various WSDL constructs are modified after passing through the code generation processes. The generated code may also contain other incompatibilities with respect to the original contract, such as binding differences and the necessary ASMX parameter style (bare vs. wrapped) that direct serialization.

Another option is to use the "publish schema" option to more fully control the WSDL and avoid the name-mangling problem referred to previously. This option requires you to manually define the WSDL operations via the wizard. Although it seems kind of silly to redefine the WSDL contract via the wizard when we had it from the beginning, doing so gets you closer to the original WSDL contract and produces the correct BizTalk Server dispatching code. We say "closer" because you can specify the correct names for things in the wizard, but the builder still doesn't let you specify WSDL/ASMX binding details. This means the ASMX-generated WSDL can still inherit these potential incompatibilities.

Regardless of the path you take in the ASMX publishing wizard, you'll have to make some manual edits to the generated ASMX code to ensure conformance with the original WSDL contract. The easiest way to do this is to disable the default ASMX WSDL generation and return the original WSDL file when requested by clients. Then you simply need to make edits to each WebMethod to ensure the ASMX dispatching and serialization logic continues to work properly. The exact steps you need to follow are in the following section.

ASMX Publishing Wizard Steps

Use the following steps to use the ASMX publishing wizard:

  1. Run the BizTalk Web Services Publishing Wizard to generate the ASMX code from the orchestration that implements the original WSDL contract.

  2. Disable automatic WSDL generation by modifying the ASMX code. You can do this by specifying the location of the static WSDL file you started from (specify the Location property on [WebServiceBinding] and the name of the specified binding on [SoapDocumentMethod]).

  3. Modify each [SoapDocumentMethod] attribute to use SoapParameterStyle.Bare and the same SOAPAction value specified in the original WSDL definition.

Making these changes makes most of the remaining details found in the generated ASMX code insignificant. Now when consumers request the WSDL for the ASMX endpoint (using "?wsdl"), ASMX returns a reference to the static WSDL file from which we started.

As long as the ASMX SOAPAction values match those found in the WSDL definition, ASMX routes incoming SOAP messages to the correct WebMethod implementations. And if ASMX isn't expecting "wrapper" elements during object serialization (which you disable by specifying SoapParameterStyle.Bare), the XML serialization process should continue to work. Using this approach gives you the best of both worlds—you remain in control of the WSDL contract while taking advantage of the publishing wizard to generate the necessary BizTalk Server dispatching code.

When using the WSE publishing wizard, similar issues exist. The main thing you need to worry about in this case is the SOAPAction for each operation. You no longer have to worry about serialization incompatibilities since the WSE-based methods are defined in terms of SoapEnvelope.

Nevertheless, you probably don't want to use the generated WSDL in this case either. However, with the WSE messaging API, you cannot disable automatic WSDL generation using the same technique described for ASMX. In order to do this with the WSE-generated code, you need to override the ProcessNonSoapRequest method (defined by SoapReceiver) on the generated WseReceiver-derived class. Then you can simply publish the static WSDL file on your Web server somewhere. The following section summarizes the exact steps you need to follow when using the WSE publishing wizard.

WSE Publishing Wizard Steps

Use the following steps to use the WSE publishing wizard:

  1. Run the BizTalk Server WSE Publishing Wizard to generate the WSE code from the orchestration that implements the original WSDL contract.

  2. Disable automatic WSDL generation by overriding the ProcessNonSoapRequest method to return an HttpException (404, not found). Instead, you can publish the static WSDL file in a virtual directory for clients to access directly.

  3. Modify each [SoapMethod] attribute to specify the same SOAPAction value specified in the original WSDL definition.

You could choose to avoid the publishing wizards altogether and use "wsdl.exe /server" to produce your Web service layer. This guarantees the generated ASMX conforms to the original WSDL definition, but it obviously doesn't generate the BizTalk Server dispatching code needed within the WebMethod implementations. Although not for the faint of heart, you could manually insert the BizTalk Server dispatching code by copying what the wizard produces (from another wizard-generated project) and customizing it within your WebMethods. The generated code follows a standard template but every implementation differs slightly by parameter lists, names, types, etc.

Regardless of the approach you use to produce the Web services layer, the last thing you need to do is bind your orchestration's logical port to the SOAP adapter specifying the address of the ASMX endpoint you're using for the Web service layer. Doing so generates the appropriate MessageBox subscriptions for routing the incoming messages sent by the Web service layer to the deployed orchestration.

Although none of these solutions is likely to make you completely happy, it is possible to implement existing WSDL contracts using BizTalk orchestrations today. Doing so, you reap the many benefits offered by the BizTalk orchestration engine surrounding state management and long-running transactions. You just need to know what options are available for getting the job done.

Where Are We?

BizTalk Server 2004 provides in-depth integration with Web services and productive tools such as the Web Services Publishing Wizard and the BPEL Import Wizard for mapping between the worlds of BizTalk orchestrations and WSDL. We've covered step-by-step techniques for implementing existing WSDL contracts in your orchestrations today, along with alternative mechanisms for implementing a conforming Web services layer.

RosettaNet and SAP Integration

RosettaNet is a non-profit organization whose goal is to standardize on open e-business processes for document interchange. The organization consists of the world's leading information technology (IT), electronic components (EC), semiconductor manufacturing (SM), and solution provider (SP) companies. XML is used as the core technology to provide a common medium of business-to-business communication between organizations, departments, and trading partners.

Microsoft BizTalk Server 2004 helps companies efficiently and effectively integrate systems, employees, and trading partners through manageable business processes, enabling them to automate and orchestrate interactions in a highly flexible and highly automated manner.

Microsoft BizTalk Accelerator for RosettaNet (BTARN) 3.0 combines prebuilt support for all current RosettaNet Partner Interface Processes (PIPs) with a suite of development, testing, management, and rapid deployment tools to significantly reduce the time and resources required to build, deploy, and manage RosettaNet-based integration with trading partners.

The Microsoft BizTalk Adapter v2.0 for mySAP Business Suite provides the means to enumerate all IDoc, BAPI, and RFC calls (including customized IDocs) and allows the user to select multiple IDocs, BAPIs, and RFCs for each adapter instance. It also provides the means to enumerate IDoc, BAPI, and RFC schemas and convert these schemas into BizTalk Server 2004-compatible XSD schemas.

BizTalk Server 2004, along with BTARN, provides a business process platform for implementing the RosettaNet standard and includes the capability to integrate messages between companies from various industries who are involved in using heterogeneous back-end systems. The PIPs are XML-based RosettaNet document specifications (or schemas) that are used as a core to mapping messages between a RosettaNet document and other system formats such as those used by SAP and Siebel systems.

Throughout this document, we use a RosettaNet 3A4 Purchase Order Request document and an SAP ORDERS05 IDoc. BizTalk Server is used to integrate and map between these two formats. This sample extends the capability of the Microsoft BizTalk Server 2004 solution and provides an example of message exchanges by integrating RosettaNet transactions interfacing with the SAP systems using Microsoft BizTalk Accelerator for RosettaNet 3.0 and the Microsoft BizTalk Adapter v2.0 for mySAP Business Suite.

RosettaNet Partner Interface Processes

The RosettaNet Partner Interface Processes (PIPs) are business processes between trading partners. The processes are specialized system-to-system XML-based messages that include the terms and conditions associated for document exchanges. A message generally covers many scenarios that may occur during the exchange of dialogs between two or more systems. For example, if a message is transmitted from one system to the next and an error occurs, we can find a set of schemas defined to handle such error conditions. The RosettaNet PIPs contain a set of schemas that define various scenarios of message exchanges.

RosettaNet categorizes the PIPs by high-level business functions called clusters and subfunctions known as segments. Each PIP defines how a document is packaged and processed. The PIPs come in seven clusters, or groups of core business processes, and each cluster is divided into segments. For a complete list of clusters and segments, visit http://go.microsoft.com/fwlink/?LinkId=56832. For this document, we focus on the 3A4 PIP. The 3A4 can be broken down into Cluster 3 as Order Management, Segment A as Quote and Order Entry, and Process 4 as Manage Purchase Order for the 3, A, and 4 representations. We cover more on the 3A4 schema later in this document.

Microsoft BizTalk Adapter v2.0 for mySAP Business Suite

When BizTalk Server 2004 and the Microsoft BizTalk Adapter v2.0 for mySAP Business Suite are installed together, BizTalk Server can seamlessly establish a connection with an SAP R/3 4.x or R/3 6.20 (Enterprise) system. The Add Generated Items Wizard provides a "no-code" connectivity solution for integrating SAP data.

Prior to generating schemas through the Microsoft BizTalk Adapter v2.0 for mySAP Business Suite, we create a send port by using BizTalk Explorer. The send port is mainly used as a means to access the metadata located in the SAP Business Object Repository (BOR). Figure 1 shows a window to create a new one-way static send port associated with the address (URI). Figure 2 shows another window to set up the SAP transport credentials.

Figure 1 Static one-way send port

Figure 2 Setting a physical send port in BizTalk Explorer for the Microsoft BizTalk Adapter v2.0 for mySAP Business Suite

The send port created previously can then be used to access the SAP system remotely in the Add Adapter Wizard. Figure 3 shows the Add Adapter Wizard used in the process of generating schemas using the Microsoft BizTalk Adapter v2.0 for mySAP Business Suite.

Figure 3 Add Adapter Wizard in BizTalk Server 2004

Figure 4 is where we search the IDocs, BAPIs, or RFCs in the SAP system using a configured port. Here, we search the ORDERS05 IDoc and choose the ORDERS05 IDoc from the results list. Finishing the wizard generates an ORDERS05 schema and saves it under the BizTalk project.

Figure 4 Schema Generation Wizard for ORDERS05 IDoc

Key Capabilities of the Microsoft BizTalk Adapter v2.0 for mySAP Business Suite

The Microsoft BizTalk Adapter v2.0 for mySAP Business Suite enhances BizTalk Server with the following key capabilities:

  • Browse the Business Object Repository (BOR) in an SAP system and search for the appropriate IDoc, BAPI, or RFC metadata using a GUI wizard.

  • Generate an XDR schema from metadata in the BOR.

  • Send IDoc, BAPI, or RFC documents from BizTalk Server to SAP.

SAP ORDERS05 IDoc Schema

What is an IDoc? IDoc stands for Intermediate Document in SAP. IDocs are categorized according to their message types, and each message type contains the basic IDoc type. The IDoc we use in our scenario is ORDERS05, which is a basic IDoc type and is categorized under the ORDERS message type. Using the Microsoft BizTalk Adapter v2.0 for mySAP Business Suite, we can generate the ORDERS05 schema as shown in the steps in the previous section.

Usually, the ORDERS05 schema is around 1,700 KB in size and complicated in structure. The first element of the schema is EDI_DC40, which contains the control record information representing the IDoc header message. Some of the important fields in this element are IDOCTYP, MESTYP, SNDPOR, SNDPRT, SNDPRN, RCVPOR, RCVPRT, and RCVPRN. It is important to have appropriate values in these fields for the SAP system to identify a valid inbound IDoc. IDOCTYP is the type of IDoc, MESTYP is a message type, SNDPOR is a send port, SNDPRT is a send port type, and SNDPRN is a send port number. Similarly, RCVPOR is a receive port, RCVPRT is a receive port type, and RCVPRN is a receive port number.

Another element in this schema is E1EDK14. This part is important because it defines the organizational data such as the Sales Organization, Distribution Channel, and Division in the SAP system for the IDoc. It has a qualifier to identify each type of E1EDK14 message. For example, the QUAL field in the schema (which represents the qualifier) is 008 for Sales Organization, 007 for Distribution Channel, and 006 for Division. Each qualifier has an Org Id to represent which type of Sales Organization it is, which type of Distribution Channel, and so on.

E1EDK03 is the next segment, which defines dates. It contains a qualifier (IDDAT) and a value (DATUM) to hold the date type and the date. Examples of a qualifier (IDDAT) are 012 for Document Date, 022 for Purchase Order Date, and 028 for Due Date.

E1EDKA1 is a segment in this message type where it defines the partner information. It contains the address of the business partner. The individual roles are defined in the PARVW field and the partner number is defined in the PARTN field. It has other fields such as NAME1, NAME2, STRAS, STRAS2, ORT01, REGIO, PSTLZ, TELF1, and TITLE. All of these fields define Firstname, Lastname, Street1, Street2, City, State, Zip, and so on. In this segment, PARVW identifies the business partner role type, such as AG to be sold-to-party, RE to be bill-to-party, LF to be vendor, and WE to be ship-to-party.

Figure 5 shows a sample ORDERS05 schema.

Figure 5 A sample of the ORDERS05 IDoc schema in the BizTalk Schema Editor

The E1EDP01 segment contains information about the line item. POSEX is the first field in this segment and signifies the line item number of a line item. The ACTION field defines which action to take before the dispatch, or which action to carry out by the receiver. MENGE and MENEE describe the quantity and unit of measure, while BMNG2 and PMENE describe the quantity in price unit and price unit of measure, respectively. The other two segments, E1EDP19 and E1EDP20, are subsegments of E1EDP01. E1EDP19 includes the material description. It has a qualifier (QUAL) to pass different types of material descriptions. For example, 001 is a material number used by a customer and 002 is a material number used by a vendor. E1EDP20 includes scheduled quantity and dates for an item. It has fields like WMENG, AMENG, EDATU, EZEIT, and ACTION. For example, WMENG is a scheduled quantity, EDATU is a scheduled date, and EZEIT is a scheduled time.

RosettaNet Purchase Order Request (3A4) Schema

The RosettaNet Purchase Order Request document uses a 3A4 schema. The purchase order request schema is applied to issue a new purchase order request. Primarily, it enables a buyer to issue a purchase order and obtain a response from the provider to notify if a certain line item is accepted, rejected, or pending via the purchase order confirmation schema. This scenario does not cover the confirmation message back to the user.

The main elements of the Purchase Order Request schema are fromRole, PurchaseOrder, thisDocumentGenerationDateTime, thisDocumentIdentifier, and toRole. The fromRole segment contains information about the partner role description. It signifies the business description, contact information, and physical location of the role initiating the business document exchange.

The PurchaseOrder element is another part of this schema that contains the core information about the purchase order itself. It has elements to hold information like account description, document reference, shipping information, product line item, shipping destination, and total amount. The thisDocumentGenerationTime element identifies the date and timestamp of the current document, and the thisDocumentIdentifier element identifies a unique number of the current document.

Figure 6 shows a sample RosettaNet 3A4 Purchase Order Request schema.

Figure 6 A sample of the RosettaNet 3A4 schema in the BizTalk Schema Editor

The toRole segment represents the role that receives the document in the business document exchange and contains information similar to the fromRole segment.

Mapping the RosettaNet 3A4 Schema to the ORDERS05 Schema

Mapping a source schema to a destination schema is done in the BizTalk Mapper tool. In this example, the source schema is 3A4 Order Request and the destination schema is the ORDERS05 IDoc schema. Generally, we connect nodes from the source schema to the destination schema to link the values from the source node to the destination node for message transformations. However, in this sample, both the source and destination schemas are large and complicated. Due to its intricate structure and numerous nodes, the mapping is more complex than simply linking the source and destination nodes. In order to surmount the complicated logic between the source and destination nodes, BizTalk Server 2004 provides functoids.

The BizTalk Mapper tool provides built-in functoids such as a looping functoid, a logical existence functoid, a value mapping functoid, an isEqual functoid, an indexing functoid, and many more. On top of these built-in functoids, BizTalk Server 2004 provides the flexibility to add a customized functoid to meet a developer’s needs. Below we have several figures to define each group of functoids we use in order to enable a valid mapping between the source and destination schemas.

The E1EDK14 node in the destination message is looped with different values for the qualifiers (QUAL) and the corresponding ORGID coming from the source schema. In this case, we are using the logical existence functoid and the value mapping functoid along with the looping functoid. The logical existence functoid is used to check the existence of a value in the source node and the value mapping functoid is used to validate the logic of the input parameters. The latter functoid takes two parameters and compares the value to be true or false. If the logic is true, it passes the value to the destination node; otherwise, nothing happens.

Figure 7 shows the mapping of the source schema to the destination schema using a looping functoid, a logical existence functoid, and a value mapping functoid.

Figure 7 Mapping using looping, logical existence, and value mapping functoids

We use a looping functoid in cases where multiple nodes in the source schema are linked to a single node in the destination schema. The single destination node consumes different values from the multiple source nodes. For example, in our map, the GlobalBusinessIdentifier node under the billTo structure and the GlobalBusinessIdentifier node under the shipTo structure of the source 3A4 schema are linked to the PARTN node in the E1EDKA1 structure of the destination ORDERS05 schema. Hence, the looping functoid generates as many E1EDKA1 segments along with the PARTN elements as the number of nodes linked from the destination schema. Figure 8 shows the mapping of the source schema to the destination schema using another scenario of utilizing the looping functoid, the logical existence functoid, and the value mapping functoid.

Figure 8 Mapping using looping, logical existence, and value mapping functoids

The E1EDK03 node in the destination schema is looped with different values for the qualifier (QUAL) and different dates (DATUM) for each qualifier similar to how we did this in the E1EDK14 node. However, in Figure 9, we use the iteration functoid to separate the DocumentReference nodes one at a time and pass the datetime value to the DATUM node in the destination schema.

Figure 9 Mapping using iteration, equal, and value mapping functoids

In Figure 10, we use the string find and string extract functoids. The string find functoid returns a position in a string where a specified string begins. Accordingly, the string extract functoid extracts a string specified by the start and end positions of an input string. In our example below, these two functoids are used to extract the data from a timestamp value and are passed to the DATUM node in the destination schema.

Figure 10 Mapping using string find and string extract functoids

Microsoft BizTalk Accelerator for RosettaNet 3.0

Microsoft BizTalk Accelerator for RosettaNet (BTARN) 3.0 builds on top of BizTalk Server to enable business communications among business partners. It provides support for the RosettaNet Implementation Framework (RNIF) and Partner Interface Processes (PIPs) to automate transactions. RNIF defines how systems transmit the RosettaNet messages. The RNIF standard helps in transferring, routing, packaging, and securing the messages traveling from one system to another. This standard also defines the message structures, acknowledgments, MIME encoding, and digital signatures based on HTTP, MIME, and XML technologies. The RosettaNet organization defines message exchanges using the RNIF specifications. RNIF provides a predefined flow to exchange messages among integrated systems.

Messages are sent from the initiator to the responder systems and passed through the BTARN 3.0 installed in both ends. The line-of-business application starts the flow of the message by sending it to the initiator system in its raw format. Then, the message transforms into the RNIF-compliant message and gets sent over the Internet to the responder computer. When the responder system receives a double-action message (a 3A4 message in our scenario), it converts the message from an RNIF-compliant message to the message in a proprietary format and sends an acknowledgment to the initiator as a response.

The BTARN Management Console configures processes, a home organization, partners, and agreements between the home and the partner organizations. In our case, the home organization is CONTOSO, the partner organization is FABRIKAM, the agreement is Contoso_To_Fabrikam _3A4, and the process configuration we use is STD_3A4_V02.02 (Request Purchase Order).

Since we do not use Secure Sockets Layer (SSL) server authentication and signing certificates in this sample, we must change the behavior of the document exchange between home and partner organizations by changing the parameters of the STD_3A4_V02.02 process configuration settings. To do so, we double-click the STD_3A4_V02.02 under Process Configuration Settings in the BTARN 3.0 Management Console or right-click the STD_3A4_V02.02 and click Properties on the context menu. The BTARN 3.0 Management Console is shown in Figure 11.

Figure 11 BTARN 3.0 Management Console showing STD_3A4_V02.02 process configuration settings

Once we have the properties window opened for STD_3A4_V02.02, we change the parameters to false as shown in Figure 12. This allows us to exchange documents without using the encryption and signing certificates.

Figure 12 STD_3A4_V02.02 process configuration activity settings

In order to create the home organization, we right-click the surface on the right side of the screen under Home organization in the BTARN 3.0 Management Console, point to New on the context menu and click Home Organization. A Home Organization property window pops up as shown in Figure 13. We then enter the Name and Global Business Identifier (GBI), also called DUNS number, to uniquely identify this organization. Finally, we enter the contact information on the Contact Properties tab and click OK. Similar steps are followed to create a new partner organization.

Figure 13 BTARN 3.0 Management Console's home organization properties

When we create an agreement between the home and partner organizations, we click on the right surface under Agreements and point to New to open the New Agreements Properties window as shown in Figure 14. Then we enter the name of the agreement, choose My Organization and Partner Organization, and click the Ports tab. On the Ports tab, we enter the Action URL, Signal URL, and Sync URL as "http://localhost/BTARNApp/RNIFReceive.aspx" for all and click OK to create this agreement.

Figure 14 New Agreement Properties window

Since this scenario involves only one computer to transmit the 3A4 request and receive a response message versus using two separate computers to process the flow, we use a loopback command to create an agreement between the CONTOSO and FABRIKAM organizations. The loopback command that comes with BTARN 3.0 is located in <drive>:\Program Files\Microsoft BizTalk Accelerator for RosettaNet 3.0\SDK. The two commands listed below generate a loopback agreement between a CONTOSO organization and a FABRIKAM organization:

> <Loopback /enable CONTOSO
> Loopback /mirror "Contoso_To_Fabrikam_3A4"

Figure 15 Microsoft BizTalk Accelerator for RosettaNet Management Console

Figure 15 shows the Microsoft BizTalk Accelerator for RosettaNet Management Console where we can view the process configuration settings, home organizations, partners, and agreements. To open this application, click Start, point to All Programs, point to Microsoft BizTalk Accelerator for RosettaNet 3.0, and then click BizTalk Accelerator for RosettaNet Management Console.

Overall Architecture

Our scenario starts off with the Web client application. The Web interface allows users to enter the home organization name, the partner organization name, the PIP instance ID, and the service content. The service content holds the 3A4 XML message. For more information on the Web interface, see "Web Client Interface" below.

As soon as the user submits the message from the Web interface, the initiator computer stores it in the SQL Server database. Then BTARN on the initiator computer sends the message from the SQL Server database to the SQL adapter. The SQL adapter forwards the message to the XML receive pipeline that does a simple XML validation of the message. BizTalk Server then routes this message to the MessageBox database. As soon as it reaches the MessageBox database, the private process processes the service content of the message, and the public process processes the RNIF headers of the message. Soon after that, BTARN routes the message back to the MessageBox database and the send pipeline performs assembly and signing/encryption/encoding of the message, ready to be routed to the HTTP adapter. Finally, BTARN routes the message to the RNIFSend.aspx page, which sends it over the Internet to its destination. Figure 16 shows the flow of the message starting from the line-of-business application to the point where the RNIFSend.aspx page sends it off to the responder system via the Internet.

Figure 16 Flow of an initiator message

The following components are involved in processing the message in the initiator system:

  • SQL adapter

  • XML receive pipeline

  • Initiator private process

  • Initiator public process

  • XML send pipeline

  • HTTP adapter

  • RNIFSend.aspx page

On the other end, when the responder computer receives the message from the initiator system, BTARN submits the message to the HTTP adapter, which forwards it immediately to the receive pipeline. The receive pipeline decodes, disassembles, and performs party resolution, and then transforms the message to the proprietary format of the back-end line-of-business application. BTARN then routes the message to the MessageBox database. The public process processes the RNIF headers of the message and the private process processes the service content of the message. The private process also generates an acknowledgment for the public process, the MessageBox database, the send pipeline and the HTTP adapter for return over the Internet back to the initiator system. BTARN then reroutes the message to the MessageBox database. The send pipeline assembles and signs/encrypts/encodes the message. BTARN routes the message to the SQL adapter, which submits the message to the SQL Server. When the message gets stored in the SQL Server engine of the responder computer, the rprtRN3A4_ORDERS05 receive port pulls the message from the MessageToLOB table in the BTARNDATA database in the SQL Server engine using the SQL adapter located in the responder computer. The RN3A4_ORDERS05 orchestration extracts the service content and creates the 3A4 message. This message is transformed into the ORDERS04 IDoc message, and then it is sent to the designated SAP system using the Microsoft BizTalk Adapter v2.0 for mySAP Business Suite. For more information on the responder RN3A4_ORDERS05 orchestration, see the "Overall Architecture" section.

Figure 17 Flow of a responder message

Figure 17 shows the flow of the responder message. The following components are involved in processing the message in the responder system:

  • RNIFReceive.aspx page

  • HTTP adapter

  • Receive pipeline

  • Responder public process

  • Responder private process

  • SQL adapter

  • Send pipeline

  • Microsoft BizTalk Adapter v2.0 for mySAP Business Suite

PIP 3A4_ORDERS05 Orchestration

Orchestrations are created in BizTalk Server for business process flow. The orchestration, as shown in Figure 18, is implemented to pull a message from the BTARN database located in the responder computer and forward it to the designated SAP system. This orchestration starts when the responder system completes its process of storing the message in the BTARN database of the SQL Server engine. The SQL adapter in the responder system then extracts the message from the BTARN database using the receive port. This receive port passes the message to the receive pipeline, which stores it into the MessageBox database of Microsoft BizTalk Server 2004. Hence, the orchestration we implemented subscribes to the MessageBox database and extracts the service content message as a core 3A4 message instance using the MsgHeaderHelper solution. Before we run the RNPIP3A4_ORDERS04_BTS BizTalk solution, we must install the MsgHeaderHelper in the global assembly cache. Finally, the orchestration transforms the 3A4 message to an ORDERS05 IDoc message using the map defined in the BizTalk Mapper tool.

Figure 18 shows the top portion of the orchestration. This part of the orchestration is defined inside a long-running transaction scope and receives the message from a 3A4ReceivePort. After it receives the message, the ConstructServiceContentMsg extracts the service content message and assigns it to the SvcContent variable, using the MsgAssignment shape in the orchestration to construct the 3A4 message. At the same time, this orchestration also handles System.Exception should an error occur during the message flow.

Figure 18 BizTalk orchestration to receive a RosettaNet message and extract a service content 3A4 message – Part I

Figure 19 Send 3A4 message to the SAP system after transforming it to the ORDERS05 IDoc message

Figure 19 is the other half of the orchestration. It has a parallel action shape and distributes the action to acknowledge the receipt of the RosettaNet 3A4 message while sending the ORDERS05 IDoc message to the SAP system. The 3A4 message is transformed to the ORDERS05 IDoc message before it is sent out to the assigned SAP system.

Web Client Interface

A Web interface exposes the fields that are passed to BizTalk Accelerator for RosettaNet (BTARN) 3.0 for further processing. The primary fields are the Home Organization, the Partner Organization, the 3A4 Instance ID, and the Service Content message exposed on the Web interface. When the user clicks the submit button with information in the text fields, it passes the values to BTARN. Figure 20 shows the Web client interface.

Note: Disable the anonymous access to the Web folder in the IIS manager on the Directory Security tab of the Properties window.

Figure 20 Web interface to insert Home, Partner, 3A4 Instance ID, and the Service Content message

When the page above submits data, the browser redirects to the query data page and polls the MessageToLOB table to fetch the signal messages from the BTARN database located in the initiator system. Some of the signal messages defined in BTARN 3.0 are 10 as a request signal, 25 as a response signal, and 50 as a response signal with an acknowledgment.

In Figure 21, the Outgoing Message section shows information from the MessageFromLOB table in the BTARN database and the Incoming Message section shows information from the MessageToLOB table in the BTARN database of the initiator computer.

Figure 21 Web interface to check the status of the messages

SAP Transactions

When the designated SAP R/3 system receives the ORDERS05 IDoc, we can create a new purchase order, and change and display the document by using transactions such as VA01, VA02, or VA03. In Figure 22, we use transaction VA03 to display information to view a newly arrived purchase order number 9190 located in the SAP system.

Figure 22 Display purchase order using transaction VA03

Other useful transactions to check the receipt of ORDERS05 IDoc are WE19 and WE20. Transaction WE19 lets us view the IDoc in a structured format, and WE20 allows us to view the same IDoc in a segment-by-segment format. Figures 23 and 24 display the transactions WE19 and WE20 in the SAP system.

Figure 23 Use of transaction WE19 to view ORDERS05 IDoc

Figure 24 Use of transaction WE20 to view ORDERS05 IDoc

 

BizTalk Server 2004 Architecture

Introduction

Automating and maintaining business processes in a dynamic and cost-effective manner has proven to be a difficult endeavor for even the most technically sophisticated organizations. However, a new application development and integration methodology has evolved that effectively addresses these issues. Known as Service Oriented Architecture (SOA), the methodology is based on XML and Web services technologies and has been incorporated into Business Process Management and Enterprise Application Integration (BPM/EAI) platforms.

The SOA paradigm has redefined the concept of an application. An application is no longer an opaque, procedural implementation mechanism. Instead, it is an orchestrated sequence of messaging, routing, processing, and transformation events capable of processing the exposed declarative properties of rich (XML) documents.

A workflow process, integration scenario, or trading partner interaction are specialized classes of the SOA paradigm distinguished only by the nature of the participants involved, the point of execution, and the participants’ individual security requirements. BPM/EAI platforms that incorporate the SOA paradigm are highly compelling because they provide numerous development and operational benefits:

They alleviate significant development inefficiencies and impediments to effective life cycle maintenance.

They facilitate the flexible “loose coupling” of components on a highly distributed basis.

They permit the addition, removal, and reconfiguration of any process activity or component without disrupting the process.

They are fundamentally oriented to supporting long-running, asynchronous transactions that scale well.

They ensure the applications are well documented and visible because the process activities, components, and functions are exposed and self-describing.

They enable the extensibility and reuse of both application components and entire applications.

They maximize the network infrastructure of the Internet and the protocol standards of the World Wide Web.

Approaching a development environment based on the SOA paradigm does require a reorientation in the concepts and methodologies of application development. In this document we describe the fundamental SOA concepts and development methodologies. We then explore how the Microsoft® EAI development environment, BizTalk® Server 2004, implements these concepts and methodologies within two particular contexts: the design, behavior, and functionality of the applications that are created; and the development process itself. Finally the document describes how the BizTalk Server development tools, which are integrated with Visual Studio® .NET, provide a bridge between the .NET framework architecture and the SOA paradigm.

BizTalk Server—SOA implementation

The value of implementing BizTalk Server with SOA is apparent when you consider how one might achieve the development and operational benefits specified previously. To begin with, we can examine the inefficiencies of the development process and the ways in which BizTalk Server addresses them.

Traditional programming methodologies do not adequately translate the conceptual model of an application or business process (that is, a design specification) into an executable form. While development notation systems such as UML allow a business analyst to document functional specifications and Use Cases using a structured methodology, a programmer still has to interpret this documentation and translate its intent into a different language and structure. This manual and highly interpretive conversion process is characterized by its inefficiencies—most notably its recursive revision cycles. After the business processes have been accurately translated into procedural code, another issue typically presents itself: the behavior of the code is less predictable than the behavior of the business process it models. This volatility results from the nature of procedural code implementations. Bound to a machine execution model, procedural code is an opaque embodiment of processes that encapsulate multiple levels of tightly coupled, interdependent functionality. Consequently, procedural code is prone to program errors that are often difficult and time-consuming to identify and repair. Understandably, then, when software is operationally stable, subsequent modifications are discouraged—often to the point of requiring modifications to business processes just to accommodate the limitations of the rigid code.

A BPM/EAI development environment allows the business analyst and the programmer to collaborate in a common workspace on a visual model of the process that combines and correlates their respective contributions. The programmer and analyst create the application by arranging high-level objects representing messages, messaging events, business rules and logic, information flows, activities, operations, transformations, and subprocesses, using a drag-and-drop graphical user interface. The model itself directly generates an executable run-time assembly of the process. This methodology provides significant development efficiencies and life cycle flexibility by minimizing the ambiguities and recursive revision cycles inherent in traditional methodologies. Furthermore, the implementation mechanisms for highly complex functions, such as transactions requiring two-phase commit, roll-back ACID transaction support, and nested and parallel operations, are built in functions of the objects; thus, eliminating the need to write complicated procedural code to implement these capabilities.

To better illustrate the SOA development methodology the following steps describe the procedure for creating an application in BizTalk Server that adheres to this paradigm:

1.

Create the documents involved in the application/process as well as their respective schema definitions.

This is accomplished in the Schema Editor, a BizTalk Server module accessed from within Visual Studio .NET. The Schema Editor enables you to define the structure and semantic metadata that “declares” the meaning, functions, and processing requirements of the content of a document (an “instance”) that is created from the schema. When BizTalk Server receives an instance of a document, the process to which the document is associated validates the document content against its schema definition to ensure the document’s form and content conform to the schema and the application’s processing requirements. BizTalk Server Schema Editor creates a W3C-compliant XSD document as well as a visual tree node reference model of the schema.

Following is an example of the Schema Editor that shows the tree node model of the schema in the left panel and the XML representation of the document schema in the right panel.

bizarc01.gif

2.

Create and define the transformation requirements for any document interchanges.

In applications that are composed of loosely coupled interactions between XML objects, document transformation becomes a functionally exposed mapping subprocess. In BizTalk Server this subprocess is created in BizTalk Server Mapper. The transformation maps are used to process and convert the content and structure of any source information (based on its schema representation) into any target document format, such as a report. BizTalk Server Mapper visually displays the source and destination information formats using the schema tree node model used by BizTalk Schema Editor. Information is mapped from one or more nodes in a source schema to one or more nodes in the destination schema by drawing links between the nodes. Functoids, which provide additional conversion, processing, and abstraction capabilities (looping, cumulative, date and time, iteration, and so forth), are graphically implemented by linking one or more source nodes to a functoid, and then linking the functoid to one or more destination nodes.

bizarc02.gif

Each transformation map (as well as the referenced source and target schemas) becomes a BizTalk Server project resource that is subsequently embedded into an orchestration as a process step and compiled into the orchestration assembly. Maps can be reused and modified as needed to implement any number of transformation requirements and they be deployed within any number of orchestrations. The maps created by BizTalk Server Mapper are based on XSLT, an open standards protocol for transforming XML information.

3.

Specify the business logic governing event execution.

If the business logic is simple, it can be embedded as an expression directly within a BizTalk Server orchestration decision step. If the business logic is complex, the BizTalk Server Rules Composer can be used to create and process the sophisticated rule sets. Each rule set (or “Policy”) drives a specific activity or function and becomes a resource object embedded into a BizTalk Server orchestration.

Consistent with the overall BizTalk Server architecture, transparency and loose coupling govern the creation and implementation of business rules. A rule set incorporated within a BizTalk Server orchestration can be viewed, modified, or completely replaced both at design and run time, without affecting any other process operation or interrupting running instances of the affected process. The flexibility that an exposed and componentized rule engine provides for modifying business processes is of fundamental significance. In conventional application development, business rule logic is embedded in procedural code and is not accessible for modification without changing the code itself. Because most modifications to a business process life cycle pertain to changes in business rules (as opposed to technology-related modifications), the ability to isolate business rules entirely from procedural code, or any process implementation mechanisms, dramatically improves the efficiencies of managing and adapting business processes throughout their life cycle.

BizTalk Server Rules Composer supports the creation of domain-specific vocabularies for defining business rules, and its functionality is exposed through public interfaces, making it extremely flexible and extensible. The following is an illustration of the BizTalk Server Rules Composer module.

bizarc03.gif

4.

Determine and implement requirements for message preprocessing and post-processing.

This is accomplished in the BizTalk Server Pipeline Designer module. Accessed through the BizTalk Server orchestration workspace, the Pipeline Designer module is used to implement the interchange requirements for encryption, authentication, and data format conversion with external applications and parties.

A pipeline is a sequence of processing operations that take place before a message is received by, or dispatched from a process orchestration or message data store. A “receive pipeline” accepts an incoming message, decrypts or decompresses it as required, disassembles the message into its parts, converts it into an XML document as specified in the BizTalk Server Schema, validates the message, and authenticates the identity of its sender. When a message passes through a pipeline, it is transferred to the BizTalk Server MessageBox store. A “send pipeline” performs the same operations as the “receive pipeline,” but in reverse. It assembles, formats, encrypts, compresses, and digitally signs a message as required by the external recipient.

bizarc04.gif

5.

Compose and orchestrate the application/process steps.

This takes place in BizTalk Server Orchestration Designer, the main workspace within Visual Studio .NET where an overall BizTalk Server application is developed and implemented. A process orchestration diagram is created by dragging and dropping object shapes found on the Orchestration Toolbox and linking them together. These shapes represent process activities such as receive, invoke, sequence, flow, link, and source. These shapes are used to compose and execute message flows, messaging events, business rules, activities, operations, transformations, and subprocesses.

The following figure illustrates a BizTalk Server orchestration diagram that implements the following workflow process steps:

The process application (a BizTalk Server orchestration) receives an inventory order replenishment request (“Request’).

The process application checks the quantity of items ordered. If the order contains more than 500 items, it is denied. If the order contains 500 or fewer items, it is accepted.

If the order is declined, a notification is created (“ReqDenied”) and sent to the person who placed the order.

If the order is accepted, the original order request is submitted to an ERP system for processing.

bizarc05.gif
See full-sized image

Composing the illustrated process diagram involved dragging and dropping the following shapes from the Toolbox and then modifying them:

Placed a Receive shape at the top of the design surface and named it Receive_Req.

Placed a Decision shape directly beneath the Receive Shape and named it CheckQuantity.

The Decision shape automatically creates two activity branch shapes (If or Else) The If shape is renamed Decline. The Decline shape is linked to an expression editor in which the XPATH expression “RequestInstance.Item.Quantity > 500” is created. This XPATH expression will function as the “If” rule that specifies the denial criteria for the order request.

Placed a Construct Message shape below the Decline shape and named it Construct_ReqDenied.

Placed a Transform shape within the Construct_ReqDenied shape.

Placed a Send shape below the Construct_ReqDenied shape and named it Send_ReqDenied.

Placed a Send shape below the Else shape and named it Send_REQToERP.

6.

Link the design shapes to implementation objects.

When the process steps are diagrammed, the next step involves linking the shapes to the objects required to implement the process. The objects may include the actual message documents, port locations where the messages are sent and received, and transport mechanisms required to move the messages. This linking stage is also performed in the Orchestration Designer.

In the sample orchestration diagram, when a running process receives an instance of a Request document (note the Receive shape that initiates the process), the process will validate the document’s content against its schema definition to ensure the document’s form and content conform to the schema and the application’s processing requirements. If the Request document does not conform, the Transform subprocess embedded in the Construct Message process references an XSLT transformation map that converts the Request document to a ReqDenied document, as described in the second step.

7.

Where applicable, define parties and their respective roles and link to orchestration functions.

This is accomplished in BizTalk Server Explorer, a tool that provides configuration information for the orchestrations and external components that make up a specific BizTalk Server project. Organized in a hierarchical tree structure, Explorer is used to configure the relationships and interactions of the project orchestrations to other project components such as roles, parties, send and receive ports, and receive locations.

After all the logical steps are implemented in an orchestration diagram, a Visual Studio .NET run-time assembly (DLL file) is generated from a “build” of the orchestration diagram. This assembly may be implemented as an application on its own, or included as a component of a larger BizTalk Server solution.

bizarc06.gif

A BizTalk Server solution (a process application) includes one or more Visual Studio .NET projects that contain BizTalk Server components such as schemas, orchestrations, transformation maps, and pipelines. From the example discussed earlier, the schemas for the Request and ReqDenied documents and the transformation map are combined in a discrete BizTalk Server project that builds a compiled assembly.

The BizTalk Server orchestration diagram that details the process workflow is also a discrete BizTalk Server project within the same solution. By referencing (encapsulating) the schema and map assembly, the diagram can incorporate the schemas and map as functional objects. All of the BizTalk Server project assemblies for a solution are then deployed and installed as an executable application under the management of the BizTalk Server run-time engine.

SOA—Underlying Technologies

Having discussed how an application is developed and implemented using the high-level tools within BizTalk Server 2004, we can now relate this development methodology to the underlying technologies that facilitate the Service Oriented Architecture (SOA) paradigm. As noted earlier, the fundamental principles of SOA are exposed functionality, document messaging, loose coupling, and platform independence.

XML provides the transparency and application independence and uses metatags to “declare” the meaning and function of data. The premise of XML is to convert program-dependent data into self-describing, program-independent data. This applies not only to content, but also to instructions for processing the content.

XML Schema provides semantic consistency and interoperability. XML Schema is a specification that formally defines an extensive array of data type primitives and structural components for creating XML documents; it serves as a dictionary of abstract elements, attribute entities, and organizational rules. Creating XML documents that conform to a schema “dictionary” has a significant advantage: the meaning, function and use of a document’s content is comprehensible to, and operable by, any XML-enabled application that can access the document’s underlying schema. Every industry-specific initiative to develop a common vocabulary and set of procedures for the exchange and processing of information is based on XML Schema. In fact, the XML Schema even serves as the basis for Web services protocols.

The Web services protocols, Simple Object Access Protocol (SOAP), and Web Services Definition Language (WSDL) provide the capabilities and messaging facilities required to bind and execute programmatic functionality anywhere, on any platform, without the need for custom code. The significance of the Web services specifications is that they provide the first truly workable architecture for building complex, interoperable computing processes over the Internet.

SOAP is an XML-based messaging protocol used to encode documents for transporting over a network. A “SOAP client” inserts an XML document into a SOAP envelope and posts it using HTTP (referred to as marshalling) to a “SOAP listener” that accepts the delivery. SOAP messaging has a number of benefits:

The SOAP client and listener applications are simple constructs. A SOAP client can be easily embedded as a routine in any program or Web page, and the URL endpoint can serve as the SOAP listener.

By using HTTP as its transport mechanism, a SOAP message can go anywhere, use existing SSL facilities for authentication and encryption, and make the most of the infrastructure scale of the World Wide Web.

Everything in the message, the SOAP envelope, the message header, and the body is expressed in XML, thus making the whole object entirely transparent. Because the semantics and structure of the documents are fully exposed, extensive validation, manipulation, routing, and transformation functions can be applied to the documents without writing application code to do so. Unlike CORBA, a Web services network endpoint (an HTTP, URL, or other address) can support multiple XML formats, providing a real polymorphic interface that will not break down with new versions.

Because HTTP is one of the transport mechanisms used by SOAP, a Web Service method call can be made to and from any Web-enabled computer anywhere in the world. Consequently SOAP has the potential to construct distributed computing processes on the same massive scale as the World Wide Web.

Web Services Definition Language (WSDL) is a specification for describing, communicating, and invoking programmatic functionality through a message exchange or remote procedure call—both of which use the SOAP protocol and XML encapsulated information. A WSDL document resides at a URL location and is linked to the actual program module located elsewhere. Almost any programmatic function within an orchestration, or accessed from an orchestration, can be exposed as a Web service: a database look-up, the invocation of a complex business rule, or the entire orchestration process itself. Because the public Web services interfaces are not dependent on the private implementation of the program, it is easy to construct applications that are highly modular and distributed.

Conclusion

The Business Rule Framework within BizTalk Server represents an innovative implementation of the Service Oriented Architecture (SOA) paradigm. Every individual and combined level of functionality has been designed to be exposed, independent, and capable of being loosely coupled. Any policy component (vocabulary or rule set) can be viewed or changed at any time, without affecting any other process operation or running instance of the affected process. Furthermore, policies are compiled into Visual Studio .NET assemblies directly from their semantic and declarative XML definitions, thus eliminating the need for any procedural implementation programming. The substantial development and life cycle efficiencies that this individual capability engenders are validation of the Service Oriented Architecture paradigm.

The flexibility that an exposed and componentized rule engine provides for modifying business processes is significant. In conventional application development, business rule logic is embedded in procedural code and cannot be modified without changing the code itself. And code changes, which consume both time and resources, often result in unpredictable program behavior. Clearly the ability to isolate business rules entirely from procedural code, or any process implementation mechanisms, dramatically improves the efficiencies of managing and adapting business processes in response to new requirements or business conditions.

The development process within Orchestration Designer is, in itself, a lesson in exposed functionality and loose coupling. By providing developers with the ability to visualize complex business logic and its respective implementation mechanisms, the Orchestration Designer makes software development more manageable and less abstract. Each logical process step is coupled to a discrete implementation mechanism that contains self-documenting methods. Functionally transparent and isolated, each object property within the solution (orchestrations, schemas, maps, and so forth) is accessible from the host Visual Studio .NET environment or directly through its XML representation. Furthermore, the completed orchestration can generate a Business Process Execution Language (BPEL) document of the entire process.

Because a BPEL instruction set is an XML representation of a process with a precise language and grammar structure, it provides a readable and understandable instruction set for documenting a process. The value of this cannot be overstated; historically, poor documentation prevented software and processes from being readily modified and adapted. In fact, the process shapes in Orchestration Designer symbolize basic and structured BPEL elements such as receive, invoke, sequence, flow, role, link, and source. A process developed in BizTalk Server Orchestration Designer can be exported as a BPEL document and be imported into any other BPEL-compliant application. Conversely, a BPEL document can be imported into BizTalk Server Orchestration Designer to generate an orchestration diagram. The standardized interchange of process instructions can potentially facilitate collaborative business process development between business partners.

The application of the SOA paradigm in BizTalk Server 2004 clearly illustrates how the value of XML functionality has accrued:

XML and XML Schema have enabled the creation of the Web services protocols SOAP and WSDL.

BPEL functions on top of the core Web services protocols and facilitates the inclusion of additional XML functionality (such as business rules or processing logic) within processes.

Each process is independently valuable, but when combined with other processes has the potential to facilitate wholesale efficiencies and provide innovative solutions to numerous challenging problems. It is an object lesson in the whole being greater than the sum of the parts.

Because BizTalk Server Orchestration Designer is embedded within Visual Studio .NET, it bridges two frameworks: SOA and .NET. The .NET framework consists of two main parts: the common language run time (CLR) and a unified set of class libraries. The class libraries include ASP.NET for Web applications and Web services, Windows Forms for smart client applications, and ADO.NET for loosely coupled data access. The .NET framework provides a highly productive, standards-based environment for integrating existing information technology investments with next-generation applications and services. When combined with the higher-level abstractions of XML functionality and the visual design facilities found in BizTalk Server, the result is a development and deployment environment that offers unprecedented capabilities and efficiencies. Furthermore, it provides a coherent way for developers to indoctrinate themselves in the SOA methodologies while leveraging their .NET expertise.

We are entering an era of computing where information will be detached from, and completely independent of applications but where the structure, composition and behavior of each will be fundamentally identical. Information will be generated and published without knowledge of how it will be consumed or used. Applications will both consume information and methods, and be consumed. Processes will be capable of configuring and modifying themselves. Entirely new applications, new business models and new ways in which information will define our experiences will evolve from the Service Oriented Architecture paradigm.

As with any paradigm shift, SOA must be justified by the benefits it provides. The evidence is clear. Those who have adopted the SOA development model have realized dramatic development efficiencies, accelerated return on investment, and increased resource availability. Although XML, Web services, and BPM/EAI platforms impose a new conceptual model on business process development, the technologies required to implement and deploy this model are established and proven Microsoft products that have been augmented to support this new paradigm.