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 IndexWebSphere Message Broker SupportGetting (badly formed) XMLNSC inputbody without parsing it

Post new topicReply to topic
Getting (badly formed) XMLNSC inputbody without parsing it View previous topic :: View next topic
Author Message
simonalexander2005
PostPosted: Thu Mar 16, 2017 6:55 am Post subject: Getting (badly formed) XMLNSC inputbody without parsing it Reply with quote

Apprentice

Joined: 13 Jun 2016
Posts: 28

I am writing an error handler, that is hooked up to the fail/catch nodes of an MQInput node; and I need to be able to include the failed message inside the error message I'm creating.

The error message being created is in the XMLNSC domain (
Code:
SET OutputRoot.XMLNSC.ExceptionMessage...
); the incoming message could be XMLNSC; or it could be BLOB, so I need to be able to deal with both cases. I am using a Compute node (ESQL) to do this (so the error handler is a subflow that is just Input > ensure error is only handled once no matter how many times it's backed out > compute node to create error message > MQOutput node; with some additional handling of errors within the error handler, so they don't go back to the main part of the message flow).

In the Compute node, I'm pulling various auditing information from the incoming message header; and that works fine. But as soon as I reference InputBody, of course I get an exception if the incoming message is not valid XML.

For example, imagine the incoming message
Code:
<test
. Because it's not well-formed XML, the parser tries to parse it and fails (which is also what caused the error handler to be invoked in the first place!!)

So, how can I grab that badly-formed XML and include it within my output message?

Things I've tried so far

Code:
   
DECLARE InputMessageBlob BLOB ASBITSTREAM(InputBody);
DECLARE InputMessageChar CHAR CAST(InputMessageBlob AS CHAR CCSID InputRoot.MQMD.CodedCharSetId);
SET outRef.nm1:OriginalMessage.(XMLNSC.CDataField)nm1:Content = InputMessageChar;


That fails on the first line with a parser exception.

Code:
SET outRef.nm1:OriginalMessage.(XMLNSC.CDataField)nm1:Content = InputBody;


Again, that fails with a parser exception.

Is there any way around this? The first of the above examples works if the incoming message is valid XML (or even if it's not XML at all) - but not if it's partially formed XML
Back to top
View user's profile Send private message
adubya
PostPosted: Thu Mar 16, 2017 8:00 am Post subject: Reply with quote

Partisan

Joined: 25 Aug 2011
Posts: 368
Location: GU12, UK

Reset Content Descriptor node to change to a BLOB domain and then a compute node which handles that (now) BLOB data as your needs dictate.
_________________
Independent Middleware Consultant
andy@knownentity.com
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Thu Mar 16, 2017 8:06 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17443

Or, you know, check the name of the last child of InputRoot...
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
simonalexander2005
PostPosted: Thu Mar 16, 2017 8:28 am Post subject: Reply with quote

Apprentice

Joined: 13 Jun 2016
Posts: 28

adubya wrote:
Reset Content Descriptor node to change to a BLOB domain and then a compute node which handles that (now) BLOB data as your needs dictate.


That's fantastic! I'd forgotten about that node, and got so focused on doing things within the Compute node that I didn't look into other options.

Thanks
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportGetting (badly formed) XMLNSC inputbody without parsing it
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.