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 handle invalid junk characters at beginning

Post new topic  Reply to topic
 How to handle invalid junk characters at beginning « View previous topic :: View next topic » 
Author Message
abhishekp061
PostPosted: Wed Nov 02, 2022 8:48 am    Post subject: How to handle invalid junk characters at beginning Reply with quote

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
View user's profile Send private message
gbaddeley
PostPosted: Wed Nov 02, 2022 2:21 pm    Post subject: Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2491
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
View user's profile Send private message
abhishekp061
PostPosted: Thu Nov 03, 2022 2:31 am    Post subject: Reply with quote

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
View user's profile Send private message
markt
PostPosted: Thu Nov 03, 2022 6:25 am    Post subject: Reply with quote

Knight

Joined: 14 May 2002
Posts: 502

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
Code:
md.Version=2
and the extension block won't be needed - the fields will be in the MQMD.
Back to top
View user's profile Send private message
abhishekp061
PostPosted: Thu Nov 03, 2022 6:58 am    Post subject: Reply with quote

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
View user's profile Send private message
zpat
PostPosted: Thu Nov 03, 2022 7:16 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5849
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
View user's profile Send private message
abhishekp061
PostPosted: Thu Nov 03, 2022 7:40 am    Post subject: Reply with quote

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
View user's profile Send private message
abhishekp061
PostPosted: Thu Nov 03, 2022 10:03 am    Post subject: Reply with quote

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
View user's profile Send private message
zpat
PostPosted: Sun Nov 06, 2022 11:49 pm    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5849
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
View user's profile Send private message
timber
PostPosted: Mon Nov 07, 2022 2:50 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

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
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 handle invalid junk characters at beginning
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.