In my opinion there are a lack of documentation, or good documentation and many of the existing one is obsolete, regarding some topics/feature of BizTalk Server – Microsoft BizTalk Accelerator for RosettaNet is one of them.

Today while I was trying to extend Microsoft BizTalk 2013 Accelerator for RosettaNet (BTARN) with a new receive Partner Interface Process (PIP) schema I was receiving the following error in the event log:

Source module:
RNDisAssembler

Correlation information:

Description:
Receive pipeline rejected incoming message due to the following RNIF exception:
UNP.SCON.VALERR: A failure occurred while validating the service content.

Details:
The document specification <MyNamespace.MyPIP> from assembly <MyAssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=…> failed to load. Verify the schema for this document specification is deployed and is in the Global Assembly Cache.

Note: this same error can occur in previous or new versions of BizTalk Server.

Based on the received error and according to a possible cause described by Microsoft at Troubleshooting: Microsoft BizTalk Accelerator for RosettaNet Issues and Resolutions either the document namespace or the root node property the deployed schema for the instance that you are trying to extend is incorrect.

In fact this could be the issue but I found really odd because in the error details my DLL, containing the schema that I was trying to extend, was being properly referenced, nevertheless I confirmed that it was properly deployed… But as I suspected this wasn’t my problem.

Note: this behavior does not happen with PIP that include out-of-the-box with BTARN (in the Microsoft.Solutions.BTARN.Schemas.RNPIPs dll) only with new ones and only in the incoming process.

Microsoft-Solutions-BTARN-Schemas-RNPIPs

Fortunately for us we have an extended BizTalk Server: List of Errors and Warnings, Causes, and Solutions at TechNet Wiki, I usually update with some frequency and that I used as a reference, which gave me some clues to the final solution. Nick Heppleston mention in his blog that:

“RN Disassembler does in-fact attempt to validate the message contained within the Service Content against a deployed schema just like the standard XmlDisassembler. The message that our trading partner was sending did not validate and hence the RosettaNet Accelerator threw this error message; once we had corrected the schema and redeployed, the error went away.

This is certainly one to be aware of if you are developing custom PIP’s to use with the RosettaNet Accelerator: ensure that the message in the Service Content validates against your custom PIP schema”

Again this isn’t my problem, because the Schema was properly deployed in the system, I only mention this because is important for understanding how the BTARN engine/processes works.

CAUSE

By default BTARN App Pool Settings are configured to use .NET framework 2.0, doesn’t enable 32-bit applications and the application pool is in Classic mode

BTARN-App-Pool-default-Settings

Important for you to know is that the accelerator requires both an in-process and out of process host, both of which must be marked as "Authentication Trusted" and "32-bit only".

To run the BTARN End to End scenario you need two important things:

  • Enable the BTARN Application Pools for 32 bit.
  • Add a HTTP Handler for *.dll refering the IsapiModule Filters.

But what I found today is that when you want to extend BTARN with new incoming PIP’s, the artifacts generated are going to be .NET 4.0/4.5 unless Visual Studio is configured to do otherwise, which we really cannot control using BizTalk projects:

re-targeting-Visual-Studio-BizTalk-Projects-error

This means along with setting the application pools for the 32-bit the .NET setting must be set to match.

SOLUTION

To solve this issue you must:

  • Type “Internet Information Services (IIS) Manager” or “IIS” in the Windows Start screen and click in “Internet Information Services (IIS) Manager” option on Apps menu.
  • Expand the server and click on “Application Pools” to display available application pools in center panel.
  • Right-click on “BTARNAppPool” and select “Advanced Settings”.
  • On the “Advanced Settings” window:
    • Change the value of “.NET Framework version” from “v2.0” to “v4.0”.
  • Change the value of “Enable 32-bit Applications” from “False” to “True”.
  • And then click “OK”.

BTARN-App-Pool-correct-Settings

Advice: you should do the same for the “BTARNHttpReceivePool” application pool

After I fix these configurations I was able to successfully receive the PIP message from my external Partner.

Credits to LemMotlo – BTARN App Pool Settings for BizTalk 2010

Last week while trying to generate from Visual Studio 2013 a schema of a custom SAP IDOC by:

  • Right-click your BizTalk Server project, and then choose “Add | Add Generated Items | Consume Adapter Service”.
  • In the “Consume Adapter Service” Add-in screen, select the sap adapter binding.
  • You should set the connection URI to SAP server and after that click “Connect
  • From the “Select contract type” drop-down list, select “Service (Inbound operations)” option
  • In the “Select a category” box, expand the IDOC node and select the IDOC that you want to retrieve, to see the IDOC message types in the “Available categories and operations” box.
  • From the “Available categories and operations”, add the “Receive” operation to the "Added categories and operations" by selecting the operation and click the “Add” button
  • And finally click “Ok” to generate the IDOC SAP schema

I got the following error:

“Error while retrieving or generating the WSDL. Adapter message: Details: ErrorCode=RFC_EXCEPTION. ErrorGroup=RFC_ERROR_APPLICATION_EXCEPTION. SapErrorMessage=SEGMENT_UNKNOWN. AdapterErrorMessage=Error returned by RfcCallReceiveEx while calling RFC: IDOCTYPE_READ_COMPLETE..

Microsoft.Adapters.SAP.RFCException: Details: ErrorCode=RFC_EXCEPTION. ErrorGroup=RFC_ERROR_APPLICATION_EXCEPTION. SapErrorMessage=SEGMENT_UNKNOWN. AdapterErrorMessage=Error returned by RfcCallReceiveEx while calling RFC: IDOCTYPE_READ_COMPLETE..”

Server stack trace:

at Microsoft.Adapters.SAP.RFCException.HelperThrow(Int32 retCode, String additionalErrorMessage)
at Microsoft.Adapters.SAP.RfcOutboundInvoker.Invoke()
at Microsoft.Adapters.SAP.InternalIdocMetadata..ctor(String idocType, String cimType, String release, String version, MetadataLookup metadataLookup, SAPConnection sapConnection, TimeoutHelper timeoutHelper)
at Microsoft.Adapters.SAP.SAPMetadataContract.ResolveTypeMetadata(String typeId, TimeSpan timeout, TypeMetadataCollection& extraTypeMetadataResolved)
at Microsoft.ServiceModel.Channels.Common.Design.MetadataCache.GetTypeMetadata(String uniqueId, Guid clientId, TimeSpan timeout)
at Microsoft.ServiceModel.Channels.Common.MetadataLookup.GetTypeDefinition(String typeId, TimeSpan timeout)
at Microsoft.Adapters.SAP.SapIdocMetadata..ctor(String absName, String idocType, String cimType, String release, String version, SAPConnection sapConnection, Boolean generateFlatFileCompatibleIdocSchema, Boolean segmentTypeInFlatFileAnnotation, MetadataLookup metadataLookup, TimeoutHelper timeoutHelper)
at Microsoft.Adapters.SAP.SAPMetadataContract.ResolveTypeMetadata(String typeId, TimeSpan timeout, TypeMetadataCollection& extraTypeMetadataResolved)
at Microsoft.ServiceModel.Channels.Common.Design.MetadataCache.GetTypeMetadata(String uniqueId, Guid clientId, TimeSpan timeout)
at Microsoft.ServiceModel.Channels.Common.MetadataLookup.GetTypeDefinition(String typeId, TimeSpan timeout)
at Microsoft.Adapters.SAP.IdocOperationMetadata.ExportXmlSchema(XmlSchemaExportContext schemaExportContext, MetadataLookup metadataLookup, TimeSpan timespan, OperationParameterDirection direction)
at Microsoft.Adapters.SAP.IdocOperationMetadata.ExportInputXmlSchema(XmlSchemaExportContext schemaExportContext, MetadataLookup metadataLookup, TimeSpan timespan)
at Microsoft.ServiceModel.Channels.Common.Design.WsdlBuilderHelper.AddOperationSchema(OperationMetadata operationMetadata, TimeSpan timeout)
at Microsoft.ServiceModel.Channels.Common.Design.WsdlBuilder.SearchBrowseNodes(MetadataRetrievalNode[] nodes, WsdlBuilderHelper helper, TimeoutHelper timeoutHelper)
at Microsoft.ServiceModel.Channels.Common.Design.WsdlBuilder.GenerateOperationSchemas(WsdlBuilderHelper helper, MetadataRetrievalNode[] nodes, TimeSpan timeout)
at Microsoft.ServiceModel.Channels.Common.Design.WsdlBuilder.GetWsdl(MetadataRetrievalNode[] nodes, Uri uri, TimeSpan timeout)
at Microsoft.Adapters.SAP.SapCustomWsdlRetrieval.GetWsdl(MetadataRetrievalNode[] nodes, Uri uri, TimeSpan timeout)
at Microsoft.ServiceModel.Channels.Common.Design.MetadataExchanger.ProcessMetadataGet(Message message, Uri target, TimeSpan timeout, MetadataLookup metadataLookup)
at Microsoft.ServiceModel.Channels.Common.Design.MetadataExchanger.ProcessMetadataMessage(Message message, Uri target, TimeSpan timeout, MetadataLookup metadataLookup, Message& replyMessage)
at Microsoft.ServiceModel.Channels.Common.Channels.AdapterRequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.ServiceModel.Channels.IMetadataRetrievalContract.GetMetadata(MetadataRetrievalNode[] nodes)
at Microsoft.ServiceModel.Channels.Tools.MetadataSearchBrowse.MetadataPanel.GetWsdl(MetadataRetrievalNode[] nodes)
at Microsoft.ServiceModel.Channels.Tools.MetadataSearchBrowse.MetadataUserControl.GetWsdl()

BizTalk-Generating-SAP-schema-Error-while-retrieving-generating-WSDL

CAUSE

The SAP adapter uses the IDOCTYPE_READ_COMPLETE RFC to retrieve the metadata for the Receive operation for an IDOC. Invoking this RFC requires specific user permissions in the SAP system. To generate metadata, if you have connected to the SAP system using a credential that does not have permission to invoke the IDOCTYPE_READ_COMPLETE RFC, the SAP adapter gives an error.

So in order to demystify problems you should:

  • Make sure that your connection URI are well set
  • And you should try to import a schema from a standard IDOC, like INVOIC01, STATUS or ORDER01

If you are unable to import the schemas then you have a different problem from what I’m addressing here and you probably need to contact your SAP team to try to diagnose the problem, it probably may be lack of permissions. But normally in this cases you will receive a:

  • SapErrorMessage= OBJECT_UNKNOWN.

In my case I was able to import all the standard IDOC from SAP, however as I stated before I was trying to import the schema from a custom SAP IDOC created by my customer and I got instead a:

  • SapErrorMessage=SEGMENT_UNKNOWN

Which means, that while importing the IDOCTYPE_READ_COMPLETE RFC was not properly identifying some segments of the IDOC.

After validating with my SAP team we realize that some segments were not in the state “released” in SAP, this may not be the correct SAP interface logic but just to give you an idea here are some SAP print screens:

SAP-Set-release-custom-segment

Note: that all custom segments used in the IDOC must be released in SAP before you can import and use them in BizTalk Server.

SOLUTION

Well the only solution is to contact you SAP team and they must be sure that all segments of the IDOC that you are trying to import are released correctly.

Unfortunately we don’t have the segment information in question, but more likely it is some custom segment that they created.

After many requests and many postponements, due to my unavailability and free time to take these tasks, BizTalk Scheduled Task Adapter is finally officially available (version 5.0) and optimized for BizTalk Server 2013 R2!

You can download this new version of the adapter in BizTalk Scheduled Task Adapter CodePlex project page:

The BizTalk Scheduled Task Adapter is an in-process receive adapter that executes a prescribed task on a daily, weekly or monthly schedule. The adapter is configured entirely within BizTalk, all configurations is stored within the SSODB and can be exported and imported via binding files.
The schedule capabilities are similar to those available with the Windows Scheduled Task Service.

In this new version and despite additional custom tasks can be created and I’m planning on adding more, we still have the same four simple tasks present in previous editions:

  • XmlStringStreamProvider – generates a BizTalk message from a configured Xml string
  • FileStreamProvider – generates a BizTalk message from the contents of a file
  • HttpDownload – generates a BizTalk message from data downloaded from a web site
  • SQLStreamProvider – generates a BizTalk message from the contents of a SQL Query (similar to the old SQL adapter)

 

BizTalk Scheduled Task Adapter Release 5.0 for BizTalk Server 2013 R2

Requirements

The Scheduled Task Adapter v5.0 is optimized and designed to be used with BizTalk Server 2013 R2 (Compiled in .NET Framework 4.5).

V5.0 Change log

  • Compiled in Visual Studio 2013 and .NET Framework 4.5.
  • Optimized for BizTalk Server 2013 R2.
  • Support for 32 and 64 bit Host Instances.
  • Bug fixes
    • Bug: Issues multiple messages for timespan with more than 60 seconds – Solved

BizTalk-Server-2013-R2-BizTalk-Scheduled-Task-Adapter-v5.0-timespan

    • Bug: XmlStringStreamProvider task page properties not showing XML Text Editor Box – Solved
    • Bug: FileStreamProvider task page properties not showing Open File Dialog Box – Solved
    • Bug: SQLStreamProvider task page properties not showing Data Link properties Box to easy configure the SQL Connection string – Solved
    • Bug: Find task window showing all task components disabled – Solved
  • Improvements
    • SQLStreamProvider task now enables you to define SQL Timeout property – credits to MACoronado
    • Tasks Properties are now better organized and with better descriptions

BizTalk-Server-2013-R2-BizTalk-Scheduled-Task-Adapter-v5.0

Release History

This adapter is available since BizTalk Server 2004.

  • Release 5.0: release in February 18 2015 by Sandro Pereira, this adapter was tested to work on BizTalk Server 2013 R2. Compiled in .NET Framework 4.5
  • Release 4.0: release in June 12 2012 by Sandro Pereira, this adapter was tested to work on BizTalk Server 2010. Compiled in .NET Framework 4.0
  • Release 3.0: release in Aug 10 2010 by Greg Forsythe, this adapter was tested to work on BizTalk Server 2009. Compiled in .NET Framework 2.0
  • Release 2.0: last release in Apr 20 2008 by Greg Forsythe, this adapter works with BizTalk Server 2006 and BizTalk Server 2006 R2. Compiled in .NET Framework 2.0
  • Release 1.02: last release in Apr 20 2008 by Greg Forsythe, this adapter works with BizTalk Server 2004, BizTalk Server 2006 and BizTalk Server 2006 R2. Compiled in .NET Framework 1.1

 

Download

You can download this new version of the adapter in BizTalk Scheduled Task Adapter CodePlex project page:

A few days ago I wrote a post about these same warning messages from WCF-SAP Adapter: The adapter "WCF-SAP" raised an error message. Details "System.ServiceModel.CommunicationObjectFaultedException: The communication object, Microsoft.Adapters.Internal.LayeredChannelBindingElement.LayeredInboundChannel cannot be used for communication because it is in the Faulted state.

The adapter "WCF-SAP" raised an error message. Details "Microsoft.Adapters.SAP.RFCException: Details: ErrorCode=RFC_INVALID_HANDLE. AdapterErrorMessage=An exception has occurred on the listener while executing RfcWaitForRequest..

The adapter "WCF-SAP" raised an error message. Details "The WCF service host at address "sap://CLIENT=[SAPClientID];LANG=[LANG];@A/[SAPServer]/[SystemID]?ListenerGwServ=[GWServer]&ListenerGwHost=[GwHost]&ListenerProgramId=[ProgID]&RfcSdkTrace=True&AbapDebug=False" has faulted and as a result no more messages can be received on the corresponding receive location. To fix the issue, BizTalk Server will automatically attempt to restart the service host."

The adapter "WCF-SAP" raised an error message. Details "System.ServiceModel.CommunicationObjectFaultedException: The communication object, Microsoft.Adapters.Internal.LayeredChannelBindingElement.LayeredInboundChannel`1[System.ServiceModel.Channels.IReplyChannel], cannot be used for communication because it is in the Faulted state.

I told at the time that this are generic error messages and does not provide what is really the problem.

These warnings occurs, normally, when BizTalk is trying to connect to a SAP system to receive the IDOC and, again, most of the times these are related with connectivity issue or permissions between BizTalk and SAP.

CAUSE

Normally, the reason for these warnings could be any of the following options:

  • There may be a problem with the SAP system.
  • Maybe BizTalk Server don’t have the proper authorization to connect with that particular SAP program id
    • Check my previous post here
  • Also some times is a configuration problem in the Receive Location in your BizTalk Server

There are some options for you to try to find more details about this warnings:

  • You can use external tools, like Wireshark, to dig deep into network traffic and inspect individual packets for clues
  • You may enable the RfcSdkTrace in the WCF-SAP port configuration to be able to see all the traces.
  • Or another useful option is to setup WCF tracing to see the underlying error.

But what I realized today is that sometimes this warnings may occur and none of the assumptions described above fit into the actual problem.

While I was migrating and configuring one BizTalk solution, I forgot to start the incoming IDOC subscriber (in this case an orchestration) which caused my messages to stay Suspended in a Non-resumable way, raising a “no subscribers were found” error

The Messaging engine failed to process a message submitted by adapter:WCF-SAP Source URL: sap://CLIENT=[SAPClientID];LANG=[LANG];@A/[SAPServer]/[SystemID]?ListenerGwServ=[GWServer]&ListenerGwHost=[GwHost]&ListenerProgramId=[ProgID]&RfcSdkTrace=True&AbapDebug=False. Details: The published message could not be routed because no subscribers were found. This error occurs if the subscribing orchestration or send port has not been enlisted, or if some of the message properties necessary for subscription evaluation have not been promoted. Please use the Biztalk Administration console to troubleshoot this failure.

And as you can see in the print screen bellow this error will generate also the appearance of the WCF-SAP warnings in the event viewer… although there is no problem in connectivity between BizTalk and SAP, and all the messages (IDOC) are being received and reached BizTalk

BizTalk-Server-2013-R2-WCF-SAP-Warnings-Event-Viewer-why

SOLUTION

In this particular case the solution is really simple, just create, or set correctly, one subscribe (Orchestration or send port with a filter) for the incoming IDOCs.

Is nothing new that in the last weeks I been busy performing BizTalk projects migrations from BizTalk Server 2006 R2 to 2013 R2 and, unintentionally, it seems that I can pick up and detect all the “bugs”, problems or limitations that you might imagine… or not. The good news is that I have several topics to write about it in my blog, as you may have noticed by my recent posts.

As a BizTalk Developer when you create a new BizTalk Solution, or open an existing one, you are used to have the BizTalk solution deploy option, of course in your development environment, which will allow you to easily deploy the entire BizTalk Solution directly from Visual Studio to your BizTalk Server runtime:

BizTalk-Server-2013-R2-Visual-Studio-2013-Deploy-Solution

During these weeks I notice that when I migrated an old BizTalk Solution from Visual Studio 2005 (BizTalk Server 2006 R2 Solution) to Visual Studio 2013 (BizTalk Server 2013 R2 Solution), I will soon talk about this topic in my blog – project migration, I realized that the “Deploy Solution” option did not appear in the context menu of my Visual Studio Solution:

BizTalk-Server-2013-R2-Visual-Studio-2013-without-Deploy-Solution

CAUSE

Visual Studio allow you to store different configurations of solution and project properties to use in different kinds of builds. To create, select, modify, or delete a configuration, you can use the Configuration Manager option present in the solution context menu.

A solution configuration specifies how projects in the solution are to be built and deployed. And by default when you create a new BizTalk Solution, or add a new BizTalk project to an existent solution, the “Build” and “Deploy” options are selected for the new project.

BizTalk-Server-2013-R2-Visual-Studio-2013-solution-configuration

However, sometimes when we update (migrate) an old Visual Studio Solution to a newer one, in this case Visual Studio 2005 to Visual Studio 2013, some of this configurations may disappear, or may not be present. The curious thing is that:

  • if the “Build” option is not select in the solution configuration, the “Build Solution” option continues to appear in the solution context menu, but it does do anything;
  • But if the “Deploy” option is not select in the solution configuration, the “Deploy Solution” doesn’t appear in the solution context menu;

BizTalk-Server-2013-R2-Visual-Studio-2013-solution-Configuration-Manager

SOLUTION

To solve this problem you must select the Deploy option in your solution configuration, for that you must:

  • In Visual Studio, right-click in your BizTalk Solution and select “Configuration Manager…” option from the context menu

BizTalk-Server-2013-R2-Visual-Studio-2013-solution-Configuration-Manager-option

  • On the “Configuration Manager” window, in the “Project contexts” pane, for every project, select the Configuration and Platform you want, and select whether to Build it and whether to Deploy it.
    • In this case make sure that “Deploy” is selected

BizTalk-Server-2013-R2-Visual-Studio-2013-solution-Configuration-Manager-deploy-option

Right-click in your BizTalk Solution and the “Deploy Solution” will now be available.

BizTalk-Server-2013-R2-Visual-Studio-2013-Deploy-Solution-final

In the last few weeks I have been playing around with WCF-SAP adapter, I have many thing to write about it in terms of installation, configuration, communication and so on but I will start with this topic/problem.

While trying to create a WCF-SAP Receive port to be able to listener incoming IDOC from SAP system and despite the receive location be and stay enable in the BizTalk Administration Console I soon realized that the documents were not being picked up by BizTalk.

When I consulted the Event Viewer to check if there were additional information about the causes that were happening I found this three warning messages:

“The adapter "WCF-SAP" raised an error message. Details "System.ServiceModel.CommunicationObjectFaultedException: The communication object, Microsoft.Adapters.Internal.LayeredChannelBindingElement.LayeredInboundChannel`1[System.ServiceModel.Channels.IReplyChannel], cannot be used for communication because it is in the Faulted state.
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Close()
at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.Close()".

“The adapter "WCF-SAP" raised an error message. Details "The WCF service host at address "sap://CLIENT=[SAPClientID];LANG=[LANG];@A/[SAPServer]/[SystemID]?ListenerGwServ=[GWServer]&ListenerGwHost=[GwHost]&ListenerProgramId=[ProgID]&RfcSdkTrace=True&AbapDebug=False" has faulted and as a result no more messages can be received on the corresponding receive location. To fix the issue, BizTalk Server will automatically attempt to restart the service host."

“The adapter "WCF-SAP" raised an error message. Details "Microsoft.Adapters.SAP.RFCException: Details: ErrorCode=RFC_FAILURE. AdapterErrorMessage=An exception has occurred on the listener while executing RfcWaitForRequest..
at Microsoft.ServiceModel.Channels.Common.Design.AdapterAsyncResult.End()
at Microsoft.ServiceModel.Channels.Common.Channels.AdapterReplyChannel.EndTryReceiveRequest(IAsyncResult result, RequestContext& requestContext)
at Microsoft.Adapters.Internal.LayeredChannelBindingElement.LayeredInboundChannel`1.
System.ServiceModel.Channels.IReplyChannel.EndTryReceiveRequest(IAsyncResult result, RequestContext& context)
at System.ServiceModel.Dispatcher.ReplyChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)”

BizTalk-WCF-SAP-Adapter-Event-Viewer-warnings

CAUSE

Well. unfortunately this errors are generic error messages and does not provide what is really the problem.

So my advice is to first check all the port configurations for any possible configuration mistakes. After that you should use external network tools that let you dig deep into network traffic and inspect individual packets, for example Wireshark.

On this particular case I found that the BizTalk Server didn’t have the proper authorization to connect with that particular SAP program id:

ERR*.1.registration of tp [PROGRAM ID] from host [BIZTALK SERVER] not allowed.720.SAP-Gateway.721.2.gwxxrd.c.3644..Thu Feb  5 18:46:11 2015….33844.SAP-Gateway on host [SAP SERVER] / [GWServer]…..*ERR*.

BizTalk-WCF-SAP-Adapter-wireshark-monitoring

SOLUTION

Unfortunately, I’m not a SAP expert and I don’t know exactly what to do in SAP, what I can tell you is that there is nothing wrong in your configuration, this is not a BizTalk problem Smile. What I could see in one of the SAP tools was that BizTalk was trying to connect but it was straight away disconnected.

So to solve this problem you must contact your SAP team to proper configure the access. Once is done everything will work fine, at least in this case it solved my problems.

Back again to one of my favorites topics: transformations. This is something that several people asked me for help in the past but I never found time to reply… until now.

A quite note: if you want to know more about BizTalk Maps transformation check out my free book available at BizTalk360 website: BizTalk Mapping Patterns & Best Practices

While migrating an older BizTalk Map transformation, from a custom schema to a SAP IDOC schema, from an entire custom XSLT file to BizTalk Mapper (don’t get me wrong, I only made this migration because the source schema changed so I had the need to change the entire XSLT code, otherwise I would have used the existing external file), I had the need to implement some part of the transformation in an Inline XSLT code (using a Scripting Functoid) and I only used inline XSLT because I was transforming a flat structure from the source schema to a recursive node in the target schema base on some conditions (otherwise I would have used the Table Lopping Functoid)

BizTalk-Mapper-inline-scriptin-functoid-with-prefix

<ns1:E2EDKA1003>
  <ns1:DATAHEADERCOLUMN_SEGNAM>E2EDKA1003</ns1:DATAHEADERCOLUMN_SEGNAM>
  <ns1:PARVW>LF</ns1:PARVW>
  <ns1:PARTN>0000100000</ns1:PARTN>
</ns1:E2EDKA1003>

<ns1:E2EDKA1003>
  <ns1:DATAHEADERCOLUMN_SEGNAM>E2EDKA1003</ns1:DATAHEADERCOLUMN_SEGNAM>
  <ns1:PARVW>ZC</ns1:PARVW>
  <ns1:PARTN>
    <xsl:choose>
      <xsl:when test="@Transportation='1'">
        <xsl:value-of select="'0000100001'" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'0000100009'" />
      </xsl:otherwise>
    </xsl:choose>
  </ns1:PARTN>
</ns1:E2EDKA1003>

Note that I’m using the prefix “ns1” on the element because the schemas is expecting that, and it should work because both the schema and the transformation file (XSL) contains the namespace

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
     …
     xmlns:s1="http://unicer.pt/OrderUnigest01.xsd"
     xmlns:ns1="http://Microsoft.LobServices.Sap/2007/03/Types/Idoc/3/ORDERS01//700"
     xmlns:userCSharp="http://schemas.microsoft.com/BizTalk/2003/userCSharp">

BizTalk-Mapper-xslt-prefix-namespace

You can validate that by:

However, when you either compile the map or validate it, we get the following error message:

Validate the map or compile it, I get the following error:

Exception Caught: ‘ns1′ is an undeclared prefix. Line …, position …

 

CAUSE

Well unfortunately BizTalk Mapper Editor doesn’t like prefixes in inline XSLT code, although they exist he is not able to understand them without additional information in the code, which makes our work a little more difficult or we need to use a different strategy in our XSLT code.

Luckily, we can easily fix this strange behavior of the editor.

SOLUTION

The cleanest way to solve this strange behavior is to use the <xsl:element> element or <xsl:attribute> element to create the records, elements and attributes required, instead of manually create them <ns1:E2EDKA1003></ns1:E2EDKA1003> without the <xsl:element> element:

<xsl:element name="ns1:E2EDKA1003">
  <xsl:element name="ns1:DATAHEADERCOLUMN_SEGNAM">E2EDKA1003</xsl:element>
  <xsl:element name="ns1:PARVW">LF</xsl:element>
  <xsl:element name="ns1:PARTN">0000100000</xsl:element>
</xsl:element>

<xsl:element name="ns1:E2EDKA1003">
  <xsl:element name="ns1:DATAHEADERCOLUMN_SEGNAM">E2EDKA1003</xsl:element>
  <xsl:element name="ns1:PARVW">ZC</xsl:element>
  <xsl:element name="ns1:PARTN">
    <xsl:choose>
      <xsl:when test="@Transportation='1'">
        <xsl:value-of select="'0000100001'" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'0000100009'" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:element>
</xsl:element>

If you don’t want to use the <xsl:element> element or <xsl:attribute> element, then you need to declare the prefix namespace in the record:

<ns1:E2EDKA1003 xmlns:ns1="http://Microsoft.LobServices.Sap/2007/03/Types/Idoc/3/ORDERS01//700">
  <ns1:DATAHEADERCOLUMN_SEGNAM>E2EDKA1003</ns1:DATAHEADERCOLUMN_SEGNAM>
  <ns1:PARVW>LF</ns1:PARVW>
  <ns1:PARTN>0000100000</ns1:PARTN>
</ns1:E2EDKA1003>

<ns1:E2EDKA1003 xmlns:ns1="http://Microsoft.LobServices.Sap/2007/03/Types/Idoc/3/ORDERS01//700">
  <ns1:DATAHEADERCOLUMN_SEGNAM>E2EDKA1003</ns1:DATAHEADERCOLUMN_SEGNAM>
  <ns1:PARVW>ZC</ns1:PARVW>
  <ns1:PARTN>
    <xsl:choose>
      <xsl:when test="@Transportation='1'">
        <xsl:value-of select="'0000100001'" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'0000100009'" />
      </xsl:otherwise>
    </xsl:choose>
  </ns1:PARTN>
</ns1:E2EDKA1003>

In any of the case that you decide to implement, if then you try to compile or validate the map, everything will work fine and the error will disappear.

Here’s a topic that, without any particular reason, I never or I rarely addressed in my blog: Business Rules Engine (BRE)

The goal of this post is not to explain BRE but since it’s the first time that I cover something related with this topic, let’s first make a small introduction and share some notes and personal opinions about it.

Business Rules Engine (BRE)

Business Rules Engine (BRE) is a run-time inference engine that can link highly readable, declarative, semantically rich rules to any business objects (.NET components), XML documents, or database tables. It can evaluates rules against facts and initiates actions based on the results of that evaluation. This an optional component that comes out-of-the-box with BizTalk Server that enable you to directly create, modify and isolate a sets of rules of business decisions (business rules). To be more accurate, since BizTalk Server 2004 version, Microsoft has introduced in the product the Business Rules Framework, a stand-alone application that consists of a number of modules, support components, and tools. The primary modules includes:

  • Business Rule Composer, a graphical user interface that enables developers, business analysts and administrators for constructing vocabularies and policies;
  • Rule Engine Deployment Wizard for export, import, deploy or undeploy vocabularies and/or policies created in the Business Rule Composer;
  • And the Run-Time Business Rule Engine that executes policies on behalf of a host application.

However, and in my opinion, this is the second BizTalk Server most misunderstood component only outweighed by BAM (Business Activity Monitoring). And one of the reasons “why?” Is that, Business Rule Composer is a tool initially designed for Business Analysts, or those responsible for the business, to create and update Business Rules at any time without affecting the code implemented by the developer team. In this perspective, or initial intention, the BizTalk Developer is not responsible to create Business Rules, because in reality he will often be unfamiliar with the business, but he will be able to use or reuse them (BR) in their orchestrations to support a variety of scenarios like: determine the execution path of a business process.

BRE-Business-Rules-Engine-Overview

But one of the problems is that Business Rule Composer is a tool unfriendly, or too complex, for Business Analysts, which forces:

  • The Developers to stay with the task of creating them
  • And to the Administrators to maintain them

With an unfamiliar tool (Developer are familiar with Visual Studio and Administrators with BizTalk Administration Console) and sometimes with unfamiliar terms (vocabularies, rules and policies) to accomplish that.

Despite this component has not suffer any radical changes since 2004, BRE is still a powerful feature in BizTalk Server and you can make amazing thing with it. Ricardo Torre mentioned in his series about BizTalk Server Tips that:

  • Business Rule Engine is a high performance engine to evaluate business rules even when compared with WF Rules
  • And that Business Rule Engine is a good way of to modularize the constantly changing business logic that is often developed inside Orchestrations, making changes a more smooth process since updating a policy to the latest version doesn’t require any downtime at all.

In fact the most common application of BRE is to isolate business rule, in a centralized manner, from the BizTalk applications making it eminently reusable in a simple and efficient manner. But what many people don’t realize is that we can do many more things with it, for example:

  • BRE can be used to store configuration data (or Application configurations), using a vocabulary, which is essentially parameters, or friendly names for the facts, that can be used within the execution of a rules policy. However the vocabularies can also be accessed from C# code and they can be a wonderful way to abstract facts from their implementation.
    • The Rule Engine Config Get Functoid, available in the BizTalk Mapper Extensions UtilityPack, allows you to obtain a definition value from a Vocabulary in the Business Rules Engine to be used inside your maps.

Before we went to the purpose of this post let me mention a particular note: Normally we have policies that consumes vocabularies to generate rules, however:

  • We can have simple vocabularies that are not consumed by any policy
  • Or we can have simple policies that doesn’t consume any vocabulary

This week I have the necessary to migrate a simple policy (without any vocabulary) from an old version of BizTalk (2006 R2) to BizTalk Server 2013 R2. So what is necessary to migrate this artifacts’? Do I need to recreate everything or are they compatible?

How to migrate Business Rules Policies from BizTalk Server 2006/2006 R2 to BizTalk Server 2013 R2

Well, as I mentioned earlier in this post, BRE doesn’t suffer any radical changes since 2004 therefore this is a very simple task to be accomplished. For that you just only need to use the Rules Engine Deployment Wizard tool to import from your older environment and export them into your new environment.

Exporting policy from BizTalk Server 2006/2006 R2:
  • Click “Start”, “Programs”, “Microsoft BizTalk Server 2006”, and then click “Business Rules Engine Deployment Wizard”.

01-BTS2006-Business-Rules-Engine-Deployment-Wizard

  • On the “Welcome to the Rules Engine Deployment Wizard” page, click “Next”.

02-BTS2006-Business-Rules-Engine-Deployment-Wizard-Welcome

  • On the “Deployment Task” page, select “Export Policy/Vocabulary to file from database” option, and then click “Next”.

03-BTS2006-Business-Rules-Engine-Deployment-Wizard-Deployment-Task

  • On the “Policy Store” page, from the drop-down lists, select an available SQL Server computer and database, and then click “Next”.

04-BTS2006-Business-Rules-Engine-Deployment-Wizard-Policy-store

  • On the “Export Policy/Vocabulary” page:
    • Select “Policy” option.
    • From the Policy/Vocabulary drop-down list, select the desired policy you want to export.
    • Click “Browse” to select the definition file path and name.
    • And then click “Next “

05-BTS2006-Business-Rules-Engine-Deployment-Wizard-Export-Policy-Vocabulary

  • On the “Ready” page, review the information, and then click “Next”.

06-BTS2006-Business-Rules-Engine-Deployment-Wizard-Ready

  • On the “Exporting Policy/Vocabulary” page, after export is completed, click “Next”.

07-BTS2006-Business-Rules-Engine-Deployment-Wizard-Exporting-Policy-Vocabulary

  • On the “Completing the Rules Engine Deployment Wizard” page, review the completion status, and then click “Finish”.

08-BTS2006-Business-Rules-Engine-Deployment-Wizard-complete

Importing policy to BizTalk Server 2013 R2:
  • In the BizTalk Server machine, press the “Windows key” to switch to the Start screen, type “Business Rules Engine Deployment Wizard” or “rules”, and then click “Business Rules Engine Deployment Wizard” option from the Search menu.

09-BTS2013R2-Business-Rules-Engine-Deployment-Wizard

  • On the “Welcome to the Rules Engine Deployment Wizard” page, click “Next”.

10-BTS2013R2-Business-Rules-Engine-Deployment-Wizard-Welcome

  • On the “Deployment Task” page, select “Import and publish Policy/Vocabulary to database from file” option, and then click “Next”.

11-BTS2013R2-Business-Rules-Engine-Deployment-Wizard-Deployment-Task

  • On the “Policy Store” page, from the drop-down lists, select an available SQL Server computer and database, and then click “Next”.

12-BTS2013R2-Business-Rules-Engine-Deployment-Wizard-Policy-store

  • On the “Import Rules Engine Policy/Vocabulary file” page:
    • Click “Browse” to select the definition file that we previous export from BizTalk Server 2006/2006 R2.
    • And then click “Next “

13-BTS2013R2-Business-Rules-Engine-Deployment-Wizard-Import-Policy-Vocabulary-file

  • On the “Ready” page, review the information, and then click “Next”.

14-BTS2013R2-Business-Rules-Engine-Deployment-Wizard-Ready

  • On the “Importing Policy/Vocabulary” page, after import is completed, click “Next”.

15-BTS2013R2-Business-Rules-Engine-Deployment-Wizard-Importing-Policy-Vocabulary

  • On the “Completing the Rules Engine Deployment Wizard” page, review the completion status, and then click “Finish”.

16-BTS2013R2-Business-Rules-Engine-Deployment-Wizard-complete

Now if we access to the Business Rule Composer you will notice that your policy is published are ready to be deployed.

17-BTS2013R2-Business-Rules-Composer

I’m not much of a historian and I don’t read too many history books but from what I can remember from my school days… (please be open mind and do not think I’m completely crazy…the story will have a context and meaning at the end)

The Story

A few hundred years ago many cultures around the world still believe that the planet Earth was flat disk or a square, rather than a sphere, at the edge there were infinite length cliffs straight down into the darkest depths.

Myths of the age of discovery, where the Portuguese ships, then Spanish, were the first to set sail to discover a world, leaving the coastal waters of the Old World and embarked on their adventure on the vast "green sea of darkness said that Europe sat in the middle of the circle, with the other continents scattered about the fringes, and parts of Africa hanging over the edge and the oceans lapped against the sides of the Earth, and in places ran over, creating currents that would pull over the edge ships that ventured too far out to sea.

End-of-the-world-sailor

Luís de Camões, considered the Portuguese language’s greatest poet, has created a mythical figure: the giant Adamastor (Northwind), as a symbol of the forces of nature Portuguese navigators had to overcome during their discoveries and more specifically of the dangers Portuguese sailors faced when trying to round the Cape of Storms, in Africa and supposedly one of the edge of the earth. A giant creature that appears to them, walking in the depth of the sea; his head reaches to the clouds; the storms, the winds, the thunders, and the lightning’s hang about him; his arms are extended over the waves.

The-Giant-Adamastor

It seems once again that a Portuguese sailor (me) found the giant Adamastor… this time inside BizTalk Mapper Editor! Tormenting me and not letting me go further and my FunctoIds vanished into the hell darkest depths.

PROBLEM (the story meaning and context)

Over the last weeks I’ve been busy performing BizTalk projects migrations from BizTalk Server 2006 R2 to 2013 R2 and, unintentionally, it seems that I can pick up and detect all the “bugs”, problems or limitations that you might imagine… or not, this is one of the case. The problem that I faced today it is the most crazy behavior that I found in the BizTalk Mapper Editor, and made me remember this story and that I reached and went over to the edge of “flat Earth”, in this case to the end of the grid page world!

In a global picture: migrating a map is straightforward and quite simple operation, there is no rock science behind it! Most of the times you don’t need to touch them, they are compatible.

However it was a big surprise to me, when I was in the process of optimizing one of the maps, I found out in one of the grid pages that I could not reach, and even see, some of the FunctoIds present, although I was able to see their existence through the links in the grid page

BizTalk-Mapper-grid-overview.bottom

I know what you may think… zoom out the grid and/or collapse the tree view… nothing!

BizTalk-Mapper-grid-overview.bottom-zoom-out

Ok… check the “Grid preview”… still nothing!

BizTalk-Mapper-grid-overview.bottom-grid-preview

Believe me I try everything that I could remember including restart Visual Studio and so on…

So, just to be sure that I wasn’t insane, I went to Visual Studio 2005 to open the BizTalk Server 2006 R2 version of the project, to check what was in that particular part of the grid page and voilà… I found 6 FunctoIds that were making conditional transformations

BizTalk-Mapper-2006-grid-overview-bottom

CAUSE - So, where are my FunctoIds in the grip page?

Before I explain the problem and the solution (or workaround) I like to say that this is not a runtime bug, which means, if I had deploy this map to my BizTalk environment everything would work fine. Instead this is a “bug”/”limitation” of the BizTalk Server SDK, that will turn your life into hell, it will drive you crazy, if you’d like to change that part of the map.

What I found out is that the configurations of working area (space) of the grid page, at least since BizTalk Server 2013, have changed. Now the working are of the grid page is in a square format and previous it has in a rectangle format, as you can see below:

BizTalk-Mapper-grid-page-workplace

Despite this change, I never thought that this would affect the development and maintenance of my maps… but it affects!

SOLUTION (workaround)

When I check the old version of the project inside Visual Studio 2005, I realize that the FunctoIds that I was trying to reach were at the bottom right corner at the very end of the working area of the grid page, with a large space gap for the remaining FunctoIds present in the middle of the grid page working area

BizTalk-Mapper-2006-grid-overview-right-bottom

To solved this problem I dragged the FunctoIds from the bottom right corner into the middle of the grid page working area, narrowing down the space gap between them, but most important, placing all the FunctoIds near the center of grid page working area:

BizTalk-Mapper-2006-grid-overview-middle

Then you just need to save this version of the map (Visual Studio 2005), take the “.btm” file and you only need to overlay this map to the existing one in your Visual Studio 2013/BizTalk Server 2013 R2 solution.

BizTalk-Mapper-2013-R2-Visual_Studio-2103-grid-overview

Finally my FunctoIds are visible! And once again the giant Adamastor was defeated.

This part of the article will focus on the installation of additional useful tools to help you develop your BizTalk Server projects. The goal here is not to address all the tools available instead I will address only the most important ones that may have direct impact on the efficiency of your developments, because there are a number of tools that can aid you as BizTalk developer, which you can find on Codeplex or Microsoft Download Center, that are not offered out of the box by BizTalk Server like WCF Publishing Wizard and so on.

Install BizTalk NoS Addin for Visual Studio 2013

Although the current available version for download at Visual Studio Gallery has not been developed and not be “officially” supported for Visual Studio 2013/BizTalk Server 2013 R2 it can be installed and used without problems in this new environment conjugation: Visual Studio 2013 and BizTalk Server 2013 R2 with a small workaround.

What is BTSG NoS Addin purpose?

The purpose of BTSG NoS addin is to help all BizTalk Developer, why not, all BizTalk Administrator too in a lot of different situations, by improving the developer experience and why not reduce the development time in new or existent BizTalk projects.

It will provide several functionalities like quick search inside artifact, fast register/unregister in GAC, find critical, internal or external dependencies… and many fore functionalities like JackHammering, which will compare your VS artifact with the artifact deployed in BizTalk environment, you can also extract the artifact (Orchestration, map, schema and so on) from BizTalk environment and put it in the VS solution or even test your pipeline in VS simply… several features that are usefully in our day by day work and a time saver in a lot of situations.

How can I install BTSG NoS Addin for Visual Studio 2013

Because the current version of the Addin in not officially supported for Visual Studio 2013, you cannot install it through “Extensions and Updates” option from Visual Studio, instead you need to:

You can install BTSG NoS Addin directly from Visual Studio “Extensions and Updates” option. For that you must:

  • Download the BizTalk NoS Addin from Visual Studio Gallery: BizTalk NoS Addin
  • Execute “BTSGSetup.exe” file with administration writes by, right-click on the file and select “Run as administrator” option.

160-BizTalk-Server-2013-R2-BizTalk-NoS-Addin-Install

  • On the Welcome to the BTSG NoS Addin Installer Setup page, click “Next” to continue

160-BizTalk-Server-2013-R2-BizTalk-NoS-Addin

  • On the End-User License Agreement page, accept the terms by selecting the “I accept the terms of this License Agreement” option and click “Next” to continue.

161-BizTalk-Server-2013-R2-BizTalk-NoS-Addin

  • On the Destination Folder page, set the destination folder and click “Next” to continue

162-BizTalk-Server-2013-R2-BizTalk-NoS-Addin

  • On the Ready to install BTSG NoS Addin page, click “Install” to start the installation process.

163-BizTalk-Server-2013-R2-BizTalk-NoS-Addin

  • On the Completed the BTSG NoS Addin Installer Setup page, click “Finish” to complete the installation of the Addin.

164-BizTalk-Server-2013-R2-BizTalk-NoS-Addin

Add-In Registration for Visual Studio 2013 (Workaround)

Visual Studio add-ins are deprecated in Visual Studio 2013. You should upgrade your add-ins to VSPackage extensions. For BizTalk NoS Addin to work in Visual Studio 2013 we need to implement the following workaround:

  • When Visual Studio starts, it looks in the .addin file location (\Documents\Visual Studio 2013\Addins\) for any available .addin files
    • For example: C:\Users\Administrator\Documents\Visual Studio 2013
  • Because BizTalk NoS Addin is meant to work with Visual Studio 2012 you should go to
    • For example: C:\Users\Administrator\Documents\Visual Studio 2012
    • You will find in this location an “Addins” folder containing “BTSG NoS” addin file

165-BizTalk-Server-2013-R2-BizTalk-NoS-Addin-Visual-Studio-folder

  • Copy the “Addins” folder to Visual Studio 2013 .addin file location
    • For example: C:\Users\Administrator\Documents\Visual Studio 2013
  • Go to “Addins” folder:
    • For example: C:\Users\Administrator\Documents\Visual Studio 2013\Addins
    • And edit the file ADDIN File.AddIn in notepad and change the <HostApplication> element with the following data:
<HostApplication>
   <Name>Microsoft Visual Studio</Name>
   <Version>12.0</Version>
</HostApplication>
  • Save and close the file.
To load BTSG NoS Addin into Visual Studio 2013
  • Open a BizTalk Server Visual Studio Project and on the Tools menu, click Add-In Manager.

165-BizTalk-Server-2013-R2-BizTalk-NoS-Addin

  • In the Add-in Manager window, select the add-in from the Available Add-ins column list and then click “OK”.

166-BizTalk-Server-2013-R2-BizTalk-NoS-Addin

Back to your BizTalk project, right click in your BizTalk solution or in one of your BizTalk artifacts and you can see the new options provided by BTSG NoS Addin:

167-BizTalk-Server-2013-R2-BizTalk-NoS-Addin

You can find all the documentation about this addin in:

Or in my posts:

 

Install BizTalk Server Pipeline Component Wizard

The Pipeline Component Wizard is intended to ease to development of pipeline components used within a BizTalk Server environment. Supports both C# and VB.NET. The following resources can be used to download the tool, find guidance in usage and background information:

 

Install BizTalk Server Functoids Project Wizard

BizTalk MapperExtensions Functoid Wizard is a Custom Functoid Project Wizard for Visual Studio 2010. It allows you to create new Functoids project for BizTalk Server 2010 without having to create manually the project. Supports both C# and VB.NET.

The following resources can be used to download the tool, find guidance in usage and background information:

  • Available soon
Related links