Author |
Message
|
gus |
Posted: Thu Aug 31, 2006 8:35 am Post subject: Namespaces in message flows |
|
|
Apprentice
Joined: 10 Apr 2002 Posts: 36
|
Good morning,
I am trying to figure out the best way to convert our existing flows to use a new format of the incoming XML with perfixed namespaces. Below is currently the way our incoming request would look like:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<person xmlns:pers="http://sernaferna.com/pers" xmlns:html="http://www.w3.org/1999/xhtml">
<name>
<first>John</first>
<last>DOE</last>
</name>
</person>
What they want it to look like now is:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<pers:person xmlns:pers="http://sernaferna.com/pers" xmlns:html="http://www.w3.org/1999/xhtml">
<pers:name>
<pers:first>John<pers:/first>
<pers:last>DOE<pers:/last>
<pers:/name>
<pers:/person>
I have about 350 flows that will need to be modified for this change. What is going to be my easiest way to do this? any help would be great.
Thank you |
|
Back to top |
|
 |
dgolding |
Posted: Thu Aug 31, 2006 8:49 am Post subject: |
|
|
 Yatiri
Joined: 16 May 2001 Posts: 668 Location: Switzerland
|
Good evening
echo '<?xml version="1.0" encoding="ISO-8859-1" ?>' > hdr
for i in *.htm # Or whatever filename convention you're using
do
cp -p $i $i.SAFE
cat $i|grep -v "xml version"|sed "s/\</\<pers:/g">tail
cat hdr tail > $i
done
rm hdr tail
This is assuming of course, according to the spec I've just seen that everthing that ISN'T "xml version" wants to have this namespace thing
Be REALLY SURE you take a backup before you do this!
Use at your own risk, E&OE, YMMV
A Perl script would be better and probably a lot more portable but I can't be bothered....
I assume you're using a real operating system that allows shell scripting (i.e. not Windows) if not you could probably do this using Cygwin on Windows. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Aug 31, 2006 9:05 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
So you need to update 350 flows to change the interface that the flows expect?
Dgolding's solution isn't going to work for that.
This is a case where using MRM XML would make your life easy - you would have to only change one message set. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
gus |
Posted: Thu Aug 31, 2006 9:28 am Post subject: |
|
|
Apprentice
Joined: 10 Apr 2002 Posts: 36
|
The sample I gave is just one of many xml request. I am just trying to figure out a way to not have to change all the flows and re-deploy all of them. I am thinking of maybe putting transformation layer in the messaging server to strip off the namespace then put it back in after the unit of work is done inside the flows. I was hoping there was someway to ignore the namespace when the message hit the input node of the flow and allow the flow to process the message as normal. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Aug 31, 2006 9:39 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You could certainly add another message flow that would transform messages from the new interface into the old interface.
Then you'd just have to make sure that everyone's messages went there first, and that you can figure out where they were supposed to go next. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Aug 31, 2006 6:19 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
How about adding the attribute elementFormDefault="qualified" to your xml declaration???
Don't know if the standard MRM would pick this up and generate the tags... _________________ MQ & Broker admin |
|
Back to top |
|
 |
|