Author |
Message
|
fde |
Posted: Thu Jun 04, 2009 3:20 am Post subject: Mapping empty simple objects |
|
|
Acolyte
Joined: 05 Jul 2007 Posts: 65
|
I am using the mapping node in Broker 6.1 to map an object within the xmlnsc domain.
Empty elements are not mapped currently.
I am receiving:
<data>
<stringField1></stringField1>
<stringField2>HelloWorld</stringField2>
</data>
The mapping node connects stringField1 with stringField1 of the target MessageSet. But the empty field is not mapped.
<data>
<stringField2>HelloWorld</stringField2>
</data>
The missing field stringField1 is defined as mandatory in the MessageSet, so now the message is no longer valid. I saw some custom solutions with esql code as a mapping directive but this scenario could happen for a lot more fields, so custom processing is not a good option.
I tested some configurations with global "xml representation of null values" with "Null value" for non-numeric null values without success.
Any suggestion for mapping empty xml elements? _________________ Global warming is an unintentional side effect of SOA's hotness.
-- http://soafacts.com/
a business integration methodology |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Jun 04, 2009 7:53 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Have you tried using a value clause?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
AkankshA |
Posted: Thu Jun 04, 2009 8:48 pm Post subject: |
|
|
 Grand Master
Joined: 12 Jan 2006 Posts: 1494 Location: Singapore
|
from 6.1 Help
ESQL support for null values
Using ESQL, you can set the value of a message tree element to NULL:SET OutputRoot.XMLNSC.myField VALUE = NULL;
Note that this is quite different from SET OutputRoot.XMLNSC.myField = NULL; which would cause myField to be deleted from the message tree.
The same effect can be achieved using Java or a Mapping node. _________________ Cheers |
|
Back to top |
|
 |
kimbert |
Posted: Fri Jun 05, 2009 1:15 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
fde |
Posted: Fri Jun 05, 2009 3:45 am Post subject: |
|
|
Acolyte
Joined: 05 Jul 2007 Posts: 65
|
Thank you. I implemented a 'per field' solution in an esql node:
Code: |
SET OutputRoot = InputRoot;
SET OutputLocalEnvironment = InputLocalEnvironment;
IF InputRoot.MRM.StringField IS NULL
THEN
SET OutputRoot.MRM.StringField = '';
END IF;
RETURN TRUE;
|
This is working for the implemented field. Although I think, that the mapping node should be able to do the same.
There is a difference between an element being null and an element having a value of null. Imo the mapping node should care for that difference. _________________ Global warming is an unintentional side effect of SOA's hotness.
-- http://soafacts.com/
a business integration methodology |
|
Back to top |
|
 |
kimbert |
Posted: Fri Jun 05, 2009 4:02 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
That sounds like the correct approach for now.
I've made the appropriate developer aware of this shortcoming in the Mapping node. |
|
Back to top |
|
 |
fde |
Posted: Fri Jun 05, 2009 6:05 am Post subject: |
|
|
Acolyte
Joined: 05 Jul 2007 Posts: 65
|
Thank you for your patience, I had to discard my esql-node solution. I was not able to match the correct order of elements.
Instead I went to esql mapping directives. I enveloped each of those empty elements with an "if" mapping declaration with condition
Code: |
esql:is-null($source/myElement)
|
That worked very well. But it is still a solution for a particular element, not a whole message. I would have to envelope all elements with this structure.
I will set up a low priority pmr for this.
Thank you again. _________________ Global warming is an unintentional side effect of SOA's hotness.
-- http://soafacts.com/
a business integration methodology |
|
Back to top |
|
 |
fde |
Posted: Fri Jun 05, 2009 6:12 am Post subject: |
|
|
Acolyte
Joined: 05 Jul 2007 Posts: 65
|
Yes, thanks, I found that initially, I got my esql-mapping-directive aproach from there. Compared to op, luckily I can set my simple types to '' in order to generade an empty element. _________________ Global warming is an unintentional side effect of SOA's hotness.
-- http://soafacts.com/
a business integration methodology |
|
Back to top |
|
 |
|