Skip to main content

eWorldTree, LLC

Branch out your information network™. Link to eWorldTree™.

Go Search

Home
  

Configuration of BizTalk HTTP Adapter & Resubmit Ports for ESB Management Portal
We have published a guide that exemplifies how to configure the BizTalk HTTP Adapter as well as resubmit ports for the ESB Management Console or Portal.

Use this link or visit our document library in the BizTalk 2009 category to retrieve the PDF document.

MOVE INDEXED Statement

The MOVE INDEXED statement in NATURAL is just supported for compatibility reasons. The problem is that the most recent documentation (v4.2) does not describe the statement and does not provide an example of how it works. 

The following is a simple example that we hope it helps to document its functionality. One never knows when one will need to reengineer some “legacy+” code in NATURAL’s reporting mode.

Reporting Mode (GLOBALS SM=OFF)

RESET #CHARACTERS (A5) #INDX (N1) #CHARACTER(A1)

REDEFINE #CHARACTERS (#ALPHA (A1))

*

#CHARACTERS = 'AEIOU'

WRITE '=' #CHARACTERS

FOR #INDX 1 TO 5

  MOVE INDEXED #ALPHA <#INDX> TO #CHARACTER

  WRITE '=' #CHARACTER

CLOSE LOOP

*

FOR #INDX 1 TO 5

  MOVE INDEXED 'Z' TO #ALPHA <#INDX>

CLOSE LOOP

WRITE '=' #CHARACTERS

*

*

END

 

Output:

 

#CHARACTERS: AEIOU

#CHARACTER: A

#CHARACTER: E

#CHARACTER: I

#CHARACTER: O

#CHARACTER: U

#CHARACTERS: ZZZZZ

 

Equivalent Code in Structured Mode (GLOBALS SM=ON)

DEFINE DATA

LOCAL

1 #CHARACTERS (A5)

1 REDEFINE #CHARACTERS

  2 #CHARACTER-ARRAY (A1/5)

1 #INDX (N1)

1 #CHARACTER (A1)

END-DEFINE

*

#CHARACTERS:= 'AEIOU'

WRITE '=' #CHARACTERS

FOR #INDX 1 TO 5

  #CHARACTER := #CHARACTER-ARRAY(#INDX)

  WRITE '=' #CHARACTER

END-FOR

*

FOR #INDX 1 TO 5

  #CHARACTER-ARRAY(#INDX) := 'Z'

END-FOR

WRITE '=' #CHARACTERS

*

*

END
Set File Name dynamically using a Pipeline Component

Scenario

You would like to set the name of a destination file dynamically using a Send Pipeline. Moreover, you would like to set such name based on a message (field) element value.

Assumption

It’s possible to promote a schema field element to the ReceivedFileName property of global property schema FILE.bts_file_properties. However, in this scenario we’re assuming that such promoted value would not be available to the Send Pipeline due to additional processing steps that would reset the ReceivedFileName context property.

Solution

Create a custom pipeline component to set the ReceivedFileName message context property based on a configurable XPath Instance (node path). The following are code snippets of such pipeline component:

Note: Refer to http://msdn.microsoft.com/en-us/library/ee377071%28BTS.10%29.aspx for optimizing xml processing  inside a pipeline.

 

[ComponentCategory(CategoryTypes.CATID_PipelineComponent)]

[ComponentCategory(CategoryTypes.CATID_Encoder)]

public class SourceFileName : IBaseComponent, Microsoft.BizTalk.Component.Interop.IComponent, IComponentUI, IPersistPropertyBag

    {

 

        #region IComponent Members

        public IBaseMessage Execute(IPipelineContext pContext, IBaseMessage pInMsg)

        {

            try

            {

                string xPath = InstanceXPath;

                string propertyValue = string.Empty;

                int bufferSize = 0x280;

                int thresholdSize = 0x100000;

 

                IBaseMessageContext messageContext = pInMsg.Context;

                if (string.IsNullOrEmpty(xPath))

                {

                    throw new ArgumentException("XPath Instance is missing");

                }

                IBaseMessagePart bodyPart = pInMsg.BodyPart;

                Stream inboundStream = bodyPart.GetOriginalDataStream();

                VirtualStream virtualStream = new VirtualStream(bufferSize, thresholdSize);

                ReadOnlySeekableStream readOnlySeekableStream = new ReadOnlySeekableStream(inboundStream, virtualStream, bufferSize);

                XmlTextReader xmlTextReader = new XmlTextReader(readOnlySeekableStream);

                XPathCollection xPathCollection = new XPathCollection();

                XPathReader xPathReader = new XPathReader(xmlTextReader, xPathCollection);

                xPathCollection.Add(xPath);

                bool ok = false;

                while (xPathReader.ReadUntilMatch())

                {

                    if (xPathReader.Match(0) && !ok)

                    {

                        propertyValue = xPathReader.ReadString();

                        pInMsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", propertyValue);

                        ok = true;

                    }

                }

                readOnlySeekableStream.Position = 0;

                bodyPart.Data = readOnlySeekableStream;

            }

            catch (Exception ex)

            {

                if (pInMsg != null)

                {

                    pInMsg.SetErrorInfo(ex);

                }

 

                throw ex;

            }

            return pInMsg;

 

        }

 

        #endregion

 

        #region IPersistPropertyBag Members

 

        private string _instanceXPath;

        [

        DisplayName("%SourceFileName% XPath Instance"),

        Description("XPath Instance for %SourceFileName% macro")

        ]

        public string InstanceXPath

        {

            get { return _instanceXPath; }

            set { _instanceXPath = value; }

        }

        public void Load(IPropertyBag propertyBag, int errorLog)

        {

            string text;

            text = (string)ReadPropertyBag(propertyBag, "InstanceXPath");

            if (text != null) _instanceXPath = text;

        }

        public void Save(IPropertyBag propertyBag, bool clearDirty, bool saveAllProperties)

        {

            object val;

            val = (object)_instanceXPath;

            WritePropertyBag(propertyBag, "InstanceXPath", val);

        }

 

        #endregion

 

       

This sample pipeline component is designed to be used in the Encode stage of a pipeline.  Configure the pipeline with the desired node path (e.g. /*[local-name()='Input' and namespace-uri()='']/*[local-name()='MyElement' and namespace-uri()='']) and then specify the SourceFileName macro as part of the destination file name (e.g. %SourceFileName%_%MessageID%.xml).

ESB Fault Submission within an Orchestration

The following is a quick reference to the steps required to submit a fault message to the Exception Management Database within an orchestration:

1. Add a reference to Microsoft.Practices.ESB.ExceptionHandling and  Microsoft.Practices.ESB.ExceptionHandling.Schemas.Faults

2. Create a multi-part message type with body of type Microsoft.Practices.ESB.ExceptionHandling.Schemas.Faults.FaultMessage

- Multi-Part Message Type Identifier: ESBFaultMessageType

- Message Part Identifier: detail

3. Create a message using such multi-part message type.

- Message Identifier: esbFault

4. Construct an esbFault message as in the following example:

esbFault=Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.CreateFaultMessage();

esbFault.detail.FailureCategory=”YourCategory”

 esbFault.detail.FaultCode=”YourCode”;

esbFault.detail.FaultDescription=”Your Description”;

esbFault.detail.FaultSeverity=Microsoft.Practices.ESB.ExceptionHandling.FaultSeverity.Error;

Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.AddMessage(esbFault,messageIn);

5. Create a direct one-way send port to post the esbFault message to the MsgBox.

Things to watch for:

·         Make sure the ALL.Exceptions send port of the ESB Toolkit is up and running.

·         In a 64-bit server, run the SQL adapter handlers in a 32-bit host instance. Otherwise you’ll get an error like this:

A message sent to adapter "BiztalkMessagingEngine" on send port "ALL.Exceptions" with URI "SQL://(local)/EsbExceptionDb/" is suspended.  Error details: The send adapter for this send port is not supported on 64-bit host instances. Please make sure that the send adapter is associated with a 32-bit only handler. 

·         Check the Fault table definition in the Exception Management database. Pay attention to the length of the fields to avoid an error such as the following:

The adapter "SQL" raised an error message. Details "HRESULT="0x80040e57" Description="The statement has been terminated." HRESULT="0x80040e57" Description="String or binary data would be truncated."

 

InboundBodyPathExpression within an Orchestration

Problem

In a static solicit-response port, it is possible to handle a fault message by specifying an Inbound BizTalk message body path expression such as /*[local-name()='Fault']/*[local-name()='Detail' or local-name()='detail']/* | /*[not(local-name()='Fault')] in the Messages tab of the transport configuration (refer to Handling Fault Message). However, how can we specify this expression for a dynamic solicit-response port?

Our goal is to avoid an error similar to the following when using a dynamic solicit-response port that communicates with a WCF Service:

xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'MyService'. The service instance will remain suspended until administratively resumed or terminated.

Inner exception: Received unexpected message type 'http://schemas.xmlsoap.org/soap/envelope/#Fault' does not match expected type 'http://mydomain.com/Test/#AddItemResponse'.

Solution

Make use of WCF.InboundBodyLocation and WCF.InboundBodyPathExpression when constructing (assigning) the message that gets connected to the Request operation. Example:

messageOut(WCF.InboundBodyLocation) = "UseBodyPath";

messageOut(WCF.InboundBodyPathExpression) = "/*[local-name()='Fault']/*[local-name()='Detail' or local-name()='detail']/* | /*[not(local-name()='Fault')]";

 

If you’re wondering where the value UseBodyPath came from, we suggest you exporting and analyzing the bindings of a static solicit-response port that has equivalent configuration. A sample extract of such output follows:

<TransportTypeData>

  <CustomProps>

    <ServiceCertificate vt="8" />

    <InboundBodyLocation vt="8">UseBodyPath</InboundBodyLocation>

    <UseSSO vt="11">0</UseSSO>

    <MessageClientCredentialType vt="8">UserName</MessageClientCredentialType>

    <InboundBodyPathExpression vt="8">/*[local-name()='Fault']/*[local-name()='Detail' or local-name()='detail']/* | /*[not(local-name()='Fault')]</InboundBodyPathExpression>

  </CustomProps>

</TransportTypeData>
ESB Dynamic Endpoint Resolution inside an Orchestration

Scenario

ESB resolver connection strings (monikers) are usually specified in the Resolver Implementation Property of a Resolver in an Itinerary Service, or in the Endpoint property of an ESB Dispatcher component. However, let’s say that you have a traditional BizTalk solution with one or more orchestrations that you cannot afford to migrate to the more flexible itinerary-based processing yet. How could you leverage the use of resolver mechanisms inside an existent orchestration?

Solution

One alternative is to make a reference to Microsoft.Practices.ESB.Resolver in your orchestration-based project and then invoke the Resolve method of ResolverMgr to get the corresponding properties for a moniker. For instance, after declaring variable xmlDoc of type System.Xml.XmlDocument, and variable resolverDictionary of type Microsoft.Practices.ESB.Resolver.ResolverDictionary, you could have code similar to the following in a ConstructMessage shape:

resolverDictionary = Microsoft.Practices.ESB.Resolver.ResolverMgr.Resolve("BRE:\\policy=WcfServiceSamplePolicy;version=1.0");

xmlDoc = new System.Xml.XmlDocument();

xdoc.LoadXml(@"<ns0:RetrieveProjectList xmlns:ns0=""http://eworldtree.com/"" />");

messageOut.parameters = xmlDoc;

messageOut(WCF.Action) = resolverDictionary.Item("Resolver.TargetNamespace") + resolverDictionary.Item("Resolver.Action");

SndRcv_ProjectInventoryPort(Microsoft.XLANGs.BaseTypes.Address) = resolverDictionary.Item("Resolver.TransportLocation");

SndRcv_ProjectInventoryPort(Microsoft.XLANGs.BaseTypes.TransportType) = resolverDictionary.Item("Resolver.TransportType");

This code assumes the use of a Dynamic Request-Response port, which receives message type messageOut to initiate a request to a WCF-BasicHttp Service. The actions of the policy v1.0 are:

·         Set End Point Outbound Transport Type to WCF-BasicHttp

·         Set End Point Outbound Transport Location to http://ewt/WcfServiceSamples/ProjectInventory.svc

·         Set End Point Target Namespace to http://eworldtree.com/

·         Set End Point WCF Action to IProjectInventory/RetrieveProjectList

If there is need to override the default binding configuration of the respective transport type, something similar to the following sample configuration could be used:

resolverDictionary = Microsoft.Practices.ESB.Resolver.ResolverMgr.Resolve("BRE:\\policy=WcfServiceSamplePolicy;version 1.1");

xmlDoc = new System.Xml.XmlDocument();

xmlDoc.LoadXml(@"<ns0:RetrieveProjectList xmlns:ns0=""http://eworldtree.com/"" />");

messageOut.parameters = xmlDoc;

messageOut(WCF.Action) = resolverDictionary.Item("Resolver.TargetNamespace") + resolverDictionary.Item("Resolver.Action");

//messageOut(WCF.BindingType) = "basicHttpBinding";

messageOut(WCF.BindingType) = resolverDictionary.Item("Resolver.TransportNamespace");

messageOut(WCF.BindingConfiguration) = resolverDictionary.Item("Resolver.EndpointConfig");

SndRcv_ProjectInventoryPort(Microsoft.XLANGs.BaseTypes.Address) = resolverDictionary.Item("Resolver.TransportLocation");

SndRcv_ProjectInventoryPort(Microsoft.XLANGs.BaseTypes.TransportType) = resolverDictionary.Item("Resolver.TransportType");

The actions of the policy v1.1 are:

·         Set End Point Outbound Transport Type to WCF-Custom

·         Set End Point Outbound Transport Location to http://ewt/WcfServiceSamples/ProjectInventory.svc

·         Set End Point Target Namespace to http://eworldtree.com/

·         Set End Point WCF Action to IProjectInventory/RetrieveProjectList

·         Set End Point Config to <binding name="ProjectInventoryBinding" maxReceivedMessageSize="100000" sendTimeout="00:10:00"/>

·         Set End Point Transport Namespace to basicHttpBinding

Because there is no resolver property for binding type, note that we decided to use Resolver.TransportNamespace to dynamically assign the binding type value (it would be great if Microsoft could add such a property in the future).  A list of current ESB Resolver Properties follows:

Resolver.Action

Resolver.ActionField

Resolver.DocumentSpecName

Resolver.DocumentSpecStrongName

Resolver.EndpointConfig

Resolver.EpmRRCorrelationToken

Resolver.FixJaxRpc

Resolver.InboundTransportLocation

Resolver.InboundTransportType

Resolver.InterchangeId

Resolver.IsRequestResponse

Resolver.MessageExchangePattern

Resolver.MessageType

Resolver.MethodName

Resolver.OutboundTransportCLSID

Resolver.ReceiveLocationName

Resolver.ReceivePortName

Resolver.Success

Resolver.TargetNamespace

Resolver.TransformType

Resolver.TransportLocation

Resolver.TransportNamespace

Resolver.TransportType

Resolver.WindowUserField

 

Using EndPointConfig (Set EndPoint Config) to specify Binding properties for ESB Resolvers

Scenario

You need to specify binding properties as part of the endpoint configuration of a resolution mechanism. For instance, let’s assume that you’d like to override the default maxReceivedMessageSize and sendTimeout values as in the following WCF configuration snippet (part of a WCF sample that retrieves a list of projects):

<services>

      <service behaviorConfiguration=EWT.WCF.ServiceSamples.ProjectInventoryBehavior

        name=EWT.WCF.ServiceSamples.ProjectInventory>

        <endpoint  address=”” binding=basicHttpBinding bindingName=ProjectInventoryBinding contract=EWT.WCF.ServiceSamples.IProjectInventory >

          <identity>

            <dns value=localhost />

          </identity>

        </endpoint>

      </service>

</services>

<bindings>

      <basicHttpBinding>

        <binding name=ProjectInventoryBinding maxReceivedMessageSize=100000 sendTimeout=00:10:00/>

      </basicHttpBinding>

</bindings>

Examples for STATIC Resolver

If using the STATIC resolver in an ESB Dispatcher pipeline component, you could use something similar to:

STATIC:\\transportType=WCF-BasicHttp;

transportLocation=http://ewt/WcfServiceSamples/ProjectInventory.svc;

action=IProjectInventory/RetrieveProjectList;

endpointConfig=MaxReceivedMessageSize=100000&SendTimeout=00:10:00;

jaxRpcResponse=false;messageExchangePattern=;

targetNamespace=http://eworldtree.com/;transformType=;

You could also use something like this:

STATIC:\\transportType=WCF-Custom;

transportLocation=http://ewt/WcfServiceSamples/ProjectInventory.svc;

action=IProjectInventory/RetrieveProjectList;

endpointConfig=BindingConfiguration=<binding name=”ProjectInventoryBinding” maxReceivedMessageSize=”100000” sendTimeout=”00:10:00”/>&BindingType=basicHttpBinding;

jaxRpcResponse=false;messageExchangePattern=;

targetNamespace=http://eworldtree.com/;transformType=;

Note: Although transport type is specified as WCF-Custom, note that the binding type is configured as basicHttpBinding. It works!

Example for BRE Resolver

Deploy a policy/rule with actions similar to:

·         Set End Point Outbound Transport Type to WCF-BasicHttp

·         Set End Point Outbound Transport Location to http://ewt/WcfServiceSamples/ProjectInventory.svc

·         Set End Point Target Namespace to http://eworldtree.com/

·         Set End Point WCF Action to IProjectInventory/RetrieveProjectList

·         Set End Point Config to MaxReceivedMessageSize=100000&SendTimeout=00:10:00

Then make use of the corresponding moniker in the endpoint of the pipeline component (e.g. BRE:\\policy=WcfServiceSamplePolicy).

Dynamic Endpoint Resolution with ESB Dispatcher (ESB Toolkit 2.0)

We have published a guide that exemplifies how to use the ESB Dispatcher pipeline component to dynamically resolve an endpoint location.

 

Use this link or visit our document library in the BizTalk 2009 category to retrieve the PDF document.

400 Bad Request errors in ESB Management Console (ESB.Portal)

Problem

The following error is displayed when launching the ESB Management Console:

The remote server returned an error: (400) Bad Request.

Possible Solutions

-          Verify that ASP.NET Impersonation is enabled for the ESB.Portal virtual directory.

 

-          Double check DB connection strings not only in the Web.config of the ESB.Portal but also in the configuration files of other projects that form part of the Management Portal directory (ESB.AlertService, ESB.BAM.Service, ESB.Exception.Service, and ESB.UDDI.PublisherService).  For instance, the 400 Bad Request is triggered if there is an incorrect EsbExceptionDbConnectionString in the Web.config file of the ESB.Exceptions.Service.

 

Such incorrect value causes a System.ServiceModel.ProtocoException in the GetUserSettings method of the following ESB.Portal fuction (PortalHelper.cs):

       public static void LoadUserSettingsToSession(HttpContext context)

       {

            IExceptionService client = null;

            try

            {

                client = PortalHelper.GetExceptionService();

                                                                List<UserSetting> settings = client.GetUserSettings(context.User.Identity.Name);

                context.Session.Clear();

                foreach (UserSetting u in settings)

                {

                    context.Session.Add(u.SettingName, u.SettingValue);

                }

            }

            finally

            {

                if (client != null)

                {

                    ((IDisposable)client).Dispose();

                }

            }

        }

 

Exception Handling BAM Tracking (Could not load file or assembly Microsoft.SqlServer.ASTasks)

Problem

As part of the ESB Toolkit 2.0 core installation, the BM command that installs the Exception Handling BAM Tracking fails with an error similar to the following:

Log Name:      Application

Source:        BamManagementUtility

Description:

Microsoft.BizTalk.Bam.Management.BamManagerException: The BAM deployment failed. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.ASTasks, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

WRN: Assembly binding logging is turned OFF.

To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

Note: There is some performance penalty associated with assembly bind failure logging.

To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Possible Solution

Refer to http://integrationexperts.wordpress.com/2010/01/04/missing-microsoft-sqlserver-astasks-with-configuring-bam-views/

This reference suggests installing SQL Server Integration Services to fix the error. However, to avoid installing the full version of SQL Server Integration Services , make a copy of  Microsoft.Sqlserver.astasks.dll from your SQL Server  and paste it to c:\program files (x86)\microsoft sql server\100\DTS\Tasks.  Then register this ddl to the assembly cache.

 

Note:  It’s been assumed that the ESB Server and the SQL Server are installed in different machines.

1 - 10 Next

 ‭(Hidden)‬ Admin Links