Microsoft KB Archive/311251

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 17:44, 18 July 2020 by 3155ffGd (talk | contribs) (importing KB archive)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base


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.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a Message Queuing receive function. Set the Pass-through property.
  2. 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 "Microsoft BizTalk Server Application Interface Components 1.0 Type Library" (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
                        
  3. 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 "Microsoft BizTalk Server Application Interface Components 1.0 Type Library" (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 "c:\AICOutput.txt" For Binary Access Write As #1
        Put #1, , strDocument
        Close #1
    End Function
                        
  4. 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