Chapter 26. Building and testing message flow for Retrieve 503
f. Sets the following business object top-level values:
version = 3.0.0
delta = FALSE
verb = taken from input business object
locale = en_US
g. Sets the following business object data values:
•XMLDeclaration
Schema location (The JMS connector uses it for the application data.
h. Sets the following tenant object details:
The output ID is taken from the input tenant object ID.
The output name is taken from the input tenant object name.
The output e-mail is taken from the input tenant object e-mail.
i. Sets the address object details.
j. Loops through, and for each input maintenance record, creates an output
maintenance record and formats the output.
k. Sets the last of the message properties.
Example 26-5 ResponseRetrieve
CREATE COMPUTE MODULE ResponseRetrieve
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
-- (Remove for mapping node
CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
-- *** Schema Declarations ***
-- Red Tenant Web Application
DECLARE Web_tenant NAMESPACE
'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/Web_tenant';
DECLARE Web_tenant_tenant NAMESPACE
'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/Web_tenant_tenant';
DECLARE Web_tenant_maintenance NAMESPACE
'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/Web_tenant_maintenance';
DECLARE Web_tenant_maintenances NAMESPACE
'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/Web_tenant_maintenances';
DECLARE Web_tenant_apartment NAMESPACE
'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/Web_tenant_apartment';
DECLARE Web_tenant_apartments NAMESPACE
'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/Web_tenant_apartments';
504 WebSphere Business Integration Adapters
-- Red Maintenance Back-end Application
DECLARE RM_Tenant NAMESPACE
'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/RM_Tenant';
DECLARE RM_Maintenance NAMESPACE
'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/RM_Maintenance';
DECLARE RM_Apartment NAMESPACE
'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/RM_Apartment';
-- ** Properties
SET OutputRoot.Properties.MessageSet = 'WebTenant';
SET OutputRoot.Properties.MessageType = 'Web_tenant';
-- Enter SQL below this line. SQL above this line might be regenerated, causing any
modifications to be lost.
-- ** MQMD
SET "OutputRoot"."MQMD".Format = 'MQHRF2 ';
SET OutputRoot.MQMD.MsgType = 8;
SET OutputRoot.MQMD.ReplyToQ = ' ';
SET OutputRoot.MQMD.ReplyToQMgr = ' ';
-- ** RFH
SET "OutputRoot".MQRFH2.(MQRFH2.Field)Format = 'MQSTR ';
SET "OutputRoot".MQRFH2.mcd.Msd = 'mrm';
SET "OutputRoot".MQRFH2.mcd.Set = 'WebTenant';
SET "OutputRoot".MQRFH2.mcd.Type = 'Web_tenant';
SET "OutputRoot".MQRFH2.mcd.Fmt = 'CwXML';
-- response queue
SET "OutputRoot".MQRFH2.jms.Rto = 'queue:///WEBTENANT.RESULT';
-- Include for mapping mode
-- SET OutputRoot.MRM = InputRoot.MRM ;
-- ** Set Verb and locale information
SET OutputRoot.MRM."version" = '3.0.0';
SET OutputRoot.MRM."delta" = FALSE;
SET OutputRoot.MRM."verb" = InputRoot.MRM.verb;
SET OutputRoot.MRM."locale" = 'en_US';
-- ** Set BO fields
-- Web_tenant:XMLDeclaration
SET OutputRoot.MRM.Web_tenant:XMLDeclaration = 'xml version="1.0" encoding="UTF-8"';
-- ** set the schema location so the JMS connector can fill in the details for the
onwards processing to the application
Chapter 26. Building and testing message flow for Retrieve 505
--
Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:schemaLocation
SET
OutputRoot.MRM.Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:schemaLoca
tion
= '"http://www.ibm.com/RedTenant tenant.xsd"' ;
-- ** Set the tenant details
SET
OutputRoot.MRM.Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:id =
InputRoot.MRM.RM_Tenant:Id;
SET
OutputRoot.MRM.Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:name =
InputRoot.MRM.RM_Tenant:Name;
SET
OutputRoot.MRM.Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:email =
InputRoot.MRM.RM_Tenant:EMail;
-- ** Set the address
--
Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:apartments.Web_tenant_apa
rtments:Web_tenant_apartments.Web_tenant_apartments:apartment.(XML.attr)size='1'
SET
OutputRoot.MRM.Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:apartments
.Web_tenant_apartments:Web_tenant_apartments.Web_tenant_apartments:apartment.size = '1';
--
Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:apartments.Web_tenant_apa
rtments:Web_tenant_apartments.Web_tenant_apartments:apartment.Web_tenant_apartment:Web_tenant_a
partment.Web_tenant_apartment:id
SET
OutputRoot.MRM.Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:apartments
.Web_tenant_apartments:Web_tenant_apartments.Web_tenant_apartments:apartment.Web_tenant_apartme
nt:Web_tenant_apartment.Web_tenant_apartment:id
= CAST(InputRoot.MRM.RM_Tenant:RM_Apartment.RM_Apartment:RM_Apartment.RM_Apartment:Id AS
CHARACTER) ;
--
Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:apartments.Web_tenant_apa
rtments:Web_tenant_apartments.Web_tenant_apartments:apartment.Web_tenant_apartment:Web_tenant_a
partment.Web_tenant_apartment:address
SET
OutputRoot.MRM.Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:apartments
506 WebSphere Business Integration Adapters
.Web_tenant_apartments:Web_tenant_apartments.Web_tenant_apartments:apartment.Web_tenant_apartme
nt:Web_tenant_apartment.Web_tenant_apartment:address
=
InputRoot.MRM.RM_Tenant:RM_Apartment.RM_Apartment:RM_Apartment.RM_Apartment:ApartmentNumber ||
' '||
InputRoot.MRM.RM_Tenant:RM_Apartment.RM_Apartment:RM_Apartment.RM_Apartment:AddressLine1
|| ' ' ||
InputRoot.MRM.RM_Tenant:RM_Apartment.RM_Apartment:RM_Apartment.RM_Apartment:AddressLine2
|| ' ' ||
InputRoot.MRM.RM_Tenant:RM_Apartment.RM_Apartment:RM_Apartment.RM_Apartment:AddressLine3
|| ' ' ||
InputRoot.MRM.RM_Tenant:RM_Apartment.RM_Apartment:RM_Apartment.RM_Apartment:AddressLine4
;
--
Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:apartments.Web_tenant_apa
rtments:Web_tenant_apartments.Web_tenant_apartments:apartment.Web_tenant_apartment:Web_tenant_a
partment.Web_tenant_apartment:postcode
SET
OutputRoot.MRM.Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:apartments
.Web_tenant_apartments:Web_tenant_apartments.Web_tenant_apartments:apartment.Web_tenant_apartme
nt:Web_tenant_apartment.Web_tenant_apartment:postcode
=
InputRoot.MRM.RM_Tenant:RM_Apartment.RM_Apartment:RM_Apartment.RM_Apartment:PostCode ;
-- *** Set the maintenance records
DECLARE C INTEGER 1;
DECLARE M INTEGER;
SET M = CAST(InputRoot.MRM.RM_Tenant:RM_Maintenance.size AS INTEGER) ;
SET
OutputRoot.MRM.Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:apartments
.Web_tenant_apartments:Web_tenant_apartments.Web_tenant_apartments:apartment.Web_tenant_apartme
nt:Web_tenant_apartment.Web_tenant_apartment:maintenances.Web_tenant_maintenances:Web_tenant_ma
intenances.Web_tenant_maintenances:maintenance.size = CAST (M AS CHARACTER);
WHILE C <= M DO
DECLARE MaintInfo CHARACTER ;
SET
OutputRoot.MRM.Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:apartments
.Web_tenant_apartments:Web_tenant_apartments.Web_tenant_apartments:apartment.Web_tenant_apartme
nt:Web_tenant_apartment.Web_tenant_apartment:maintenances.Web_tenant_maintenances:Web_tenant_ma
intenances.Web_tenant_maintenances:maintenance.Web_tenant_maintenance:Web_tenant_maintenance[C]
.Web_tenant_maintenance:id
Chapter 26. Building and testing message flow for Retrieve 507
=
CAST(InputRoot.MRM.RM_Tenant:RM_Maintenance.RM_Maintenance:RM_Maintenance[C].RM_Maintenance:Id
AS CHARACTER);
CASE
InputRoot.MRM.RM_Tenant:RM_Maintenance.RM_Maintenance:RM_Maintenance[C].RM_Maintenance:Status
WHEN 'A' THEN
SET
OutputRoot.MRM.Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:apartments
.Web_tenant_apartments:Web_tenant_apartments.Web_tenant_apartments:apartment.Web_tenant_apartme
nt:Web_tenant_apartment.Web_tenant_apartment:maintenances.Web_tenant_maintenances:Web_tenant_ma
intenances.Web_tenant_maintenances:maintenance.Web_tenant_maintenance:Web_tenant_maintenance[C]
.Web_tenant_maintenance:status
= 'ACTIVE';
WHEN 'P' THEN
SET
OutputRoot.MRM.Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:apartments
.Web_tenant_apartments:Web_tenant_apartments.Web_tenant_apartments:apartment.Web_tenant_apartme
nt:Web_tenant_apartment.Web_tenant_apartment:maintenances.Web_tenant_maintenances:Web_tenant_ma
intenances.Web_tenant_maintenances:maintenance.Web_tenant_maintenance:Web_tenant_maintenance[C]
.Web_tenant_maintenance:status
= 'IN PROGRESS';
WHEN 'C' THEN
SET
OutputRoot.MRM.Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:apartments
.Web_tenant_apartments:Web_tenant_apartments.Web_tenant_apartments:apartment.Web_tenant_apartme
nt:Web_tenant_apartment.Web_tenant_apartment:maintenances.Web_tenant_maintenances:Web_tenant_ma
intenances.Web_tenant_maintenances:maintenance.Web_tenant_maintenance:Web_tenant_maintenance[C]
.Web_tenant_maintenance:status
= 'COMPLETED';
ELSE
SET
OutputRoot.MRM.Web_tenant:ROOT.Web_tenant_tenant:Web_tenant_tenant.Web_tenant_tenant:apartments
.Web_tenant_apartments:Web_tenant_apartments.Web_tenant_apartments:apartment.Web_tenant_apartme
nt:Web_tenant_apartment.Web_tenant_apartment:maintenances.Web_tenant_maintenances:Web_tenant_ma
intenances.Web_tenant_maintenances:maintenance.Web_tenant_maintenance:Web_tenant_maintenance[C]
.Web_tenant_maintenance:status
=
InputRoot.MRM.RM_Tenant:RM_Maintenance.RM_Maintenance:RM_Maintenance[C].RM_Maintenance:Status ;
END CASE;
SET MaintInfo = ' ';
IF
InputRoot.MRM.RM_Tenant:RM_Maintenance.RM_Maintenance:RM_Maintenance[C].RM_Maintenance:ProblemD
escription IS NULL THEN
ELSE

Get WebSphere Business Integration Adapters: An Adapter Development and WebSphere Business Integration Solution now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.