Making Microsoft BizTalk Adapter v2.0 for mySAP Business Suite projects work with WCF SAP Adapter

We have written a custom pipeline component (code and sample projects using this pipeline component are attached) that you can use to make your BizTalk orchestrations calling RFCs and BAPIs written with Microsoft BizTalk Adapter v2.0 for mySAP Business Suite work with the new WCF SAP Adapter. All you need to do is to use custom send and receive pipelines that replace the usual XMLTransmit and XMLReceive pipelines, and plug in the new adapter in place of the old one. No other changes. The source code of the pipeline component is included so you can make changes to it if you want to.


The custom pipeline component performs the following transformations:


1.       Old adapter Request XML to New adapter request XML


2.       New adapter Response XML to Old adapter response XML



The result? Your orchestration and messages do not have to change at all!


The major differences between the old and new adapters’ XML structure for RFCs are as follows:


1.       Namespaces:


%u00b7         Old Adapter : Root element is in the namespace http://schemas.microsoft.com/BizTalk/2003 while other elements have an empty namespace


%u00b7         New Adapter: Elements with depth 0 and 1 are in the namespace http://Microsoft.LobServices.Sap/2007/03/Rfc/ while elements with depth 2 and 3 are in the namespace http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/


 


2.       Name of the Root Node:


%u00b7         Old Adapter:  The root node is named {RFC_NAME}_Request for the request XML, and {RFC_NAME}_Response for response XML


%u00b7         New Adapter: The root node is named {RFC_NAME} for the request XML, and {RFC_NAME}Response for the response XML


 


3.       Array of Complex types:


%u00b7         Old Adapter : There are multiple nodes of with the name of the parameter, each of which contain one instance of the structure as the child nodes. The name of the complex type does not appear in the XML. For example:


.


.


<ComplexParameterName>
                  
<Element1>Value1</Element1>
                  
<Element2>Value2</Element2>


</ComplexParameterName>
         
<ComplexParameterName>
                  
<Element1>Value3</Element1>
                  
<Element2>Value4</Element2>
         
</ComplexParameterName>
          
.
             
.


%u00b7         New Adapter : There is only one node with the name of the parameter, which contains multiple child nodes whose name is set to the name of the complex type , each containing one  instance of the structure. For example:


.
.
<ComplexParameterName>
          <ComplexTypeName>
                   <Element1>Value1</Element1>
                   <Element2>Value2</Element2> 
          </ComplexTypeName>
          <ComplexTypeName>
                  
<Element1>Value3</Element1>
                  
<Element2>Value4</Element2>
          </ComplexTypeName>
</ComplexParameterName>
.
.


 


4.       Tables Returned:


%u00b7         Old Adapter: All tables that have any output value are returned.


%u00b7         New Adapter: Only the tables that were present in the request XML are present in the response XML.


 


How does the custom component work? 


Changing Namespaces and Name of the root node is straightforward. To figure out the name of the ComplexParameter’s type, we use reflection on the RFC specific dll created by the old adapter, and expect it to be present at “C:\Program Files\Microsoft BizTalk Adapter v2.0 for mySAP Business Suite\Bin\{RFC_Name}.dll” (The old adapter creates this Dll automatically when you generate the RFC Schema). To make sure the tables returned are same as what the old adapter would have returned, we append empty nodes for all the table parameters that were not included in the request XML by using the schema in your project. That way, the response XML contains all tables. Now we simply eliminate the tables that are empty to get the response similar to that of the older adapter.


 


Using the custom pipeline component


1.       Build the custom pipeline component or use the dll included


2.       Copy the assembly to “C:\Program Files\Microsoft BizTalk Server 2006\Pipeline Components” and also add it to the GAC


3.       In your existing BizTalk project, create new send and receive pipelines and include the custom component in encode and decode stages. (you’ll need to add reference to the custom pipeline assembly and add it to the pipeline toolbox)


4.       Build and deploy


5.       Go to the BizTalk administration console and restart the host instance.


6.       For the ports that send or receive to/from SAP, select the new SAP adapter and configure it as described in the documentation. Set the ’enableSafeTyping’ binding property to true


7.       Use the custom pipeline you created with the ports that talk to SAP


8.       Start!


 


A few sample BizTalk projects that use schemas generated with the old adapter and include custom pipelines are included in the attachment. Sample configuration bindings are also included. To build the samples, you should change the name of the SQL server in project deployment properties.


Update: The attached Pipeline component has been updated to transform the context property ‘ConnectionType’ too. See this post for more info.

MS BRE: The Rules Engine Update (REU) Service and Policy Execution

A question came up tonight on BizTalkGurus on my favourite subject of rule engines. I don’t blog enough these days, so this gives me an excuse. Essentially, the question concerned an incorrect, but understandable, suspicion that MS BRE may be using remoting to execute rule sets out-of-process. This is not the case. You can find an article describing what actually happens at:
http://geekswithblogs.net/cyoung/archive/2008/01/13/118506.aspx

[OT] 5 * 3 * 2007

Yves has passed me this little stick…




  • 3 artists I (re)discovered this year:



  • 3 things I won’t forget:



    • Becoming the father of my beautiful daugher Fran.


    • Visiting Sowetho (township in Johannesburg, South Africa) The feeling I got after visiting a two weeks old baby and her mother (my wife was still pregnant at that time) in Sowetho, and driving back to my fancy five-star hotel was devastating … the world is not fair.


    • A smile makes you forget sleepless nights.


  • 3 stupid things I did in 2007:



    • I stopped blogging on this site (more or less) … now it’s really hard to get motivated again.


    • I stopped my 365 project (take and publish one photo a day for one year). I have take a picture almost every day in 2007, but I didn’t publish them.


    • I didn’t “safely remove” a USB hard disk from my computer and lost some data. Windows complained about the drive still being in use, I didn’t trust Windows, but Windows was right this time.


  • 3 thing I’m proud of:



    • I’m very proud of my daugther every time she learns something new, she is so intelligent.


    • I’m proud of the presentation I did with my buddy Patrick at TechEd, Barcelona (AJAX and SilverLight in SharePoint).


    • I’m proud of some photos I took. I don’t pretend I’m a good photographer, but photography is becoming addictive and some people tell me they like the pictures I take.


  • 3 things I bought or received as a present:



    • The Sigma 30mm f1.4 lens. I recommend every photographer to get a fast lens (big aperture, allows lots of light to enter the lens). This is my favorite lens, you can’t zoom with it (it’s a prime), but you can take pictures when it’s near dark (without flash).


    • A ticket to go to the Urbanus tribute concert (he is a famous Belgian comedian).


    • And of course the most precious gift of my wife: our daughter (including all the love, joys, laughs, tears etc that came with her).


  • 3 people who will get this stick (if there are still some people who read this blog?):



    • Kevin


    • Karine


    • Peter

.NET SOA BizTalk: BizTalk Tools and guidelines

Kishore Dharanikota has created a nice list of tools and guidelines for BizTalk developers and designers .NET SOA BizTalk: BizTalk Tools and guidelines. The Rule Manager is mentioned in the Development category. Interesting to see this classification. I probably would have placed it in the Design category. But that all depends on your frame of reference. Or it might hint that many BizTalk developers are playing a dual role of business analyst and developer.

Windows 2008 Hyper-V

Not really a BizTalk thing, but since I do most of my development in virtual environments I am very interested in where MS is going with virtualization and I am happy to say the new Hyper-V stuff looks good.

I loaded the currently available version of Windows 2008 Enterprise with Hyper-V on a new Quad Core machine with 8GB of Ram and the performance was nice, I tested 2 virtual machines running so no memory issues or such. I will do some more testing of the next week or so and really see what it can do, I am wanting to get some experience with SQL clustering, so my next virtualization project is to build a virtual SQL 2 node cluster.

One thing to be aware of is that when you take an existing VHD file to Hyper-V it loads a new HAL and requires a new set of additions, so you cannot share your VHD files between virtual pc/server and Hyper-V.

More on building BizTalk solutions with Team Build…

A few folks have discussed the topic of building BizTalk solutions with TFS, namely here and here
As most have surmised in the time since TFS originally shipped, you have to build
BizTalk solutions with “devenv.exe” if you are going to use Team Build,
by overriding the “AfterCompile” target.  This is because there is
no “standalone” xlang compiler (at least not that you & I can
use) – it instead loads in-process to the IDE.

Your steps will be something like the following:

  • Do a “developer tools only” install of BizTalk on your build server. 
    No need to install the BizTalk services or databases, etc. (unless you intend to deploy
    & run post-deployment tests on the build machine.)  Note that since you need
    to install Team System Dev or Test to run post-build unit tests anyway, you aren’t
    really installing that many more “bits” on your build server (if you are
    skipping the BizTalk runtime/database infrastructure.)
  • Comment out the line in your TFSBuild.proj file that looks like this: <SolutionToBuild
    Include=”$(SolutionRoot)\path\MySolution.sln” />
  • Create an AfterCompile target that looks something like this:

  <Target Name="AfterCompile">
 

  <!--Call DevEnv to build the BizTalk Solution-->
  <Exec Command="&quot;C:\%programfiles%\Microsoft Visual Studio
8\Common7\IDE\devenv&quot; &quot;$(SolutionRoot)\BizTalk\Dev\MyBizTalk.sln&quot;
/Build &quot;$(BuildFlavor)|$(BuildPlatform)&quot;"/>

  <!-- Create a drop location -- >
  <MakeDir
   Directories="$(DropLocation)\$(BuildNumber)\$(BuildFlavor)"
   Condition="!Exists('$(BinariesRoot)\$(BuildFlavor)')" />

    <!-- Do whatever work you would like here - assemble binaries,
build an MSI via WiX, etc. and

         place the outputs in the drop location.
-->

 </Target>

What isn’t immediately obvious is that if you want to execute unit tests as
part of your build process (i.e. tests that don’t require your BizTalk solution
to be deployed…think build verification) then the DevEnv method of building
can cause you trouble.  The testing portion of the build process expects your
binaries to land in the “Binaries” folder — a peer of Sources, BuildType,
and TestResults in your build location.

Therefore…you will want to add something like this at the end of your AfterCompile
target:

    <!-- Get our build outputs into the "binaries" folder
to facilitate unit testing. -->
    <MakeDir Directories="$(OutDir)"/>
    <CreateItem Include="$(SolutionRoot)\**\*.dll" >
      <Output ItemName="FilesToCopy" TaskParameter="Include"
/>
    </CreateItem>
    <Copy
          SourceFiles="@(FilesToCopy)"
          DestinationFolder="$(OutDir)"
          ContinueOnError="true" />

 

With this in place, the unit testing portion of the build process can execute as if
you hadn’t resorted to calling devenv.exe…