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:
· Old Adapter : Root element is in the namespace https://schemas.microsoft.com/BizTalk/2003 while other elements have an empty namespace
· New Adapter: Elements with depth 0 and 1 are in the namespace https://Microsoft.LobServices.Sap/2007/03/Rfc/ while elements with depth 2 and 3 are in the namespace https://Microsoft.LobServices.Sap/2007/03/Types/Rfc/
2. Name of the Root Node:
· Old Adapter: The root node is named {RFC_NAME}_Request for the request XML, and {RFC_NAME}_Response for response XML
· 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:
· 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>
.
.
· 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:
· Old Adapter: All tables that have any output value are returned.
· 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.