Friday, October 23, 2009

The part '%messagepart%' of message '%multipart message%' contained a null value at the end of the construct block.

BizTalk throws the following error when one tries to create a multipart message with a message part that was just created from a map in the same construct shape:

Shape name: Send_1
ShapeId: 11910fdc-f4a1-4391-b09d-6a9bd0275ff8
Exception thrown from: segment 1, progress 11
Inner exception: The part '%messagepart%' of message '%multipart message%' contained a null value at the end of the construct block.

Exception type: NullPartException
Source: Microsoft.XLANGs.Engine
Target Site: Void CheckNonNull()
The following is a stack trace that identifies the location where the exception occured

at Microsoft.XLANGs.Core.Part.CheckNonNull()

Somehow, BizTalk looses the value of the message part that was NOT mapped.

A work-around for this is to create a second construct shape. One just creates the message part in a mapping, and the second shape puts the message parts together.

Thanks, Christian!

Monday, October 5, 2009

If the Pipeline Component doesn't appear in the Pipeline Editor toolbox

If your BizTalk pipeline component doesn't show up in the toolbox of the pipeline editor, you should check these things:
  • Is the GUID of the pipeline component the same in AssemblyInfo and in the class itself (it appears twice there)?

  • Is the right assembly name used when instanciating an object of ResourceManager?

  • Are you using the same namespace outside the class, in the properties, and in the ResourceManager?

  • Is the assembly copied to %biztalk installation%\pipeline components?

  • Are you looking for the right component type (encoder, decoder, ...) in the pipeline editor?

Thursday, September 10, 2009

Archiving Table Entries

If you want to backup table entries into a second table and delete them in the master table, you can use the folling SQL:

DELETE FROM masterTable
OUTPUT DELETED.* INTO archiveTable
FROM deletionTable
WHERE masterTable.ID=deletionTable.ID

while deletionTable contains the IDs of the entries, which should be deleted.

When using this, all entries of the masterTable, which are joined to the IDs in the deletionTable are copied to the archiveTable and then deleted.

Thanks, Ronny!

Wednesday, June 3, 2009

EDIFACT in BizTalk 2009

In April, I talked at a meeting of the Swedish BizTalk User Group on EDIFACT and BizTalk. If you are interested, check my presentation on EDIFACT in BizTalk 2009.

Tuesday, March 10, 2009

Sending Big IDocs with the WCF-Custom-Adapter

In MSDN, there's a good explanation how to connect BizTalk and SAP with the WCF-Custom-Adapter. However, if you want to send big IDocs, there are some boundaries:

If you use the action Idoc, you could get an exception like: "Failed to allocate a managed memory buffer of 123982965 bytes. The amount of available memory may be low."

If you use SendIdoc instead, you get an exception in the receive pipeline: "Attempt to pass a delimited field greater than the maximum field length of 50000000."

As soon as I find something out, I post it here.

Thursday, February 26, 2009

Stream validates EDI code

When using the EDISendPipeline in BTS2006 R2, that might be interesting:
My colleague Christian and me just found out that the EDI stream is validated by the stream reader while parsing the stream! So, when you work on the EDI stream which is produced by the EDI assembler, you get exceptions like "Error in serialization" if your EDI file is invalid. Quite clever how the programmers solved the validation of EDIFACT since it validates the file while returning it to the next step in the Send Pipeline.

Addition 2009-10-21:
Because of this, the EDI stream can't be read twice in following self-build pipeline components and BodyPart.Data.CanSeek is set the false.

Thursday, February 12, 2009

Aggregating Values from a Hierarchy

In a session about the SQL Server 2008 datatype HierarchyID, the question came up whether you can easily ask question such as: "If I store things (and sup-things and so on) with a number in a hierachy, can I sum up the numbers of a thing, including the subthings?"
The answer is, yes, you can, and here is how it goes. The following code shows a table which hierarchically stores websites and their clickrate.

-- create hierarchical table
create table websiteCalls
(
path hierarchyid,
filename nvarchar(100),
clickCount int
)

-- insert root node "index"
insert into websiteCalls values (hierarchyid::GetRoot(), 'index.html', 1000)
go

-- insert a level 1 entry "products"
declare @index hierarchyid
select @index = path from websiteCalls where filename='index.html'
insert into websiteCalls values (@index.GetDescendant(null, null), 'products.html', 200)

-- insert two more level 1 entries "customers" and "impressum"
declare @products hierarchyid
select @products = path from websiteCalls where filename='products.html'
insert into websiteCalls values (@index.GetDescendant(@products, null), 'customers.html', 100)
insert into websiteCalls values (@index.GetDescendant(null, @products), 'impressum.html', 10)

-- insert a "product1" on level 2
insert into websiteCalls values (@products.GetDescendant(null, null), 'product1.html', 300)
declare @product1 hierarchyid
select @product1 = path from websiteCalls where filename='product1.html'

-- insert two more level 2 entries
insert into websiteCalls values (@products.GetDescendant(@product1, null), 'product2.html', 50)
insert into websiteCalls values (@products.GetDescendant(null, @product1), 'product0.html', 100)
go

-- get all websites and their clickrates
select path.ToString(), filename, clickCount from websiteCalls

-- get the sum of clickrate number of all product-pages:
declare @products hierarchyid
select @products = path from websiteCalls where filename='products.html'
select SUM(clickcount) from websiteCalls where path.IsDescendantOf(@products) = 1 and path<>@products

Tuesday, January 27, 2009

Developing BizTalk with Professional Edition or Team Edition*

If you have to choose a Visual Studio 2005 edition to develop BizTalk 2006 in combination with Team Foundation Server, you should keep in mind that the Team Edition has all the features of the Professional Edition and some more (quoted from Microsoft):

- Team Foundation Server CAL includfor accessing Team Foundation Server
- Team Foundation Server Workgroup Edition included when purchasing Visual Studio Team System Editions with an MSDN Premium Subscription
- 64-Bit Debugging (IA64) enables you to debug 64-bit applications running on Windows 64-bit computers remotely
- Code Analysis Tools such as Code Analysis Check-in Policy (which enforces developers to run a code analysis before a check-in of code)
- Code Profiling Tools like Hot Path (that helps finding bottle necks inside the code) and a Stand-Alone Profiler
- Code Coverage to measure the effectiveness of tests on a line-by-line or even a block-by-block basis
- Item templates to run Performance tests

That means, that you can connect to the Team Foundation Server from Visual Studio if you just buy the CAL-licence which includes the Team Explorer. However, you won't get the benefits of the Team Edition then.

*I'm using the term "Team Edition" as a short form for the Development Edition of Visual Studio Team System 2008.

Sunday, January 25, 2009

Managing hierarchical data in SQL Server 2008

There are roughly three different approaches to store and retrieve hierarchical data in SQL Server:

Parent-Child-Approach with Recursive TCE:
You can save the ID of a node's parent in an extra “parent column”:

Then you connect the referenced items with recursive Common Table Expressions (CTE).

HierarchyID data type:
Or you save the node’s hierarchy location with the new data type HierarchyID, which stores a path to a node and, thus, reveals the where in a tree the row occurs. A sample table looks like this:

The hierarchy is directly visible and, unlike in the simple parent-child-pattern, you have now the HierarchyID methods to work against the tree structure.

XML data type:
The third option is to represent the hierarchy in a XML document and store the instance in an xml column:

Doing this, you can retrieve information from the tree using XQuery.

This is meant to be a teaser... ;-) I'm going to write more about this the next days.

Tuesday, January 20, 2009

How does the SAP adapter retrieve the list of IDocs?

At a customer, we had the problem that the SAP adapter (building on SAP .net Connector v1.0.2) didn't retrieve the IDoc that we wanted to call:


To analyse how the SAP adapter retrieves this list of IDocs, we traced the RFC communication between SAP and BizTalk (transaction ST05*) and found out that the SAP .net Connector uses the BAPIs RFC_SYSTEM_INFO and IDOCTYPES_FOR_MESTYPE_READ to get a list of IDocs which are released:


Using transaction SE37, we (thanks, Rüdiger!) could analyse the BAPI IDOCTYPES_FOR_MESTYPE_READ and see that it uses the table EDIMSG to get the IDocs. And their we saw that the BAPI doesn't call for "message types" instead of "basic types". And, guess what, the message type had a different name then the basic type (which makes perfectly sense) and, thus, couldn't be found.

* Tipp: When logging to SAP to trace, you have to use the same user that you use inside the Send Port / Receive Location.