ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » SET Attribute on MRM Message - I'm lost

Post new topic  Reply to topic Goto page 1, 2  Next
 SET Attribute on MRM Message - I'm lost « View previous topic :: View next topic » 
Author Message
MiLi
PostPosted: Thu Mar 15, 2007 12:47 am    Post subject: SET Attribute on MRM Message - I'm lost Reply with quote

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
View user's profile Send private message
Calvino
PostPosted: Thu Mar 15, 2007 2:51 am    Post subject: Reply with quote

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
View user's profile Send private message
MiLi
PostPosted: Thu Mar 15, 2007 3:26 am    Post subject: Reply with quote

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
View user's profile Send private message
marcin.kasinski
PostPosted: Thu Mar 15, 2007 3:28 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Thu Mar 15, 2007 3:34 am    Post subject: Reply with quote

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
View user's profile Send private message
marcin.kasinski
PostPosted: Thu Mar 15, 2007 3:37 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
MiLi
PostPosted: Thu Mar 15, 2007 3:51 am    Post subject: Reply with quote

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
View user's profile Send private message
kimbert
PostPosted: Thu Mar 15, 2007 4:39 am    Post subject: Reply with quote

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
View user's profile Send private message
Luca81
PostPosted: Thu Mar 15, 2007 4:45 am    Post subject: Reply with quote

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
View user's profile Send private message
marcin.kasinski
PostPosted: Thu Mar 15, 2007 4:54 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Luca81
PostPosted: Thu Mar 15, 2007 4:58 am    Post subject: Reply with quote

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
View user's profile Send private message
MiLi
PostPosted: Thu Mar 15, 2007 5:08 am    Post subject: Reply with quote

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
View user's profile Send private message
marcin.kasinski
PostPosted: Thu Mar 15, 2007 5:09 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
kimbert
PostPosted: Thu Mar 15, 2007 6:39 am    Post subject: Reply with quote

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
View user's profile Send private message
MiLi
PostPosted: Fri Mar 16, 2007 2:31 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » SET Attribute on MRM Message - I'm lost
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.