Author |
Message
|
EricCox |
Posted: Wed Oct 24, 2012 7:27 am Post subject: How to Handle Namespaces Dynamically in ESQL in WMB 6.0.0.9? |
|
|
Master
Joined: 08 Apr 2011 Posts: 292
|
To all,
I've been told to handle inbound request namespace declarations dynamically.
I read another post that mentioned using a namespace wildcard prefix as such
Code: |
DECLARE ref_CustInfo REFERENCE TO InputRoot.XML."*:Envelope"."*:Body"."getCustConsLoanAcctsRq"."CustInfo"; |
That didn't work. I am using the default parser.
This code with the fully qualified namespace I used during development works:
Code: |
DECLARE ref_CustInfo REFERENCE TO InputRoot.XML."SOAP-ENV:Envelope"."SOAP-ENV:Body"."getCustConsLoanAcctsRq"."CustInfo";
|
How do I handle variable namespace declarations dynamically?
Thanks,
Eric |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Oct 24, 2012 7:31 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
6.0 is unsupported and has many malfunctions with regard to namespaces.
Code: |
SET myvar = InputRoot.SOAP.Body.somenamespace:hisvar; |
_________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Oct 24, 2012 7:35 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Why, at all, are you expecting the XML parser, which is KNOWN AND DESIGNED NOT TO SUPPORT NAMESPACES, to support namespaces?
At a *bare* minimum, you *must* use XMLNS.
 |
|
Back to top |
|
 |
EricCox |
Posted: Wed Oct 24, 2012 7:53 am Post subject: Legacy |
|
|
Master
Joined: 08 Apr 2011 Posts: 292
|
You can degrade me all you want for being on an unsupported version, having legacy code, using the XML parser etc. I totally understand that.
Given no training, legacy code and being under the pressure of producing a working service I've done that.
Now, how do I change to the XMLNSC parser and how do I change my code once having done so to handle namespaces dynamically?
Thanks |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Oct 24, 2012 7:55 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You change "OutputRoot.XML" to "OutputRoot.XMLNS" or "OutputRoot.XMLNSC".
That's it.
But it's *vital* to know what "OutputRoot.XML" means, and why that's different than "OutputRoot.BLOB" and "OutputRoot.MRM" and etc. If you don't *know* that, and *understand* that, you don't really know broker.
It's *vital* to using the product, regardless of version and training. |
|
Back to top |
|
 |
EricCox |
Posted: Wed Oct 24, 2012 8:04 am Post subject: Different Types of Message Trees |
|
|
Master
Joined: 08 Apr 2011 Posts: 292
|
From what I can tell they are different types of message trees, byte streams and corresponding parsers and message definitions that work with them. For instance MRM works with CWF Message Definitions...etc.
I guess I'm probably oversimplifying them.
In this case I'm working on an 'Inbound' Request.
So you suggest I use InputRoot.XMLNSC.x.x.x?
If so then how do I handle the namespace declarations dynamically? Can I use the * wildcard? |
|
Back to top |
|
 |
Vitor |
Posted: Wed Oct 24, 2012 8:14 am Post subject: Re: Different Types of Message Trees |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
EricCox wrote: |
So you suggest I use InputRoot.XMLNSC.x.x.x? |
If it works under 6.0.0.9.
EricCox wrote: |
If so then how do I handle the namespace declarations dynamically? Can I use the * wildcard? |
If it works.
You might also be able to determine what namespace is in use, which could help when you need to know more than the value of an element irrespective of it's namespace.
But in a rare turn of events, I agree with the previous poster in that 6.0 is unsupported and sucked at working with namespaces. If my dim recollection is correct, the XMLNSC parser doesn't exist in that version but came in the v6.1.
6.0 did (I think) have XMLNS which, as I indicated above, sucked at namespaces.
In your position I'd tell whoever's telling you to support dynamic namespaces you need a more recent version of WMB to do it.
Or just tell them they've been running the risk of using out of support software, and the risk just failed to pay off. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
vmcgloin |
Posted: Wed Oct 24, 2012 8:28 am Post subject: Re: Different Types of Message Trees |
|
|
Knight
Joined: 04 Apr 2002 Posts: 560 Location: Scotland
|
Vitor wrote: |
In your position I'd tell whoever's telling you to support dynamic namespaces you need a more recent version of WMB to do it.
Or just tell them they've been running the risk of using out of support software, and the risk just failed to pay off. |
Or read 'Using XML namespaces' in your version of the infocenter and try
Code: |
DECLARE ref_CustInfo REFERENCE TO InputRoot.XMLNS.*:Envelope.*:Body.getCustConsLoanAcctsRq.CustInfo; |
- along with other changes indicated in migrating from the XML to XMLNS parser in said infocenter
..then enthusiastically offer to lead the software upgrade to latest supported version with all the other benefits that brings.  |
|
Back to top |
|
 |
EricCox |
Posted: Wed Oct 24, 2012 9:17 am Post subject: Somthing Else |
|
|
Master
Joined: 08 Apr 2011 Posts: 292
|
I've changed the HTTPInput Node to use XMLNS and have changed the reference to use InputRoot.XMLNS but it doesn't appear to be working.
Do I need to do something else? |
|
Back to top |
|
 |
wbi_telecom |
Posted: Wed Oct 24, 2012 9:24 am Post subject: |
|
|
 Disciple
Joined: 15 Feb 2006 Posts: 188 Location: Harrisburg, PA
|
Did you try what vmcgloin suggested in his post? Putting *: in before the tag should let you parse the tag without specifying actual namespace. As far as I know its working like this with XMLNS since 6.0.
Cheers, |
|
Back to top |
|
 |
EricCox |
Posted: Wed Oct 24, 2012 9:34 am Post subject: Tried That |
|
|
Master
Joined: 08 Apr 2011 Posts: 292
|
Here is what I did to follow the suggestions:
1.) Changed the HTTPInput Node to use XMLNS Parser
2.) Changed the setting the REFERENCE as such:
Code: |
DECLARE ref_getCustConsLoanAcctsRq REFERENCE TO InputRoot.XMLNS."*:Envelope"."*:Body"."getCustConsLoanAcctsRq";
IF ref_getCustConsLoanAcctsRq."CustInfo"."CustId" IS NOT NULL THEN
|
The result of this is NULL since it can't navigate into the tree...not sure why? I'm obviously new to XMLNS.
I tried it with and without quotes around the * wildcard.
Do I need to do something else or am not treating the code properly to use XMLNS?
It says it can't navigate into the tree. I'll capture the exact error and post. |
|
Back to top |
|
 |
EricCox |
Posted: Wed Oct 24, 2012 9:40 am Post subject: Flow Config |
|
|
Master
Joined: 08 Apr 2011 Posts: 292
|
Here is how the flow is built:
HTTPInput-XMLNS>>>
Compute-saves RequestId(Mode=Message)>>>>>
CalcStartTime-save Env.Var.StartTime>>>
MainCompute-Using InputRoot.XMLNS.x.x.x
I'm not sure if something in here is interfering with XMLNS?
What is there to look for that would interfere with XMLNS?
From what I understand the HTTPInput Node populates the message tree in the XMLNS Parser and that stays in scope throughout the flow. Is that right? This is just as if I was using XML Parser. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Oct 24, 2012 9:45 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
wbi_telecom wrote: |
Did you try what vmcgloin suggested in his post? |
Don't assume all posters are male. In this instance you are not correct.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
rekarm01 |
Posted: Wed Oct 24, 2012 9:45 am Post subject: Re: Tried That |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
EricCox wrote: |
I tried it with and without quotes around the * wildcard. |
Lose the quotes, especially around the * wildcard.
Get in the habit of using LASTMOVE() to verify that a reference variable is still good, after declaring it or moving it.
Add a Trace node before the Compute node in question, to display the message tree structure, and run a debug-level usertrace. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Oct 24, 2012 9:49 am Post subject: Re: Flow Config |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
EricCox wrote: |
I'm not sure if something in here is interfering with XMLNS? |
It's probably the XMLNS parser code.
EricCox wrote: |
What is there to look for that would interfere with XMLNS? |
The fact that it sucked in that version? An out of support version to which you do not even have all the available fixes applied (the last was v6.0.0.11)
EricCox wrote: |
From what I understand the HTTPInput Node populates the message tree in the XMLNS Parser and that stays in scope throughout the flow. Is that right? This is just as if I was using XML Parser. |
It's the same for all the message domains. Again, asking this demonstrates a fundamental lack of understanding of how WMB works, and has worked both before and after the ancient, creaking version you're trying to use like it's still worth the effort. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|