Author |
Message
|
MiLi |
Posted: Thu Mar 15, 2007 12:47 am Post subject: SET Attribute on MRM Message - I'm lost |
|
|
Acolyte
Joined: 07 Oct 2005 Posts: 51
|
Hi
I'm starting to think I'm stupid here so please help me.
I'm trying to do one of the simplest things I'v done in the broker.
I have a MsgSet for with an XML format with namespaces and Attributes.
lets say the message looks like this:
<sw8:Message xmlns:sw8="fake.url">
<sw8:Inf>
<sw8:Ustrd Ccy="EUR">Invoice</sw8:Ustrd>
</sw8:Inf>
</sw8:message>
I can parse the message on input and get the value on Ccy with
Code: |
InputRoot.MRM.sw8:Inf.Ccy |
Now to the problem:
When I create the Message from esql and use
Code: |
SET OutputRoot.MRM.sw8:Inf = 'Invoice'
SET OutputRoot.MRM.sw8:Inf.Ccy = 'EUR' |
It doesnt work.
It creates the message:
<sw8:Message xmlns:sw8="fake.url">
<sw8:Inf>
<sw8:Ustrd>
Invoice
<Ccy>EUR</Ccy>
</sw8:Ustrd>
</sw8:Inf>
</sw8:message>
It seams that OutputRoot.MRM.sw8:Inf.Ccy does not point to the attribute element in the MRM. Any ideas... This is an example from the top of my head, sorry for any typos.. _________________ IBM Certified System Administrator - WebSphere MQ V6.0
IBM Instructor - WebSphere MQ, WebSphere Message Broker
Last edited by MiLi on Thu Mar 15, 2007 5:12 am; edited 1 time in total |
|
Back to top |
|
 |
Calvino |
Posted: Thu Mar 15, 2007 2:51 am Post subject: |
|
|
 Novice
Joined: 06 Mar 2004 Posts: 19 Location: Scotland
|
You need to specify the fact that its an attribute I think ... Try something like:
Code: |
SET OutputRoot.MRM."sw8:RmtInf"(XML.Attribute)"Ccy" = 'EUR';
|
Cheers
Corrine |
|
Back to top |
|
 |
MiLi |
Posted: Thu Mar 15, 2007 3:26 am Post subject: |
|
|
Acolyte
Joined: 07 Oct 2005 Posts: 51
|
Quote: |
SET OutputRoot.MRM."sw8:RmtInf"(XML.Attribute)"Ccy" = 'EUR'; |
Nope, thats the point with MRM, it is a parser not a physic structur
You can only specify XML.Attribute when using XML or XMLNS (XMLNSC.Attribute for XMLNSC) _________________ IBM Certified System Administrator - WebSphere MQ V6.0
IBM Instructor - WebSphere MQ, WebSphere Message Broker |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Thu Mar 15, 2007 3:28 am Post subject: |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
Calvino wrote: |
You need to specify the fact that its an attribute I think ... Try something like:
Code: |
SET OutputRoot.MRM."sw8:RmtInf"(XML.Attribute)"Ccy" = 'EUR';
|
Cheers
Corrine |
I'm not 100% sure but I think that if in your Message definition field is defined as attribute you don't need to use (XML.Attribute).
Maybe you should check definition of message.
Marcin |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Mar 15, 2007 3:34 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
With MRM, you don't need to even specify namespace prefixes, I think. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Thu Mar 15, 2007 3:37 am Post subject: |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
jefflowrey wrote: |
With MRM, you don't need to even specify namespace prefixes, I think. |
I'm not 100% sure , but I think you have to.
Marcin |
|
Back to top |
|
 |
MiLi |
Posted: Thu Mar 15, 2007 3:51 am Post subject: |
|
|
Acolyte
Joined: 07 Oct 2005 Posts: 51
|
marcin.kasinski wrote: |
jefflowrey wrote: |
With MRM, you don't need to even specify namespace prefixes, I think. |
I'm not 100% sure , but I think you have to.
Marcin |
Yeah you do, the mrm is build with namespaces but Attributes is an XML representation.
Anyway... I hate working with namespaces !
I did a testflow with a msgset (xml with attributes and no namespaces). And it worked perfect so I dont know... I think I will need to analyze my code some more. I will come back to you if I find the problem. _________________ IBM Certified System Administrator - WebSphere MQ V6.0
IBM Instructor - WebSphere MQ, WebSphere Message Broker |
|
Back to top |
|
 |
kimbert |
Posted: Thu Mar 15, 2007 4:39 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Your problem is that your message tree does not exactly match the structure of your message definition. If the MRM parser cannot match up an element with something in the message definition, it writes it as an element.
If you are using v6, switch on user trace - you will be warned about these 'self-defining' elements.
And if your tree contains namespaces, you do need to use namespace constants in ESQL, even when using the MRM domain ( well, you could write the namespace URLs longhand, I suppose ).
You don't need (XML.Attribute) with MRM. |
|
Back to top |
|
 |
Luca81 |
Posted: Thu Mar 15, 2007 4:45 am Post subject: |
|
|
Acolyte
Joined: 01 Mar 2007 Posts: 62
|
marcin.kasinski wrote: |
jefflowrey wrote: |
With MRM, you don't need to even specify namespace prefixes, I think. |
I'm not 100% sure , but I think you have to.
Marcin |
In MRM namespace is not needed!! |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Thu Mar 15, 2007 4:54 am Post subject: |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
Luca81 wrote: |
In MRM namespace is not needed!! |
I mean when in MRM definition field has namespace I have to specify namespace also in my ESQL code.
You are saying that I can omit namespaces in my ESQL when I use MRM parser ? _________________ Marcin |
|
Back to top |
|
 |
Luca81 |
Posted: Thu Mar 15, 2007 4:58 am Post subject: |
|
|
Acolyte
Joined: 01 Mar 2007 Posts: 62
|
marcin.kasinski wrote: |
Luca81 wrote: |
In MRM namespace is not needed!! |
I mean when in MRM definition field has namespace I have to specify namespace also in my ESQL code.
You are saying that I can omit namespaces in my ESQL when I use MRM parser ? |
I never put namespace when i have a MRM domian... I don t know if it's correct but i never had problems... |
|
Back to top |
|
 |
MiLi |
Posted: Thu Mar 15, 2007 5:08 am Post subject: |
|
|
Acolyte
Joined: 07 Oct 2005 Posts: 51
|
This is starting to get complicated. First
Luca81: When you say you dont use namespaces in mrm, do you work with xml namespace messages? like soap for example !
Or is there a way of define a message set without namespaces that can describe a xml with namespace... Anyone follow me ?
Second:
kimbert wrote: |
Your problem is that your message tree does not exactly match the structure of your message definition. If the MRM parser cannot match up an element with something in the message definition, it writes it as an element.
If you are using v6, switch on user trace - you will be warned about these 'self-defining' elements.
And if your tree contains namespaces, you do need to use namespace constants in ESQL, even when using the MRM domain ( well, you could write the namespace URLs longhand, I suppose ).
You don't need (XML.Attribute) with MRM. |
Yeah I know... The thing is I cant se how I'm not setting the right element when InputRoot.MRM.sw8:RmtInf.Ccy works and returns the data but OutputRoot.MRM.sw8:RmtInf.Ccy dont set the same field!
Personally I think the Tookit 6.0.2 is bugged! when testing today I added namespaces to my messageset and since 6.0.2 I cant get code completion with messagesets with namespaces. se my thread http://www.mqseries.net/phpBB2/viewtopic.php?t=35667&highlight=code+completion  _________________ IBM Certified System Administrator - WebSphere MQ V6.0
IBM Instructor - WebSphere MQ, WebSphere Message Broker |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Thu Mar 15, 2007 5:09 am Post subject: |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
Luca81 wrote: |
marcin.kasinski wrote: |
Luca81 wrote: |
In MRM namespace is not needed!! |
I mean when in MRM definition field has namespace I have to specify namespace also in my ESQL code.
You are saying that I can omit namespaces in my ESQL when I use MRM parser ? |
I never put namespace when i have a MRM domian... I don t know if it's correct but i never had problems... |
OK. I'm trying to understand it .
If you are saying that I can omit namespace tell me how I can read in my ESQL these 2 DATA fields (or generate output message).
One is without namespace, second has it.
Code: |
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:mynamespace="http://serverabc.com"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<DATA>123</DATA>
<mynamespace:DATA>456</mynamespace:DATA>
</soapenv:Body>
</soapenv:Envelope> |
_________________ Marcin |
|
Back to top |
|
 |
kimbert |
Posted: Thu Mar 15, 2007 6:39 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
In MRM namespace is not needed!! |
Stop! This is false information, and very misleading to other users of this forum.
- If you are using the MRM domain for parsing non-XML data, there is no need to use namespaces.
- If you are using the MRM domain for parsing XML data then you should enable namespace support in the message set ( that's the default in v6 anyway, and the xsd importer also does this for you ).
- If namespaces are enabled in the message set, the MRM parser will build a message tree in which each element has both a name and a namespace. If the input document contains some elements without a namespace, the namespace fields will be empty for those elements.
- It is very bad practice to parse (in the MRM domain ) a namespaced XML document using a message set which has namespaces disabled. The parsing will appear to work correctly, but you will end up with a solution which is fragile and unmaintainable. |
|
Back to top |
|
 |
MiLi |
Posted: Fri Mar 16, 2007 2:31 am Post subject: |
|
|
Acolyte
Joined: 07 Oct 2005 Posts: 51
|
I now know what the problem is !
The Broker Toolkit 6.0.2 is crap !
I suggest you read my first Post in this thread as we got lost on the way !
The new Toolkit cant give me Code Completion in ESQL if the message set has a namespace other than 'http://*.*.*....' !!!
My messages got namespaces 'urn:iso:.....'
Even more stranger is that it also solved my problem with setting an attribute in mrm.
I will test this some more to be more precise about the problem.
And last some bonus info:
You can specify an attribute in MRM with
Code: |
SET OutoutRoot.MRM.Element."@test" = test; |
_________________ IBM Certified System Administrator - WebSphere MQ V6.0
IBM Instructor - WebSphere MQ, WebSphere Message Broker |
|
Back to top |
|
 |
|