Author |
Message
|
kash3338 |
Posted: Tue May 23, 2017 9:28 am Post subject: XML Namespace behaviour in IIB |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
Hi all,
We are migrating code from WMB v6.0 to IIB v9.0. The code is migrated using the Toolkit. We faced the below scenario when testing one of the services.
The message was tested in WMB v6 and IIB v9 versions. The response XML of the service has "Multiple prefix with same namespace", for example,
Code: |
<NS1:Response xmlns:NS1="http://www.xyz.com/sample" xmlns:NS2="http://www.xyz.com/sample"> |
When we test the code in WMB v6, we get below kind of response,
Code: |
<NS1:Response xmlns:NS1="http://www.xyz.com/sample" xmlns:NS2="http://www.xyz.com/sample">
<NS1:Details>
<NS1:ele>
<NS1:ID System="abc">1457833066</NS1:ID>
<NS1:Type>DDD</NS1:Type>
</NS1:ele>
</NS1:Details>
</NS1:Response>
|
The same when tested with IIB v9, we get,
Code: |
<NS2:Response xmlns:NS1="http://www.xyz.com/sample" xmlns:NS2="http://www.xyz.com/sample">
<NS2:Details>
<NS2:ele>
<NS2:ID System="abc">1457833066</NS2:ID>
<NS2:Type>DDD</NS2:Type>
</NS2:ele>
</NS2:Details>
</NS2:Response>
|
The Namespace prefix coming in response is different in both environments. There is no code difference in both the environments. What could be the reason for this difference? This is not a problem/issue for the overall result, but why is it we see a difference? Is the parsing any different? |
|
Back to top |
|
 |
mqjeff |
Posted: Tue May 23, 2017 10:14 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Why do you have two namespace declarations for the same namespace? _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
kash3338 |
Posted: Tue May 23, 2017 9:15 pm Post subject: |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
mqjeff wrote: |
Why do you have two namespace declarations for the same namespace? |
This is some 15 years old code. No idea why they had declared twice, we don't see any valid reason for that from the code analysis. We are just migrating the code and came across this scenario. We can change the code and move forward, but this namespace declaration is done on a common procedure. |
|
Back to top |
|
 |
timber |
Posted: Wed May 24, 2017 11:14 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
If the two prefixes are associated with the same url then it doesn't matter which one is used. I suspect that the parser uses a hashmap to store the prefix-to-namespace mappings and it's not fussy about which of the two alternatives gets selected.
FWIW, I suspect that you could easily get different results from v6 on two different machines. |
|
Back to top |
|
 |
kash3338 |
Posted: Tue Jun 06, 2017 9:33 pm Post subject: |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
timber wrote: |
If the two prefixes are associated with the same url then it doesn't matter which one is used. |
Agreed!
timber wrote: |
I suspect that the parser uses a hashmap to store the prefix-to-namespace mappings and it's not fussy about which of the two alternatives gets selected.
FWIW, I suspect that you could easily get different results from v6 on two different machines. |
Looks like this is true for IIB. We see different namespaces when tried in different Brokers. But for WMB v6, its always one namespace. Is this something only specific to IIB? May be this Hasmap mapping is done only on the new version? |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jun 07, 2017 3:07 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
... was the old code running on v6 using the XMLNS parser?
Did you switch it in the new code to use the XMLNSC parser?
That would be the right thing to do, and would also explain the differences... _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
kash3338 |
Posted: Wed Jun 07, 2017 8:54 am Post subject: |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
mqjeff wrote: |
... was the old code running on v6 using the XMLNS parser?
Did you switch it in the new code to use the XMLNSC parser?
That would be the right thing to do, and would also explain the differences... |
No. Both running on XMLNSC. Same code runs in both environments, no differences. |
|
Back to top |
|
 |
|