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 SupportBLOB to XMLNSC

Post new topicReply to topic
BLOB to XMLNSC View previous topic :: View next topic
Author Message
N157154
PostPosted: Tue Nov 21, 2017 4:35 am Post subject: BLOB to XMLNSC Reply with quote

Newbie

Joined: 15 Nov 2017
Posts: 7

Hi Guys ,
I have a require in which I have to capture the output coming out from Http Request Node's error terminal , If its blob then I need to convert it to xmlnsc to find out the reason for error. Currenlty I am using below code snippet

DECLARE blobMsg BLOB InputRoot.BLOB.BLOB ;

CREATE LASTCHILD OF Environment.Variables.inpMsg DOMAIN ('XMLNSC') NAME 'XMLNSC';
CREATE LASTCHILD OF Environment.Variables.inpMsg.XMLNSC PARSE(blobMsg OPTIONS FolderBitStream CCSID InputRoot.Properties.CodedCharSetId FORMAT 'XMLNSC');
SET Environment.Variables.statusRes.statusCode = Environment.Variables.inpMsg.XMLNSC.errorResponse.httpCode;
SET Environment.Variables.statusRes.detail = Environment.Variables.inpMsg.XMLNSC.errorResponse.httpMessage;
SET Environment.Variables.statusRes.additionalStatus.detail = Environment.Variables.inpMsg.XMLNSC.errorResponse.moreInformation;


But Sometimes I am getting XML parser error when I am at the parse statement.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Nov 21, 2017 5:47 am Post subject: Re: BLOB to XMLNSC Reply with quote

Grand Poobah

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

N157154 wrote:
Hi Guys ,
I have a require in which I have to capture the output coming out from Http Request Node's error terminal , If its blob then I need to convert it to xmlnsc to find out the reason for error. Currenlty I am using below code snippet

DECLARE blobMsg BLOB InputRoot.BLOB.BLOB ;

CREATE LASTCHILD OF Environment.Variables.inpMsg DOMAIN ('XMLNSC') NAME 'XMLNSC';
CREATE LASTCHILD OF Environment.Variables.inpMsg.XMLNSC PARSE(blobMsg OPTIONS FolderBitStream CCSID InputRoot.Properties.CodedCharSetId FORMAT 'XMLNSC');
SET Environment.Variables.statusRes.statusCode = Environment.Variables.inpMsg.XMLNSC.errorResponse.httpCode;
SET Environment.Variables.statusRes.detail = Environment.Variables.inpMsg.XMLNSC.errorResponse.httpMessage;
SET Environment.Variables.statusRes.additionalStatus.detail = Environment.Variables.inpMsg.XMLNSC.errorResponse.moreInformation;


But Sometimes I am getting XML parser error when I am at the parse statement.
You should do the parsing at the request node where you receive the answer. If there is a parsing error you need to look at the error handling. In said error handling look at the Exception Tree which should already show you the errror... Make sure you pass the exception tree in your compute node when handling the errors...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
N157154
PostPosted: Tue Nov 21, 2017 5:50 am Post subject: Reply with quote

Newbie

Joined: 15 Nov 2017
Posts: 7

Hi ,

I am getting this

An invalid XML character (Unicode: 0x7b) was found in the prolog of the document.

/Root/Variables/inpMsg/XMLNSC/XMLNSC
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Nov 21, 2017 5:56 am Post subject: Reply with quote

Grand Poobah

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

N157154 wrote:
Hi ,

I am getting this

An invalid XML character (Unicode: 0x7b) was found in the prolog of the document.

/Root/Variables/inpMsg/XMLNSC/XMLNSC

Most probably a CCSID problem.
What is the CCSID of the message (at sender).
What is the CCSID of the message (on the queue).
What is the CCSID of the message (at broker) (see Root.Properties.CodedCharSet values...)
What is the value of the convert flag on the input node?

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
N157154
PostPosted: Tue Nov 21, 2017 5:59 am Post subject: Reply with quote

Newbie

Joined: 15 Nov 2017
Posts: 7

CodedCharSetId:INTEGER:1208, I am sending the message from Postman and this is a reply from the http service
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Nov 21, 2017 6:04 am Post subject: Reply with quote

Grand Poobah

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

N157154 wrote:
CodedCharSetId:INTEGER:1208, I am sending the message from Postman and this is a reply from the http service

So did you make sure to set
Code:
OutputRoot.Properties.CodedCharSet = 1208;

and to specify the "UTF-8" character set in the HTTP Header when qualifying the content of the reply?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
N157154
PostPosted: Tue Nov 21, 2017 6:06 am Post subject: Reply with quote

Newbie

Joined: 15 Nov 2017
Posts: 7

My code is failing over here I debugged ..
CREATE LASTCHILD OF Environment.Variables.inpMsg.XMLNSC PARSE(blobMsg OPTIONS FolderBitStream CCSID InputRoot.Properties.CodedCharSetId FORMAT 'XMLNSC'
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Nov 21, 2017 6:13 am Post subject: Reply with quote

Grand Poobah

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

N157154 wrote:
My code is failing over here I debugged ..
CREATE LASTCHILD OF Environment.Variables.inpMsg.XMLNSC PARSE(blobMsg OPTIONS FolderBitStream CCSID InputRoot.Properties.CodedCharSetId FORMAT 'XMLNSC'


So again, what is the value of InputRoot.Properties.CodedCharSetId and does it match the content of the blobMsg?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
timber
PostPosted: Tue Nov 21, 2017 2:19 pm Post subject: Reply with quote

Shaman

Joined: 25 Aug 2015
Posts: 704

I think I may have spotted the problem:
Quote:
I have to capture the output coming out from Http Request Node's error terminal , If its blob then I need to convert it to xmlnsc to find out the reason for error.
The HTTP node has received an invalid XML document. It has (correctly) sent it to the failure terminal. Now you are trying to parse the invalid XML it to find out what the error was. That's not going to end well!

If you want more specific help then you will need to provide some examples of these 'reasons for the error' that you were hoping to detect.
Back to top
View user's profile Send private message
N157154
PostPosted: Wed Nov 22, 2017 12:00 am Post subject: Reply with quote

Newbie

Joined: 15 Nov 2017
Posts: 7

Basically my Http request node sends out this message out from error terminal { "httpCode":"401", "httpMessage":"Unauthorized", "moreInformation":"application is not registered, or active" }

I have converted this to char from blob , but while trying to convert blob to xmlnsc I am getting exception
Back to top
View user's profile Send private message
timber
PostPosted: Wed Nov 22, 2017 12:14 am Post subject: Reply with quote

Shaman

Joined: 25 Aug 2015
Posts: 704

Why did you expect an XML parser to parse that string?
Back to top
View user's profile Send private message
N157154
PostPosted: Wed Nov 22, 2017 12:20 am Post subject: Reply with quote

Newbie

Joined: 15 Nov 2017
Posts: 7

Actually this statement was working when were receiving an xml error response in blob but now it doesn't work . so is there a way in which we can accommodate all the error in a xml tree structure
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Nov 27, 2017 6:18 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24648
Location: Ohio, USA

N157154 wrote:
Actually this statement was working when were receiving an xml error response in blob but now it doesn't work


So what you're saying is that the XMLNSC parser works when the error response is XML but fails when it's JSON?

N157154 wrote:
so is there a way in which we can accommodate all the error in a xml tree structure


Yes. You just have to parse the JSON and place it in XML.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Nov 27, 2017 7:35 pm Post subject: Reply with quote

Grand Poobah

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

fjb_saper wrote:
N157154 wrote:
My code is failing over here I debugged ..
CREATE LASTCHILD OF Environment.Variables.inpMsg.XMLNSC PARSE(blobMsg OPTIONS FolderBitStream CCSID InputRoot.Properties.CodedCharSetId FORMAT 'XMLNSC'


So again, what is the value of InputRoot.Properties.CodedCharSetId and does it match the content of the blobMsg?


Shouldn't that have been DOMAIN instead or FORMAT??
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportBLOB to XMLNSC
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.