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 » Mapping empty simple objects

Post new topic  Reply to topic
 Mapping empty simple objects « View previous topic :: View next topic » 
Author Message
fde
PostPosted: Thu Jun 04, 2009 3:20 am    Post subject: Mapping empty simple objects Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Thu Jun 04, 2009 7:53 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
AkankshA
PostPosted: Thu Jun 04, 2009 8:48 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
kimbert
PostPosted: Fri Jun 05, 2009 1:15 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I think the mapping node is at fault here. You may find this thread helpful.
http://www.mqseries.net/phpBB2/viewtopic.php?t=48957&sid=3faadcdce30135715a11d8faa75b0b02

Let me know how you get on.
Back to top
View user's profile Send private message
fde
PostPosted: Fri Jun 05, 2009 3:45 am    Post subject: Reply with quote

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
View user's profile Send private message
kimbert
PostPosted: Fri Jun 05, 2009 4:02 am    Post subject: Reply with quote

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
View user's profile Send private message
fde
PostPosted: Fri Jun 05, 2009 6:05 am    Post subject: Reply with quote

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
View user's profile Send private message
fde
PostPosted: Fri Jun 05, 2009 6:12 am    Post subject: Reply with quote

Acolyte

Joined: 05 Jul 2007
Posts: 65

kimbert wrote:
I think the mapping node is at fault here. You may find this thread helpful.
http://www.mqseries.net/phpBB2/viewtopic.php?t=48957&sid=3faadcdce30135715a11d8faa75b0b02

Let me know how you get on.


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

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Mapping empty simple objects
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.