Author |
Message
|
abhishekp061 |
Posted: Wed Nov 02, 2022 8:48 am Post subject: How to handle invalid junk characters at beginning |
|
|
Newbie
Joined: 28 Feb 2022 Posts: 7
|
Hi, I am receiving an XML file with invalid junk characters at the beginning of the file as below:
MDE H"¸MQSTR AMQ COREDC.QM4 Ègcù; ÿÿÿÿ
<?xml version="1.0" encoding="UTF-8"?>
<messageListFromWcs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="WcsToHost.xsd">
<datetime>2022-11-02T11:38:14</datetime>
<sequenceNo>00091456</sequenceNo>
The message is failing at IIB due to parsing errors.
How do I handle this message successfully in IIB? without failing the message by extracting only the XML body and discarding the invalid junk characters at the beginning of the file? |
|
Back to top |
|
 |
gbaddeley |
Posted: Wed Nov 02, 2022 2:21 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
It looks like the XML file contains a MQMD structure at the beginning. This is not junk, it contains very useful information for MQ.
You need to investigate how it got there, as normally MQMD is separate from the message data, and would not be expected before data that you need to parse.
Is it really a "file", or is it data from an MQ input node? _________________ Glenn |
|
Back to top |
|
 |
abhishekp061 |
Posted: Thu Nov 03, 2022 2:31 am Post subject: |
|
|
Newbie
Joined: 28 Feb 2022 Posts: 7
|
Hi, The data is coming from an external system which is running an unsupported version of MQ.
This MQMD header is unwanted and needs to be stripped off before processing.
At IIB, I first read the file as BLOB and then converted it to a string. How can I extract only the XML part of it and discard the unwanted MQMD header? |
|
Back to top |
|
 |
markt |
Posted: Thu Nov 03, 2022 6:25 am Post subject: |
|
|
 Knight
Joined: 14 May 2002 Posts: 508
|
That's not an MQMD. It's an MQMDE. Which you will see if
a) the sender has used some of the extended descriptor fields like groupId AND
b) the receiver has done an MQGET asking for an MQMDv1 structure
Make sure the getting application has set
and the extension block won't be needed - the fields will be in the MQMD. |
|
Back to top |
|
 |
abhishekp061 |
Posted: Thu Nov 03, 2022 6:58 am Post subject: |
|
|
Newbie
Joined: 28 Feb 2022 Posts: 7
|
The getting application is Datapower.
Datapower fetches the messages from an external queue and forwards the same to IIB.
The source has CCSID 1208. The same was set at Datapower as well but that did not help.
This issue has been occurring since the datapower firmware was recently upgraded. Can this be handled at Datapower itself to omit the preceding MQMDE? or handle it at IIB? |
|
Back to top |
|
 |
zpat |
Posted: Thu Nov 03, 2022 7:16 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Don't read the message as BLOB. Parse it properly using IIB. _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
abhishekp061 |
Posted: Thu Nov 03, 2022 7:40 am Post subject: |
|
|
Newbie
Joined: 28 Feb 2022 Posts: 7
|
Could you please elaborate on how to parse it in IIB?
This is an existing applications.
Earlier, message domain was set to XMLNSC and the message used to be processed successfully.
Now, with the additional unexpected header, the message fails at the MQInput header itself. |
|
Back to top |
|
 |
abhishekp061 |
Posted: Thu Nov 03, 2022 10:03 am Post subject: |
|
|
Newbie
Joined: 28 Feb 2022 Posts: 7
|
I tried reading the message as BLOB and then convert it to string but due to the invalid characters at the beginning of the file, the conversion fails.
SET Value = CAST(myBlob AS CHARACTER CCSID 1208 ENCODING 273);
Exception:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2521
Text:CHARACTER:Error while casting
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2135 Text:CHARACTER:Unconvertable character
 |
|
Back to top |
|
 |
zpat |
Posted: Sun Nov 06, 2022 11:49 pm Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
abhishekp061 wrote: |
Could you please elaborate on how to parse it in IIB?
|
Refer to the IIB training that you must have done before taking your job. _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
timber |
Posted: Mon Nov 07, 2022 2:50 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
abhishekp061 said:
Quote: |
This issue has been occurring since the datapower firmware was recently upgraded. |
If markt is correct, then there are two possibilities:
a) the sender has not changed, and the recent DataPower update has broken something (maybe DataPower is not setting its MQGET parameters correctly)
b) the sender has recently started to use an MDMDE header, and the DataPower update is not the cause.
I would investigate those two possibilities before trying to fix this in IIB.
If you need to strip off the MQMDE header from the incoming BLOB then you should refer to https://www.ibm.com/docs/en/ibm-mq/8.0?topic=descriptions-mqmde-message-descriptor-extension.
You do not need to convert the BLOB to CHARACTER before stripping the MQMDE header - you can use the ESQL string handling functions on the BLOB data. |
|
Back to top |
|
 |
Katie77 |
Posted: Mon Apr 08, 2024 6:54 am Post subject: |
|
|
Newbie
Joined: 04 Apr 2024 Posts: 2
|
I am using the IBM MQ .net client. which object has the md.version on in the .net? |
|
Back to top |
|
 |
|