Progress
AppBuilder
Developer’s Guide


Example of receiveReplyHandler Code

Any object that acts as an OUTMESSAGE-SOURCE to a SmartProducer must include a receiveReplyHandler() procedure. That procedure handles replies from message recipients. It might perform some or all of these functions:

This is an example of code that performs those functions for some OUTMESSAGE-SOURCE object other than a SmartB2BObject, for example a SmartSender:

DEFINE INPUT PARAMETER hReply AS HANDLE NO-UNDO. 
/* 
** Declare storage for obtaining the properties 
*/ 
DEFINE VARIABLE cOriginalMsgID AS CHARACTER NO-UNDO. 
DEFINE VARIABLE cReplyType AS CHARACTER NO-UNDO. 
DEFINE VARIABLE cPropertyNames AS CHARACTER NO-UNDO. 
DEFINE VARIABLE cProperty AS CHARACTER NO-UNDO. 
DEFINE VARIABLE cPropType AS CHARACTER NO-UNDO. 
DEFINE VARIABLE iThisProp AS INTEGER NO-UNDO. 
DEFINE VARAIBLE cCharProp AS CHARACTER NO-UNDO. 
DEFINE VARIABLE dDecProp AS DECIMAL NO-UNDO. 
DEFINE VARIABLE iIntProp AS INTEGER NO-UNDO. 
DEFINE VARIABLE lLogicProp AS LOGICAL NO-UNDO. 
DEFINE VARIABLE mReplyBody AS MEMPTR NO-UNDO. 
/* 
** Identify the original message using the reply handle, get property names 
*/ 
cOriginalMsgID = DYNAMIC-FUNCTION('getJMSCorrelationID':U IN hReply). 
cPropertyNames = DYNAMIC-FUNCTION(‘getPropertyNames’:U IN hReply). 
/* 
** Loop through all properties, extracting their values according to type 
*/ 
DO iThisProp = 1 TO NUM-ENTRIES(cPropertyNames): 
 cProperty = ENTRY(iThisProp, cPropertyNames). 
 cPropType = DYNAMIC-FUNCTION(‘getPropertyType’:U IN hReply,  
                INPUT cProperty). 
 CASE cPropType: 
   
  WHEN ‘String’:U THEN DO: 
   cCharProp = DYNAMIC-FUNCTION(‘getCharProperty’:U IN hReply,  
                INPUT cProperty). 
   /*  
   ** Insert code here to process this character property  
   */ 
  END.  
  WHEN ‘Boolean’:U THEN DO: 
   lLogicProp = DYNAMIC-FUNCTION(‘getLogicalProperty’:U IN hReply,  
                INPUT cProperty). 
   /*  
   ** Insert code here to process this logical property  
   */ 
  END.   
  WHEN ‘Byte’:U OR WHEN ’Short’ OR WHEN ‘Int’ THEN DO: 
   iIntProp = DYNAMIC-FUNCTION(‘getIntProperty’:U IN hReply,  
                 INPUT cProperty). 
   /*  
   ** Insert code here to process this integer property  
   */ 
  END. 
  WHEN ‘Long’:U OR WHEN ’Float’ OR WHEN ‘Double’ THEN DO: 
   iDecProp = DYNAMIC-FUNCTION(‘getDecProperty’:U IN hReply,  
                 INPUT cProperty). 
   /*  
   ** Insert code here to process this integer property  
   */ 
  END. 
 END. /* case cproptype */ 
END. /* do iThisProp */ 
  
/* 
** Identify the reply type 
*/ 
cReplyType = DYNAMIC-FUNCTION(‘getMessageType’:U IN hReply). 
/* 
** Extract the reply body in the appropriate format 
*/ 
CASE cReplyType: 
 WHEN ‘BytesMessage’:U THEN DO 
  mReplyBody = DYNAMIC-FUNCTION(‘getMemptr’:U IN hReply). 
 END. /* when bytesmessage */ 
 WHEN ‘TextMessage’:U OR WHEN ‘XMLMessage’:U THEN DO: 
  DO WHILE (DYNAMIC-FUNCTION(‘endOfStream’:U IN hReply) = FALSE: 
   cReplyBody = DYNAMIC-FUNCTION(‘getTextSegment’:U IN hReply). 
   /*  
   ** Insert code here to put returned text segments into a form,  
   ** such as temp-table records, that can be read by the routine 
   ** that will process the body of this reply 
   */ 
  END. /* do while */ 
 END. /* when textmessage */ 
END. /* case cReplyType */ 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095