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 » How to let the non xml chars to pass through XMLNSC domain

Post new topic  Reply to topic
 How to let the non xml chars to pass through XMLNSC domain « View previous topic :: View next topic » 
Author Message
mqlover
PostPosted: Mon Feb 24, 2014 10:20 pm    Post subject: How to let the non xml chars to pass through XMLNSC domain Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

HI,

Kindly help me on the below query:

I have a XML msg coming, but they are sending & in the xml tag, due to which my message is not passing thru as I have selected XMLNSC parser in the MQInput node. Now the application team wants me to change my code in such a way that even if there are some non XML chars or whatever I should just pass the message to MQOutput node, without throwing any exception.
The other application listening on this queue would reject the message.

How do I handle such a issue? Kindly help me out.

Thanks
Back to top
View user's profile Send private message
Simbu
PostPosted: Mon Feb 24, 2014 10:41 pm    Post subject: Reply with quote

Master

Joined: 17 Jun 2011
Posts: 289
Location: Tamil Nadu, India

If you are just passing the message to MQOutput then you can receive the message as BLOB and pass as it is.
Back to top
View user's profile Send private message
mqlover
PostPosted: Mon Feb 24, 2014 10:51 pm    Post subject: How to let the non xml chars to pass through XMLNSC domain Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

Sorry, now found out that the issue is not because of & in the XML structure.
I found that the upstream application is sending <?xml version=1..>
in the middle of the XML message and the broker is throwing error as "XML parser having errors".
When I removed this whole tag in the middle of the msg, I am able to see that broker is able to parse the msg.
Now how can broker handle with XMLNSC parser such messages.
I need to use XMLNSC parser as I have to fetch a field in the XML message and I cannot pass the msg as blob.

Hope am clear with my issue, can anybody help me on this?

Thanks
Back to top
View user's profile Send private message
smdavies99
PostPosted: Mon Feb 24, 2014 11:20 pm    Post subject: Reply with quote

Jedi Council

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

I'm guessing that the message you are getting is invalid.
Why not pass it through an XML Validator (plenty on the web) and see.
If it fails the validity test kick the message right back at the people who are sending it to you.
_________________
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
mqlover
PostPosted: Tue Feb 25, 2014 1:06 am    Post subject: How to let the non xml chars to pass through XMLNSC domain Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

Yes, I validated and the xml is invalid. But still the upstream appliation wants the broker to pass it to the downstream application and let they validate teh xml.

So how could I do this?

Is it feasible to attach the failure terminal in the MQInput node to the MQOutput node?

Like whatever be the message just put in the output queue?
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Tue Feb 25, 2014 1:48 am    Post subject: Re: How to let the non xml chars to pass through XMLNSC doma Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

Sending Applications should send valid XML. Valid XML will/can be processed by the XMLNSC parser.

You are doing Systems Integration with Broker, and you even may agree to compensate inefficiencies of partner/attached systems.

Including that the xml declaration occurs in the middle of a file. This happens if you say, hey, we concatenate some xml-documents and wrap it with a root element (to make it valid xml)....

.... you forgot about the xml-declaration, which NOW occurs somewhere (probably multiple times) in (the middle of) the document/file/msg. BUT: It is only allowed to occur at the beginning ONCE.

First thing to do: Check if you can FIX your logic (on the partner/sending) side. They should be sending VALID (well formed) XML!

Unfortunately it can really/acutally happen that... you can't fix it there (e.g. it has been coded some time ago and people left, there is only something (compiled code) in production. You don't have control (you work in an other department of your company)). Then you may want to do INTEGRATION WORK with Broker (it's a tool for the job):

Take it in as a BLOB, probably cast to string... cut out the xml-declarations (with some logic). Then use a reset content descriptor and parse with XMLNSC
_________________
Just use REFERENCEs


Last edited by mqsiuser on Tue Feb 25, 2014 2:02 am; edited 2 times in total
Back to top
View user's profile Send private message
Gralgrathor
PostPosted: Tue Feb 25, 2014 1:59 am    Post subject: Reply with quote

Master

Joined: 23 Jul 2009
Posts: 297

MRM takes in XML with invalid characters with no problem, as far as I know. You'll still have problems writing to XML though, so you'll need to do something about that content before passing on the message.
_________________
A measure of wheat for a penny, and three measures of barley for a penny; and see thou hurt not the oil and the wine.
Back to top
View user's profile Send private message Send e-mail
Simbu
PostPosted: Tue Feb 25, 2014 3:39 am    Post subject: Reply with quote

Master

Joined: 17 Jun 2011
Posts: 289
Location: Tamil Nadu, India

I had the same issue before and as a temporary solution, I followed the below. Permanent solution is source app needs to fix it

1. Read as blob
2. surround the field value(has special character) with CDATA( with REPLACE function)
3. Then parse as XMLNSC.
Back to top
View user's profile Send private message
mban
PostPosted: Tue Feb 25, 2014 5:16 am    Post subject: Reply with quote

Newbie

Joined: 25 Dec 2013
Posts: 3

Just a thought..can't we use opaque parsing for that field
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Feb 25, 2014 1:12 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

The only reasonable thing to do is to fix the sending application. It is broken. No program is likely to accept that XML document, even if you kludge your message flow to ignore its brokenness.
If you try to 'fix' it by parsing as BLOB and adding a CDATA section then you are likely to get it wrong - unless you write most of an XML parser in ESQL.

Galgrathor: As far as I know, MRM-XML does not accept badly-formed XML documents of any kind. What makes you think that it does?
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
mban
PostPosted: Tue Feb 25, 2014 8:54 pm    Post subject: Reply with quote

Newbie

Joined: 25 Dec 2013
Posts: 3

I was thinking we can parse with XMLNSC parser and under parser options tab specify/add opaque element.

From the Infocenter:
When opaque parsing is enabled, some parts of the message are never parsed, and XML that is either badly formed or not valid is allowed to pass through the message flow without being detected

Please correct me if my understanding is wrong.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Feb 26, 2014 12:21 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

It is possible that opaque parsing will allow XMLNSC to create a message tree for this document.
I still recommend that the sending application is fixed.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Wed Feb 26, 2014 1:06 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.

Any 'FIX' that you might put into your code to get over the problem might only work in the short term.

What happens is a different XML-Declaration tag is put into the data?

Can you cater for ALL Possible illegal tag combinations?

My advice would be to throw is back to the originators as Kimbert suggests. Until they send you valid XML then stand your ground.

If you are forced into catering for it then make sure you have documented everything to CYA with your manager (and their boss) so that when it fails in production you can say with honesty, 'I told you so'.

Any fix is a pure BODGE and really has no place in a broker flow. That said, sometimes needs must.
_________________
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
mqsiuser
PostPosted: Wed Feb 26, 2014 1:18 am    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

smdavies99 wrote:
What happens is a different XML-Declaration tag is put into the data?

Can you cater for ALL Possible illegal tag combinations?

Probably the OP doesn't have 2 choices, but only one (do it himself).

If you properly understand what is going on (e.g. XML-declarations are coming in through the way I described) and you have a very good understanding of XML-Standards (you should have as a Broker-Developer), then you are probably fine coding in the flow.

It may even be fine to fix your flow (again) later, if problems get detected during testing (öhmmm... pro ... proddd... probably )

smdavies99 wrote:
That said, sometimes needs must.

Better than having/doing nothing... it all depends on the project.
_________________
Just use REFERENCEs
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 » How to let the non xml chars to pass through XMLNSC domain
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.