Microsoft KB Archive/311251

= FIX: BizTalk Server May Lose Data When It Processes Binary Data with the Receive Function Preprocessor =

Article ID: 311251

Article Last Modified on 10/22/2003

-

APPLIES TO


 * Microsoft BizTalk Server 2000 Standard Edition

-



This article was previously published under Q311251



SYMPTOMS
If a BizTalk Server receive function preprocessor is written in Microsoft Visual Basic, when you use this receive function preproprocessor to process binary data, BizTalk Server truncates the SAFEARRAY output that is returned by one byte.

This data loss in the output file occurs when BizTalk Server passes the SAFEARRAY output to a channel/port combination.



CAUSE
This problem occurs because BizTalk Server incorrectly calculates the length of the Visual Basic SAFEARRAY that contains the preprocessor output when BizTalk Server submits the SAFEARRAY to the channel.



RESOLUTION
To resolve this problem, obtain the latest service pack for Microsoft BizTalk Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

299664 INFO: How to Obtain the Latest BizTalk Server 2000 Service Pack



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft BizTalk Server 2000 Service Pack 2.



Steps to Reproduce Behavior
 Create a Message Queuing receive function. Set the Pass-through property.  Use the following Microsoft Visual Basic 6.0 code to create a preprocessor for the Message Queuing receive function:

NOTE: You must include a reference to the &quot;Microsoft BizTalk Server Application Interface Components 1.0 Type Library&quot; (Btscomplib.tlb) in the project for this code. Implements IBTSCustomProcess Sub IBTSCustomProcess_SetContext(ByVal pCtx As IBTSCustomProcessContext) 'This subroutine is required but is not used. End Sub

Sub IBTSCustomProcess_Execute(ByVal vDataIn, ByVal nCodePageIn As Long, _                             ByVal bIsFilePath As Boolean, ByRef nCodePageOut, _                              ByRef vDataOut) nCodePageOut = nCodePageIn vDataOut = vDataIn debug.print typename(vDataOut) 'Data type of byte is a SAFEARRAY. debug.print LenB(vDataOut) End Sub   Configure a channel to a port to an Application Integration Component (AIC), which has the following code:

NOTE: You must include a reference to the &quot;Microsoft BizTalk Server Application Interface Components 1.0 Type Library&quot; (Btscomplib.tlb) in the project for this code. Implements IBTSAppIntegration Private Function IBTSAppIntegration_ProcessMessage(ByVal bstrDocument As String) _ As String Dim strDocument As String debug.print LenB(bstrDocument) 'This loses a byte if you submit document as binary. ' Convert the document that is passed in to Unicode. strDocument = StrConv(bstrDocument, vbUnicode) ' Write out the document. Open &quot;c:\AICOutput.txt&quot; For Binary Access Write As #1 Put #1,, strDocument Close #1 End Function  Submit binary data to the Message Queuing queue that the Message Queuing receive function monitors.

If binary data is written to the incoming Message Queuing queue, the resultant Visual Basic SAFEARRAY output is the correct size in the preprocessor. However, a byte of data is missing from the SAFEARRAY output when the output reaches the Application Integration Component.

If non-binary data is written to the incoming Message Queuing queue, this problem does not occur because the preprocessor output is not a SAFEARRAY. This problem only occurs if the preprocessor output is a Visual Basic SAFEARRAY.

Additional query words: pre-processor data less than expected

Keywords: kbbug kbfix kbbiztalk2000sp2fix KB311251

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.