BizTalk: Invoke ReSTful Web Services with BizTalk Server 2010

This article presents a workable solution for consuming ReSTful services using BizTalk Server 2010.

http://social.technet.microsoft.com/wiki/contents/articles/2474.invoke-restful-web-services-with-biztalk-server-2010.aspx

Azure Integration Services: BizTalk Functoids vs Map Operations

The Mapper in the Azure Integration Services CTP looks much improved from the BizTalk version. Although the Azure Mapper looks similar in many ways it has some key differences that should make the mapping experience much better, especially when considering the edge cases that creep into many maps.

Comparisons of BizTalk Functoids and Azure Map Operations are below. Also note that the documentation for the new Map Operations is here:

http://msdn.microsoft.com/en-us/library/windowsazure/hh689870.aspx

String

There’s little change here with the same operation appearing in both mappers.

image image

Scientific

It appears that the Scientific Functoids have been removed.

image  

Cumulative

A new Cumulative Count operation makes an appearance.

image image

Conversion

These basic conversion functions don’t appear in the new mapper. Were they ever used?

image  

Mathematical

Mathematic functoids have been removed and replaced by an Arithmetic Expression operation.

image image

The arithmetic operations supported by the new Map Operation include:

  • Addition
  • Subtraction
  • Multiplication
  • Division
  • Modulo
  • Absolute Value
  • Maximum
  • Minimum
  • Round
  • Square Root

Within the Arithmetic Expression Operator you can then create a formula using the linked inputs. This makes a lot of sense because anything remotely complex in a BizTalk map would require either a large number of separate Functoids causing a spaghetti map or a call out to an external assembly.

Logical

Logical functoids have been replaced by a single Logical Expression Map Operation

image

image

The logical operations supported by the new Map Operation include:

  • >
  • <
  • >=
  • <=
  • ==
  • !=
  • Logical Negation (!)
  • Conditional AND (&&)
    Conditional OR (||)

Similar to the Arithmetic Expression Map Operation you can create a logical formula using the linked inputs. Again this makes a lot of sense to improve maintainability and simplify the construction of logic within a map.

Date/Time

The Date/Time Functoids have been overhauled and now look more useful, especially the reformatting operation.

image

image

Advanced

Here’s where the story gets more complicated. The Advanced Functoids in BizTalk are a hotchpotch of helper functoids each with very different functionality so they need further classification.

Looping Structure Functoids

These Functoids control the looping structures used to map from the source to the target document. The new mapper introduces much better control over the looping structures and should help deal with some of those edge cases where custom XSLT is used. It doesn’t make sense to try a like for like comparison between new and old  in this case. Much better to look at this article:

Grouping and Sorting in the New Azure Transform Designer

Extensibility

The Scripting Functoid has no direct equivalent yet in the new mapper. According to the forums (No Scripting Map Operation/Functoid?), this will be rectified in another release.

image  

BizTalk: Continuous Integration

This sample code outlines how to set up Continuous Integration, Automated Unit Tests, and to create an MSI Package using Team Foundation Server 2008 (TFS) with BizTalk Server 2009.

Setting Up Continuous Integration, Unit Tests, and MSI Creation in BizTalk 2009 Sample Code
http://www.biztalkgurus.com/media/p/23834.aspx

 

ESB Toolkit: Deploy Error: BAMStarSchema

Task

Deploying Exceptions Activity to BAM.

Bm.exe deploy-all -DefinitionFile:"C:\Program Files\Microsoft BizTalk ESB Toolkit 2.0\Bam\Microsoft.BizTalk.ESB.BAM.Exceptions.xml"

Problem

Getting this error:

OLE DB error: OLE DB or ODBC error: Cannot open database "BAMStarSchema" requested by the login. The login failed.; 42000.

Solution

Your SQL Server service account has to have read/write access to your BAMStarSchema database. Try adding this user to the database with db_owner role membership.

WCF Adapter: System.ServiceModel.AddressAccessDeniedException

Getting this error when hosting a WCF Service in a BizTalk Host?

System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL http://+:4044/SiteRegistrationService/service.svc/

Use this command in the command line:

netsh http add urlacl url=http://+:4044/SiteRegistrationService user=\biztalk
where

\biztalk is the BizTalk host account (DOMAIN\USER)
http://+:4044/SiteRegistrationService is the URL of your service

 

The full error looks something like this:


Event Type: Error
Event Source: BizTalk Server 2009
Event Category: (1)
Event ID: 5644
Date: 31/10/2009
Time: 12:58:22
User: N/A
Computer: WIN-3JWZSZTRVS9
Description:
The Messaging Engine failed to add a receive location "Receive Location1" with URL "http://localhost:4044/SiteRegistrationService/service.svc" to the adapter "WCF-Custom". Reason: "System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL http://+:4044/SiteRegistrationService/service.svc/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details). ---> System.Net.HttpListenerException: Access is denied
at System.Net.HttpListener.AddAll()
at System.Net.HttpListener.Start()
at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
--- End of inner exception stack trace ---
at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
at System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open()
at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfReceiveEndpoint.Enable()
at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfReceiveEndpoint..ctor(BizTalkEndpointContext endpointContext, IBTTransportProxy transportProxy, ControlledTermination control)
at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfReceiver`2.AddReceiveEndpoint(String url, IPropertyBag adapterConfig, IPropertyBag bizTalkConfig)".
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

 

FILE Adapter: Macros

Nothing new here. Just a handy reference so I don’t keep forgetting what they are.

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 the message context property BTS.DestinationParty.
%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 the extension and excludes the file path, for example, Sample.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 a message was received on an adapter other than the File adapter, 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.
%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).

Also see… Restrictions on Using Macros in File Names

SMTP Adapter: Attachment Filename : Custom Pipeline

When using the SMTP adapter, you need to do some special tinkering if you want to ensure that you attached message part has a sensible name.

Other blog posts cover how to do this from an orchestration but if you want to, say, receive a message from a file location sending it directly to the SMTP adapter with a name other than “body.dat” (or similar) you’ll need a pipeline component.

Here are some snippets:

  1. In your pipeline project, reference Microsoft.BizTalk.GlobalPropertySchemas (C:\Program Files\Microsoft BizTalk Server 2006\Microsoft.BizTalk.GlobalPropertySchemas.dll)
  2. Declare a static variable in your custom pipeline component that references the MIME.FileName property:
    private static Microsoft.XLANGs.BaseTypes.PropertyBase attachmentFileNameProperty = new MIME.FileName();

    This makes life slightly easier – you won’t have to look up any namespaces or property names. You can also do this for loads of other properties including your own.

  3. On your message, you’ll need to set PartPropeties (rather than the message Context properties)So it’s something like this:
    pInMsg.BodyPart.PartProperties.Write(attachmentFileNameProperty.QName.Name, attachmentFileNameProperty.QName.Namespace, Path.GetFileName(fileName));

    where

    pInMsg is the message you are using in the pipeline
    PartProperties is the a collection of context properties for the message part
    fileName is the new name you want from the file, maybe determined from the received file name if you're using the file adapter.

  4. Once this message hits the SMTP adapter, it will attach the message with the name you specified in fileName as long as you’ve specified the Attachment Settings correctly.
Follow

Get every new post delivered to your Inbox.