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 » XMLNSC Problem - What should be '' being interpreted as NULL

Post new topic  Reply to topic
 XMLNSC Problem - What should be '' being interpreted as NULL « View previous topic :: View next topic » 
Author Message
ccrandall
PostPosted: Mon Aug 16, 2010 11:54 am    Post subject: XMLNSC Problem - What should be '' being interpreted as NULL Reply with quote

Acolyte

Joined: 23 Oct 2008
Posts: 52

In my Message Broker framework, we use a XML-based "catalog" to store configuration data. For each incoming request message that is supported, there is typically an entry in the catalog and we match the request message with this entry based on the message name, version, and something called an application function. The framework contains a Java class that reads and parses the XML and places it into the LocalEnvironment. As part of our upgrade to Message Broker 7.0, I'm changing the framework to use the XMLNSC parser. Previously we used the XML parser.

A portion of the catalog that contains these 3 matching parameters looks like this:

<SwitchRecord>
<DiscoveryKey>
<messageName>GetSampleSubjectsForLE</messageName>
<messageVersion>002</messageVersion>
<appFunction/>
</DiscoveryKey>

The Java code that is used to read in the catalog looks like this:

MbMessage aMsgEnvL = new MbMessage(assembly.getLocalEnvironment());
MbElement aNewEnv = aMsgEnvL.getRootElement();

MbElement aVarChild = aNewEnv.getFirstElementByPath("/Variables");
if (aVarChild == null)
{
aVarChild = aNewEnv.createElementAsLastChild("XMLNSC");
aVarChild.setName("Variables");
}

String strXML = getXML(fileLocation);
aVarChild.createElementAsLastChildFromBitstream
(
strXML.getBytes(),
"XMLNSC",
"", "", "",
0, 0, 0
);

After reading the catalog, a user trace showing the LocalEnvironment shows:

(0x01000000:Folder ):SwitchRecord = (
(0x01000000:Folder):DiscoveryKey = (
(0x03000000:PCDataField):messageName = 'GetSampleSubjectsForLE' (CHARACTER)
(0x03000000:PCDataField):messageVersion = '002' (CHARACTER)
(0x01000000:Folder ):appFunction =
)

What bothers me here is that appFunction is interpreted as a Folder with no value instead of a PCDataField with '' for the value.

The catalog is then read into a shared variable:

DECLARE ServiceCatTable SHARED ROW;
SET ServiceCatTable = LocalEnvironment.Variables.XMLNSC;

When the request message is read in, the 3 parameters used to match configuration data in the catalog are put into a RoutingData tree in the Environment. The RoutingData is defined as being in the XMLNSC domain:

CREATE LASTCHILD OF Environment.Variables DOMAIN('XMLNSC') Name 'RoutingData';

When I look at Environment.Variables.RoutingData in the user trace, those 3 matching parameters look like this:

(0x01000000:Folder):RoutingData = ( ['xmlnsc' : 0x1369b2a0]
...
(0x03000000:PCDataField):MessageName = 'GetSampleSubjectsForLE' (CHARACTER)
(0x03000000:PCDataField):MessageVersion = '002' (CHARACTER)
(0x03000000:PCDataField):ApplicationFunction = '' (CHARACTER)
)

Here, the ApplicationFunction is as I expect it to be where it's of type PCDataField with '' as the value.

So, when I try to finding a matching record in the catalog for a case where the application function is empty:

SET Environment.Variables.SwitchRecord =
THE(SELECT ITEM R
FROM ServiceCatTable.MessagingSwitchServiceCatalog.SwitchRecord[] AS R
WHERE R.DiscoveryKey.messageName=Environment.Variables.RoutingData.MessageName AND
R.DiscoveryKey.messageVersion=Environment.Variables.RoutingData.MessageVersion AND
R.DiscoveryKey.appFunction=Environment.Variables.RoutingData.ApplicationFunction);

I don't find a match because R.DiscoveryKey.appFunction evaluates to NULL while Environment.Variables.RoutingData.ApplicationFunction evaluates to ''. I tried wrapping both sides with a FIELDVALUE call, but that didn't help either.

I hope I've provided enough information here to understand what's going on. If anyone can point out my error, I would really appreciate it!

Thank you
Curt
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Aug 16, 2010 3:14 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

As a matter of good practice, use PARSER_NAME
http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/index.jsp?topic=/com.ibm.etools.mft.plugin.doc/com/ibm/broker/plugin/MbXMLNSC.html

As a secondary point, you are making a large large assumption that it is a-okay to use 0 as the CCSID for createElementAsLastChildFromBitstream. Again, as a matter of good practice you should set this to the known correct value.

Neither of these will necessarily resolve the fact that the ESQL CREATE FIELD statement is invoking/creating the XMLNSC parser with different options than the MbElement.createElementAsLastChildFromBitstream is.

You may be able to fake this by using MbSQLStatement to evalute a CREATE FIELD ... DOMAIN statement to create your root node. But I can't guarantee that.

Perhaps someone else will be along with more insight.
Back to top
View user's profile Send private message
ccrandall
PostPosted: Tue Aug 17, 2010 1:49 pm    Post subject: Reply with quote

Acolyte

Joined: 23 Oct 2008
Posts: 52

Thanks for the tips. I took your suggestion about using PARSER_NAME and implemented that. As for the CCSID, since we deploy this framework on a couple different architectures, we used 0 so that we could just get that value from the local queue manager. To change this in a way that would be easy on our clients would require me to add this to configuration somewhere. So, I'll probably look at this change a little later on.

I'll try testing out making the ServiceCatTable variable under the XMLNSC domain and hopefully that work. In the meantime, as a hack, I'm just changing the value of Environment.Variables.RoutingData.ApplicationFunction to NULL when it's initially ''. Hopefully that'll suffice until I can figure out what the root problem is.

Thanks
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Aug 18, 2010 2:13 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

My point on the CCSID is that when unserializing a bitstream, the CCSID *has* to accurately represent the CCSID that the bistream is actually IN.

You don't say where you retrieve the bitstream that represents your message catalog from, so assuming that it is in the CCSID of the queue manager may be okay from a functional view (i.e. "it works").

But it's not okay from a practical view. It's too big of an assumption.
Back to top
View user's profile Send private message
ccrandall
PostPosted: Mon Aug 23, 2010 10:50 am    Post subject: Reply with quote

Acolyte

Joined: 23 Oct 2008
Posts: 52

Good points. I've brought that up with some of the people on my team to discuss. We've been running this code for several years, so I think we are safe keeping it the way it is for the time being, but I think because we are in the middle of migrating to MB v7 that now is a good time to reevaluate these kinds of things.

Thanks
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 » XMLNSC Problem - What should be '' being interpreted as NULL
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.