Author |
Message
|
pcelari |
Posted: Wed Jan 31, 2007 11:34 am Post subject: one tag too many in output msg |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
My first test msgflow finally put a MRM XML msg to the output Q.
However it added an extra pair of tags.
What I expect is:
<?xml version="1.0" encoding="UTF-8"?>
<mc:Message xmlns:mc="http://ei.myco.com/MC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<mc:ServiceName>EI::MyService</mc:ServiceName>
...
</mc:Message>
But here is what I get:
<?xml version="1.0"?>
<mc:Message xmlns:mc="http://ei.myco.com/MC" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xml="http://www.w3.org/XML/1998/namespace">
<mc:Message>
<mc:ServiceName>EI::MyService</mc:ServiceName>
...
</mc:Message>
</mc:Message>
Why am I getting this extra skin <mc:Message>?
I set the Root Tag Name field empty. According to document, it will default to Root Tag Name setting of the msgset. But I can't even find such an entry in the msgset properties.
Also, how can I get rid of those xmlns:xml, xmlns:xsd?
How can I populate the encoding field? I set the default encoding to UTF-8 in the Properties of msgset, but it doesn't fill in the place as I expect.
I sense it must be sth trivial, can anyone point me to the right place? _________________ pcelari
-----------------------------------------
- a master of always being a newbie |
|
Back to top |
|
 |
pathipati |
Posted: Wed Jan 31, 2007 12:02 pm Post subject: |
|
|
Master
Joined: 03 Mar 2006 Posts: 296
|
Can you post your ESQL here? |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jan 31, 2007 12:24 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If you're ESQL says "OutputRoot.MRM.Message", then this is the problem.
It should say only "OutputRoot.MRM".
You control the namespaces on the message object by changing settings on the XML properties in the model. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
pcelari |
Posted: Wed Jan 31, 2007 12:34 pm Post subject: |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
Here it is. Maybe my inclusion of MRM domain is responsible for this?
CREATE COMPUTE MODULE SvcRqst_ToSvc
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
declare mb namespace 'http://ei.MyCom.com/MC';
SET OutputRoot.MRM.mc:Message.mc:MessageHeader.mc:BusinessService=
InputBody.ServiceName;
set OutputRoot.Properties.MessageSet = 'Svc_Msgset';
set OutputRoot.Properties.MessageType = 'SvcRqst';
set OutputRoot.Properties.MessageFormat = 'XML1';
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE; _________________ pcelari
-----------------------------------------
- a master of always being a newbie
Last edited by pcelari on Thu Feb 01, 2007 4:28 am; edited 1 time in total |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jan 31, 2007 12:37 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
pcelari wrote: |
SET OutputRoot.MRM.mc:Message.mc:MessageHeader.mc:BusinessService=
InputBody.ServiceName; |
Set OutputRoot.MRM.mc:MessageHeader.mc:BusinessService=InputBody.ServiceName; _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jan 31, 2007 3:10 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
hi pcelari,
Congratulations on getting this far. Here are answers to the other questions you asked:
- You cannot remove the xml declarations for xsd and xml - but they are harmless
- Assuming that you are on v6, you can ask the MRM XML writer to insert an encoding attribute in the XML decl. It will choose one based on the CCSID of the message.
If you really care about getting the exact output, build the output tree in the XMLNSC domain. |
|
Back to top |
|
 |
pcelari |
Posted: Thu Feb 01, 2007 4:46 am Post subject: |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
jefflowrey wrote: |
Set OutputRoot.MRM.mc:MessageHeader.mc:BusinessService=InputBody.ServiceName; |
Wooow, that did the trick! Now I understand that by putting mc:Message after MRM, I forced it one level down the tree to become a child element of itself, thus the extra layer.
Thank you soooo much for all the generous helps along the way!
thanks Kimbert, I hope I'll catch up with the skills quickly so I can help other just as well.
kimbert wrote: |
you can ask the MRM XML writer to insert an encoding attribute in the XML decl. It will choose one based on the CCSID of the message.
If you really care about getting the exact output, build the output tree in the XMLNSC domain.
|
Can you articulate a little more on this? what is MRM XML writer? I'll check the documentation on building output in the xmlnsc domain. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Feb 01, 2007 5:15 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
what is MRM XML writer? |
Sorry - I should have said 'the MRM parser'. The MRM XML writer is the component of the MRM parser which is responsible for constructing the output bitstream from a message tree.
If you look in the MRM XML message set properties you will see a property 'XML Encoding'. If that does not do what you need, you'll need to use XMLNSC instead. |
|
Back to top |
|
 |
|