Visual Basic code snippet for generating a statusRequest XML infoset


Private Sub Command1_Click()

On Error GoTo Err_Trap

'### StatusRequestManager interface
Dim statusRequestManagerEx As STATUSREQUESTMANAGER430Lib.StatusRequestManager
Set statusRequestManagerEx = New StatusRequestManager

'### Set the module language to german
statusRequestManagerEx.ModuleLanguage = enGerman

'### StatusRequest interface
Dim statusRequestEx As STATUSREQUESTMANAGER430Lib.StatusRequest
Set statusRequestEx = statusRequestManagerEx.StatusRequest

'### Initialize the StatusRequest!!!
statusRequestEx.Initialize (enGerman)

Dim today As Date
today = DateTime.Now

'### we use a unix timestamp corresponding to 1970-01-01T00:00:00
'### this is only an example
Dim lTimestamp As Long
lTimestamp = 0

Dim bStatus As Boolean
'### set the transport, this is just an example
bStatus = statusRequestEx.SetTransport("2012345678901", "", "7612345678901")

'### add a credit status request
bStatus = statusRequestEx.AddQueryObject(enObjectCredit, "myCreditStatus", today, lTimestamp)

'### add a MCD status request
bStatus = statusRequestEx.AddQueryObject(enObjectMCD, "myMCDStatus", today, lTimestamp)

'### add an invoice status request
bStatus = statusRequestEx.AddQueryObject(enObjectInvoice, "myInvoiceStatus", today, lTimestamp)

Dim lValidationError As Long

'### Finalize!!!
bStatus = statusRequestEx.Finalize()

'### StatusResult interface
Dim statusResultEx As STATUSREQUESTMANAGER430Lib.StatusResult

'### write eveything to a file
Dim strTmpFile As String
bStatus = statusRequestManagerEx.GetXML(strTmpFile, lValidationError, lTimestamp, statusResultEx)

'### relase resources
Set statusRequestEx = Nothing
Set statusResultEx = Nothing
Set statusRequestManagerEx = Nothing

Exit Sub

Err_Trap:
    MsgBox "Error: " & Err.Description, vbCritical, _
           "Opps! Error" & Str$(Err.Number)
'### relase resources
Set statusRequestEx = Nothing
Set statusResultEx = Nothing
Set statusRequestManagerEx = Nothing

End Sub