Author |
Message
|
pcelari |
Posted: Tue Nov 11, 2014 6:32 am Post subject: Sub message in XMLNSC domain question |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
Haven't done msgset work for quite a while. It's time to clean up old flows developed long ago in XML domain.
Our standard XML message has a Header section, and a Data section of string type.
Since the Data section contains a different sub-tree depending on object it references, I used ESQL to manually parse this portion of the message.
With the intention to avoid manually parsing the XML subtree in ESQL, I'm thinking to define a series of XML messages in a container project, each corresponds to a single type of object and then reference it in some way from the parent message.
Is this the correct way? I also wonder what the above "some way" should be.
many thanks for any input.
 _________________ pcelari
-----------------------------------------
- a master of always being a newbie |
|
Back to top |
|
 |
kimbert |
Posted: Tue Nov 11, 2014 12:17 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I cannot work out whether the 'Data' section is XML or some other format.
And I cannot work out whether you have
a) written a parser in ESQL or
b) called one of the built in parsers using CREATE...PARSE.
Either way, if you are on v8 or later you should not be talking about using message sets. That would imply using the MRM parser. You should be using schemas deployed in libraries, and the XMLNSC parser.
I won't suggest a solution for modelling the Data section until I understand the problem a bit better. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
pcelari |
Posted: Wed Nov 12, 2014 5:25 am Post subject: |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
Sorry for not clear enough. The flow was developed in WMB 6.1 8 yrs ago.
Yes, the data section is XML, but doesn't contain namespace element. In the flow, I did use the XMLNSC parser, but the data section in the InputRoot is manually parsed as I knew the content layout, although they are not part of the general message which contains only Header, and Data as string.
The Output is Cobol and defined in an MRM, I have replaced that with DFDL.
I'm thinking about replacing the compute node with the new Mapping node in v9. So the first step seems should be creating a sub-message for each individual Data object.
I do also realize however, compute node is still the most capable node, not everything can be replaced, esp. if somehow sophisticated manipulation is needed. That's why up to now, I have used neither mapping nor any of the database nodes in my flows. The conversion also looks like a very expensive task. _________________ pcelari
-----------------------------------------
- a master of always being a newbie |
|
Back to top |
|
 |
kimbert |
Posted: Wed Nov 12, 2014 6:11 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
the data section is XML, but doesn't contain namespace element. |
Again, this is not technical language, and I don't know what you mean. Please use recognized technical language ( the language used by the XML specification ) or else explain what you mean using an example.
Quote: |
I did use the XMLNSC parser, but the data section in the InputRoot is manually parsed as I knew the content layout |
I still cannot work out what you mean. Please explain ( with an example, if necessary ) what you mean by 'manually parsed'.
When you talk to a co-worker you can safely assume that they know what you are doing. When you ask for help on this forum, please assume that we know *nothing* about your data, your message flows and your working practices. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
pcelari |
Posted: Wed Nov 12, 2014 7:22 am Post subject: |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
Sorry, hope it's clear now.
Message Set for the XML envelope:
mbMsg.mxsd
Messages
Message
{Local complexType}
Header
{Local complexType}
Data xs:string
ESQL using performing the operation, etc.:
CREATE COMPUTE MODULE orderXformRouting_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
-- CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
declare mb namespace 'http://ws.intg.mycomp.com/MSG';
set OutputRoot.Properties.MessageSet = 'ITEMRecord';
set OutputRoot.Properties.MessageType = 'DeliveryOrder';
set OutputRoot.Properties.MessageFormat = 'Binary1';
set OutputRoot.MRM.VIN = InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.VIN;
declare source char InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.UpdateTimeStamp;
declare target TIMESTAMP;
declare pattern char 'yyyy-MM-dd HH:mm:ss';
set target = cast (source as TIMESTAMP FORMAT pattern);
set OutputRoot.MRM.UpdtDate = cast(target as char format 'yyyyMMdd');
set OutputRoot.MRM.UpdtTime = cast(target as char format 'HHmmss');
set OutputRoot.MRM.StoreLocal = InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.StoreCode;
set OutputRoot.MRM.PurchaseStatus = InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.ProcessStatus;
set OutputRoot.MRM.CustomerName = InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.RequestorName;
set OutputRoot.MRM.ItemID = InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.Component;
set OutputRoot.MRM.LocationID = InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.Location;
set OutputRoot.MRM.Damage = InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.Damage;
IF (InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.Destination is not null) and
(InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.Destination <> '') then
set OutputRoot.MRM.StoreLocalShip = InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.Destination;
end if;
set OutputRoot.MRM.Message = Substring(InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.Text from 1 for 4 ;
set OutputLocalEnvironment.Destination.MQDestinationList.DestinationData.queueName = 'DELIVERY.INSTR.'||TRIM(InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.StoreCode);
RETURN TRUE;
END;
When you say from v8 on, one should not be using "messages". doesn't XMLNSC also needs a message set definition to be used?[/img] _________________ pcelari
-----------------------------------------
- a master of always being a newbie |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Nov 12, 2014 7:40 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
v8 and later don't use *message sets*. xsds are used directly, not .mxsd files nor .mset files. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Nov 13, 2014 2:53 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Reposting using [c o d e] tags:
Code: |
Message Set for the XML envelope:
mbMsg.mxsd
Messages
Message
Header
Data xs:string |
ESQL code:
Code: |
CREATE COMPUTE MODULE orderXformRouting_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
-- CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
declare mb namespace 'http://ws.intg.mycomp.com/MSG';
set OutputRoot.Properties.MessageSet = 'ITEMRecord';
set OutputRoot.Properties.MessageType = 'DeliveryOrder';
set OutputRoot.Properties.MessageFormat = 'Binary1';
set OutputRoot.MRM.VIN = InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.VIN;
declare source char InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.UpdateTimeStamp;
declare target TIMESTAMP;
declare pattern char 'yyyy-MM-dd HH:mm:ss';
set target = cast (source as TIMESTAMP FORMAT pattern);
set OutputRoot.MRM.UpdtDate = cast(target as char format 'yyyyMMdd');
set OutputRoot.MRM.UpdtTime = cast(target as char format 'HHmmss');
set OutputRoot.MRM.StoreLocal = InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.StoreCode;
set OutputRoot.MRM.PurchaseStatus = InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.ProcessStatus;
set OutputRoot.MRM.CustomerName = InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.RequestorName;
set OutputRoot.MRM.ItemID = InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.Component;
set OutputRoot.MRM.LocationID = InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.Location;
set OutputRoot.MRM.Damage = InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.Damage;
IF (InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.Destination is not null) and
(InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.Destination <> '') then
set OutputRoot.MRM.StoreLocalShip = InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.Destination;
end if;
set OutputRoot.MRM.Message = Substring(InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.Text from 1 for 4;
set OutputLocalEnvironment.Destination.MQDestinationList.DestinationData.queueName = 'DELIVERY.INSTR.'||TRIM(InputRoot.XMLNSC.mb:Msg.mb:Data.ITEMRecord.StoreCode);
RETURN TRUE;
END; |
_________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Nov 13, 2014 2:54 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Looks like a very simple mapping from input to output. The Mapping node would be an excellent choice, in my opinion. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
|