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 » Altering XML message

Post new topic  Reply to topic
 Altering XML message « View previous topic :: View next topic » 
Author Message
mqlover
PostPosted: Sun Jul 17, 2016 10:09 pm    Post subject: Altering XML message Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

Hi,

I have a backend provider who sends the request message along with the response as well but its bit weird format
<Request></Request>
<XML encoding>
<Response></Response>
</XML>
They cannot embed the <Request> tag within the parent XML tag. Is there anyway that broker can take this message as BLOB and then convert into XML.
How can I work on such message as I need the <Response> tag to map the fields and send it to front end.

Thanks
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sun Jul 17, 2016 11:08 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.

Have you actually thought about validating the XML that you receive?
{Using one of the free online validators}

If what you are getting is not valid XML then there is very little you can do with it.
Then you need to go back to whoever is sending it and get them to fix their side.
_________________
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
timber
PostPosted: Mon Jul 18, 2016 2:43 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

Quote:
Is there anyway that broker can take this message as BLOB and then convert into XML.
You have answered your own question. IIB can easily parse it as a BLOB. You can write some code to wrap the incoming message in tags to make it valid ( but we are not going to do that for you ).

Whether you *should* do that is another question, as smdavies99 has rightly pointed out. The sender should not be sending invalid XML.
Back to top
View user's profile Send private message
mqlover
PostPosted: Mon Jul 18, 2016 5:40 pm    Post subject: Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

Hi,

Thanks. I did check with the XML validator tool and it showed me that its an invalid XML, but still the backend vendor is lousy and doesnt want to change the application working.
So, is there anyhting that can be done at the broker end. like reading the BLOB msg, replacing the XML tags found in the middle of the message with some tag and adding XML tags in front of the message i.e BLOB message and then using RCD node to convert into XML by using XMLNSC parser?

This is my thought, donno how much does it makes sense.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Mon Jul 18, 2016 9:55 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.

mqlover wrote:
Hi,

Thanks. I did check with the XML validator tool and it showed me that its an invalid XML, but still the backend vendor is lousy and doesnt want to change the application working.


Time to look for another vendor then? If the XML they are sending is an indication of the quality of their systems.... well, you can draw your own conclusions.

As to fixing the problem at your end,
As Timber has said, you could create a few lines of ESQL that would wrap the incoming message (as a BLOB) with a valid start and end XML tags.

If I were you, I'd do it but make sure that my management knows that total Bodge that you are having to apply to this incoming message and that it may not work reliably. I'd also make sure they know that the problem lies at the Backend Vendor and that they are not following established standards with the data they are sending.
Then you can rest easy.
_________________
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 Jul 19, 2016 12:21 am    Post subject: Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

Thanks Timber and smdavies99 and all.
I did try to wrap the BLOB around XML tags in my ESQL but it threw error saying "XML Parsing Errors have occurred" as there is another <XML> tag in the middle of the message.
<Name>test</Name>
<xml encoding='UTF-8">
<Emp_id>1234</Emp_id>

Could anybody help me with this kind of a weird format message.
Changing a vendor n all is a management issue, my question is, can it be done in iib?

Thanks in advance
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Jul 19, 2016 2:07 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.

cast an opening tag as a blob
cast a corresponding closing tag as a blob
concanenate all three blobs
write BLOB to Queue.

Read message with something like RFHUTIL.
Validate the XML using a web validator.

What do the results say?

don't try to parse it with IIB until you know that you have valid XML
_________________
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
fjb_saper
PostPosted: Tue Jul 19, 2016 4:21 am    Post subject: Reply with quote

Grand High Poobah

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

The problem is your second tag which starts as an XML declaration.
Your best bet would be to use a DFDL format and cut it into 2 records
Then drop the xml declaration and rebuild it all as DFDL with a correct XML format. You can then reparse as XML.

Alternatively parse as DFDL, reparse the second record as XML(NSC) and add the first record to the outbound XML tree in a correct position....

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqlover
PostPosted: Tue Jul 19, 2016 6:22 pm    Post subject: Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

Thanks fjb_saper.
To confirm if my understanding is correct, I have to set the message domain to DFDL in the input parsing on MQInput node. And then I need to parse as XMLNSC? I havent used DFDL till date, let me try and come out with more questions.
But the XML tags before encountering the "<xml>" tag is not fixed, it varies for each messages.

Thanks
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jul 20, 2016 3:53 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You can't use DFDL to parse XML messages.

You can use the DFDL parser to split the incoming message into two pieces, assuming there's some reasonable way to tell when the request ends and when the response starts. I suppose in theory you could look for the </XML> tag and use that as a separator.

Once you have done something - either using DFDL or using a BLOB that you manually split - you can then use the XMLNSC parser to parse the two different XML documents.

It's a terrible idea for anyone to send two XML messages in the same chunk of data like this. Anyone who wants to deal with it then has to do exactly this - split it in two and then parse each part separately.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
mqlover
PostPosted: Tue Aug 02, 2016 6:47 pm    Post subject: Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

Hi,

I was in the midst of trying the above process but some discussions did happen at the management level to pressurize for the XML format message itself

Thanks all for the extended help provided.

Thanks
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 » Altering XML message
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.