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 » working with namespaces in JCN (XMLNSC)

Post new topic  Reply to topic
 working with namespaces in JCN (XMLNSC) « View previous topic :: View next topic » 
Author Message
ananddhavlikar
PostPosted: Thu Aug 20, 2015 12:24 am    Post subject: working with namespaces in JCN (XMLNSC) Reply with quote

Newbie

Joined: 20 Aug 2015
Posts: 3

I am working with soap service. I need to extract payload and push it to file system.
Payload has 2 namespaces, which are defined at envelope level.
When I copy MB element for(payload) of incoming request , it creates multiple references for all elements belonging to particular namespace.
How to overcome this and have namespaces defined only at root xml tag.
Back to top
View user's profile Send private message
ananddhavlikar
PostPosted: Thu Aug 20, 2015 12:26 am    Post subject: Reply with quote

Newbie

Joined: 20 Aug 2015
Posts: 3

I have a soap webservice , which has job of extracting payload and pushing it to file system.
Here is the soap sample

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://services.nwslutils.com/services/UtilitiesGroup/UtilityDeleverables/UtilityEquipment/v1/" xmlns:esb="http://services.nwslutils.com/schema/EAI/Common/ESBHeader/" xmlns:v2="http://entity.nwslutils.com/ESB/cim/v2_3/">
<soapenv:Header>
<v1:ESBHeaderType>
<TransactionContext>
<esb:TransactionID>12123</esb:TransactionID>
</TransactionContext>
</v1:ESBHeaderType>
</soapenv:Header>
<soapenv:Body>
<v1:publishETARequest>
<lineModel verb="Create">
<shieldWire verb="Create">
<v2:eleId1>1</v2:eleId1>
<v2:eleId2>1</v2:eleId2>
</shieldWire>
</lineModel>
</v1:publishETARequest>
</soapenv:Body>
</soapenv:Envelope>

Expected output is as below
<?xml version="1.0" encoding="UTF-8"?>
<v1:publishETARequest xmlns:v1="http://services.nwslutils.com/services/UtilitiesGroup/UtilityDeleverables/UtilityEquipment/v1/"
xmlns:v2="http://entity.nwslutils.com/ESB/cim/v2_3/">
<lineModel verb="Create">
<shieldWire verb="Create">
<v2:eleId1>1</v2:eleId1>
<v2:eleId2>1</v2:eleId2>
</shieldWire>
</lineModel>
</v1:publishETARequest>


Where as when I extract payload (Using Java compute node & copying element tree), it creates following output, and creates multiple field level references for same namespace.
<?xml version="1.0" encoding="UTF-8"?>
<v1:publishETARequest xmlns:v1="http://services.nwslutils.com/services/UtilitiesGroup/UtilityDeleverables/UtilityEquipment/v1/"
xmlns:v2="http://entity.nwslutils.com/ESB/cim/v2_3/">
<lineModel verb="Create">
<shieldWire verb="Create">
<NS1:eleId1 xmlns:NS1="http://entity.nwslutils.com/ESB/cim/v2_3/">1</NS1:eleId1>
<NS2:eleId2 xmlns:NS2="http://entity.nwslutils.com/ESB/cim/v2_3/">1</NS2:eleId2>
</shieldWire>
</lineModel>
</v1:publishETARequest>

How to overcome this?
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Aug 20, 2015 3:33 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

In XML Terms where is the problem. Sure, they look different but that isn't my question.

Are the two XML structures logically the same?
Is the namespace set right?
Do both results validate against the design XSD?

I know that this question has been asked before. Unless there is a functional difference in the XML structures then what is the problem?
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
ananddhavlikar
PostPosted: Thu Aug 20, 2015 3:50 am    Post subject: Reply with quote

Newbie

Joined: 20 Aug 2015
Posts: 3

Yes both xml's are valid, problem is with downstream legacy system which is not using xsd parsing, they are treating it as a string and using tag name to retrieve data.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Aug 20, 2015 4:36 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

You need to create an XMLNSC.NameSpaceDecl to declare the namespace at root level. This way it is declared only once in the document and only referenced thereafter.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Thu Aug 20, 2015 5:09 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

fjb_saper wrote:
You need to create an XMLNSC.NameSpaceDecl to declare the namespace at root level. This way it is declared only once in the document and only referenced thereafter.


Would that really get rid of the namespace prefix before the tag name?

Is there any reason to allow the receiver to continue to NOT use a proper XML parser? The kind of hackery they are doing is really unacceptable in modern programming environments.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Aug 20, 2015 9:43 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

mqjeff wrote:


Is there any reason to allow the receiver to continue to NOT use a proper XML parser? The kind of hackery they are doing is really unacceptable in modern programming environments.


Exactly my thoughts. The problem with parsing a perfectly valid XML Message is THEIR PROBLEM not yours.

Yes it has been a hard day struggling with a contact admin external WebService. far too much
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Aug 20, 2015 9:48 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

smdavies99 wrote:
far too much


Define this strange term. Exactly how far are we talking here? I certainly have never visited this strange place.

But:

smdavies99 wrote:
The problem with parsing a perfectly valid XML Message is THEIR PROBLEM not yours




Even:

ananddhavlikar wrote:
system which is not using xsd parsing


No one is saying that the system needs to validate it against an XSD, just parse it.

ananddhavlikar wrote:
they are treating it as a string and using tag name to retrieve data


Then they should make their lives easier and ask for a text file in a tag & value format. It's easy enough for you to generate with a DFDL schema, and saves them wading through all the < and > that they are clearly ignoring. Possible structures include (but are not limited to):
Code:

publishETARequest:lineModel#"Create";shieldWire#"Create";eleId#1;eleId2#1;


Isn't that more compact, yet containing all the information they need searchable by tag? I bet they'd get performance improvements out of the reduced string manipulation.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Aug 20, 2015 2:32 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

mqjeff wrote:
fjb_saper wrote:
You need to create an XMLNSC.NameSpaceDecl to declare the namespace at root level. This way it is declared only once in the document and only referenced thereafter.


Would that really get rid of the namespace prefix before the tag name?

Is there any reason to allow the receiver to continue to NOT use a proper XML parser? The kind of hackery they are doing is really unacceptable in modern programming environments.

Depending on how you set the name space declaration it could. (default namespace vs named namespace)...

But I do agree with you. A decent XML parser would not worry about those details...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » working with namespaces in JCN (XMLNSC)
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.