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 » Namespace Defaulting - MRMs

Post new topic  Reply to topic
 Namespace Defaulting - MRMs « View previous topic :: View next topic » 
Author Message
venusboy
PostPosted: Mon Nov 20, 2006 5:48 pm    Post subject: Namespace Defaulting - MRMs Reply with quote

Acolyte

Joined: 11 Jun 2002
Posts: 51

I have an XML Schema that I have modelled as an MRM, primary for validation purposes. The schema uses namespaces.

WMB decides to add namespace prefixes to the outgoing message, I need to default the namespace so that the prefixes do not appear (to reduce the size of the message).

Please note, I understand there are multiple posts on this subject, but I do not wish to remove the prefixes, just set a default namespace.

E.g. a simple example would be:

I need to output:

<book xmlns='urn:loc.gov:books'
<title>Cheaper by the Dozen</title>
</book>

My current output is:

<bookns:book xmlns:bookns='urn:loc.gov:books'
<bookns:title>Cheaper by the Dozen</bookns:title>
</bookns:book>

So I assume that I only need to perform something like:

OutputRoot.MRM.xmlns = 'urn:oc.gov:books'

But as am using MRMs then this attribute is not defined (or the namespace of this attribute is not defined). I have defined the default namespace within the MRM.

This is such an obvious thing to do need to do and would expect this as the default behaviour but am at a loss.

Thanks in advance.
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Tue Nov 21, 2006 12:29 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi venusboy,
venusboy wrote:
Please note, I understand there are multiple posts on this subject, but I do not wish to remove the prefixes, just set a default namespace.
I'm hoping u meant that u dont need the prefixes but the default namespace to apply.

For this
Quote:
<book xmlns='urn:loc.gov:books'
<title>Cheaper by the Dozen</title>
</book>

Try this (Untested code)
Code:
DECLARE ns NAMESPACE "urn:loc.gov:books";

CALL CopyMessageHeaders();
CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNSC' NAME 'XMLNSC';

CREATE FIELD OutputRoot.XMLNSC.ns:Book;

SET OutputRoot.XMLNSC.ns:Book.(XML.NamespaceDecl) = 'urn:loc.gov:books';
SET OutputRoot.XMLNSC.ns:Book.ns:title = 'Cheaper by the Dozen';

Regards.
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Tue Nov 21, 2006 1:26 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Hi venusboy,

You can set namespace prefixes for the MRM XML parser using a table in the XML message set properties. I'm not sure whether you are allowed to specify an empty prefix, though.
If you can't do it that way, you could switch to XMLNSC for output ( as elvis_gn suggests) - assuming that you do not require validation of the output message.
Back to top
View user's profile Send private message
venusboy
PostPosted: Tue Nov 21, 2006 2:31 am    Post subject: Reply with quote

Acolyte

Joined: 11 Jun 2002
Posts: 51

Kimbert, Elvis;

Thanks guys for your posts.

Kimbert, yes I need to validate the XML message, the actual message is a full soap envelope with about 8 namespaces thus having the prefixes really does increase the size.

The namespace mappings do not allow NULL. If they are not defined then the NS1, NS2 prefixes occur.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Nov 21, 2006 4:09 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

So you need validation, but the only parser which can validate cannot output default namespaces. Do you really need to validate the output message. Would it be OK to validate the input message, and output using XMLNSC ( without validation )?
If you really require validation of the output message, the only other option is
- use a Validate node to validate the message tree while you're in the MRM domain
- Construct the output message tree under OutputRoot.XMLNSC
- Add namespace decls for the default namespace
Back to top
View user's profile Send private message
venusboy
PostPosted: Tue Nov 21, 2006 4:25 am    Post subject: Reply with quote

Acolyte

Joined: 11 Jun 2002
Posts: 51

Kimbert,

Thanks for your reply. Yes I really do need to validate the outgoing message if not I am breaking a contract between services and the system I am connecting to is external.

I suppose the question is performance, I don't wish to increase each message by a 20%, but the alternatives that you have sugguested would (I suppose) result in more CPU activity.

I just thought it was a very simple thing to want to do and it was something I have missed in the documention.
Back to top
View user's profile Send private message
fazz
PostPosted: Tue Nov 21, 2006 6:16 am    Post subject: Reply with quote

Centurion

Joined: 20 Feb 2004
Posts: 144
Location: England

Not really a solution more of a compromise........but how about setting the prefixes in the message set file to be only one character long..?
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 » Namespace Defaulting - MRMs
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.