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 » Check if DOMAIN ('XMLNS') PARSE was successful

Post new topic  Reply to topic Goto page 1, 2  Next
 Check if DOMAIN ('XMLNS') PARSE was successful « View previous topic :: View next topic » 
Author Message
matuwe
PostPosted: Mon Mar 29, 2010 2:49 am    Post subject: Check if DOMAIN ('XMLNS') PARSE was successful Reply with quote

Master

Joined: 05 Dec 2007
Posts: 296

Please help, I have code that looks like the code below. I need to parse data into xml and check if it was parsed successfully. This code works on Windows but doesn't work on AIX. Is the a consistant way that I can check if the incomming message parsed successfully or not? I a trying to use the esql function FIELDVALUE to check if it was successful.


Code:

DECLARE messageString CHARACTER;
      SET messageString = CAST (CAST(InputRoot.BLOB.BLOB AS BLOB) AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding);
      
CREATE LASTCHILD OF Environment.Payload DOMAIN ('XMLNS') PARSE ( messageString,InputRoot.Properties.Encoding, InputRoot.Properties.CodedCharSetId);

DECLARE fieldValue CHARACTER FIELDVALUE(Environment.Payload.XMLNS) ;
DECLARE fielsLength INTEGER LENGTH(fieldValue);

IF fielsLength > 0 THEN
SET OutputRoot.XMLNSC.ESB_WRAPPER.INPUTS.INPUTPAYLOAD = Environment.Payload.XMLNS ;
  ELSE
      SET OutputRoot.XMLNSC.ESB_WRAPPER.INPUTS.INPUTPAYLOAD =  InputRoot.BLOB.BLOB ;
END IF;




Thanks
Back to top
View user's profile Send private message
smdavies99
PostPosted: Mon Mar 29, 2010 2:55 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.

Do you get any errors logged (in the syslog etc) on the AIX System?
Have you run the data through with user trace enabled?

If I were you, I'd do run the data through with UserTrace on and the debugger disabled. You might be surprised at the results.
_________________
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
matuwe
PostPosted: Mon Mar 29, 2010 5:05 am    Post subject: Reply with quote

Master

Joined: 05 Dec 2007
Posts: 296

Thanks for the response.... But the behaviur is still the same.. No errors on the log. Is there any better function that I can use besides FIELDVALUE?
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Mar 29, 2010 5:55 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Why are you parsing the BLOB into XMLNS, then using XMLNSC in the OutputRoot?

When it apparently fails with no errors in the log, how do you know it's not been parsed successfully? What indicates this to you? Unexpected output? Errors in a dowstream application? Or just that the output doesn't look as you expect?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Mon Mar 29, 2010 5:59 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.

Firstly, you are using XMLNC & XMLNSC domains in your ESQL snippet you posted. I hope this is just a typo.

Please use one domain preferable XMLNSC.

Next, if there are errors in the XML, for example invalid XML tags, the Compute node will probably throw an exception so the flow will stop processing at the time of the CREATE and never get to the next bit.
AFAIK, this is a bit redundant.
You are not parsing it against a message model so you don't know if the XML you are getting has a valid logical structure. i.e. all the fields with the right names in the right order.

Some explanation as to why you want to do what you are attempting might help us to propose a more valid solution.
_________________
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: Mon Mar 29, 2010 8:05 am    Post subject: Reply with quote

Grand High Poobah

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

Why are you doing a CREATE PARSE from a CHARACTER type and not a BLOB type?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Mon Mar 29, 2010 11:57 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
Why are you doing a CREATE PARSE from a CHARACTER type and not a BLOB type?
That's a very fair question, because the infocenter does not say that you can give a CHARACTER field to a CREATE...PARSE statement. The funny thing is, you can
( I found this out a couple of months ago while examining the source code with the author ).

matuwe: Your code is wrong in several ways. I suggest that you go back to basics, read the infocenter and learn how the product works.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Mar 29, 2010 1:28 pm    Post subject: Reply with quote

Grand High Poobah

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

kimbert wrote:
Quote:
Why are you doing a CREATE PARSE from a CHARACTER type and not a BLOB type?
That's a very fair question, because the infocenter does not say that you can give a CHARACTER field to a CREATE...PARSE statement. The funny thing is, you can
( I found this out a couple of months ago while examining the source code with the author ).


I learn every day!

Would that not mean that the CCSID parameter in the PARSE is moot if you use a character variable, as well as Encoding ?? (obviously you have a character field so there is no encoding....)
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mgk
PostPosted: Mon Mar 29, 2010 1:56 pm    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Quote:
Would that not mean that the CCSID parameter in the PARSE is moot if you use a character variable, as well as Encoding


No, because it uses them internally to perform the equivalent CAST to a BLOB on your behalf...
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Mar 29, 2010 7:39 pm    Post subject: Reply with quote

Grand High Poobah

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

mgk wrote:
Quote:
Would that not mean that the CCSID parameter in the PARSE is moot if you use a character variable, as well as Encoding


No, because it uses them internally to perform the equivalent CAST to a BLOB on your behalf...


Thanks for clarifying that.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
matuwe
PostPosted: Tue Mar 30, 2010 1:43 am    Post subject: Reply with quote

Master

Joined: 05 Dec 2007
Posts: 296

Hi Thanks so much for all the response.

I am actually using XMLNS because the info centre said, choosing a domain i I need to do xpath and stuff then I should use XMLNS and not XMLNSC.

All I need to do is check the incomming message, if it is XML route it to somewhere, else if it is not XML then to someother place. Maybe I did it a little too complex. Is there any simple way that I can do this?


So the trace node shows that I am still going to the BLOB route and not the XML route.

One other thing I found strange was, on windows if I PARSE to XMLNSC domain, the function FIELDVALUE always returns empty but if I PARSE to XMLNS then I get something back.

Thanks so much for all the feedback and I will also make the change not to cast to CHARECTER first.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Mar 30, 2010 2:21 am    Post subject: Reply with quote

Grand High Poobah

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

matuwe wrote:

One other thing I found strange was, on windows if I PARSE to XMLNSC domain, the function FIELDVALUE always returns empty but if I PARSE to XMLNS then I get something back.


It should not behave with that much difference. Are you sure you took into consideration that if you check for fieldtypes you need to use XMLNSC.type instead of XML.type? Remember as well that the XMLNS and XMLNSC trees will look slightly different. The first child of an element might be its namespace and not a child value. So if you went for first child with a reference make sure you specified the type... If you did and still see that difference open a PMR.

Hope it helps
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
matuwe
PostPosted: Tue Mar 30, 2010 2:36 am    Post subject: Reply with quote

Master

Joined: 05 Dec 2007
Posts: 296

Thanks once again.

According to the trace Node, the data is PARSED successfully and it is sitting on Environment.Payload.XMLNS Butit points out that my problem is on these lines...


Code:

DECLARE fieldValue CHARACTER FIELDVALUE(Environment.Payload.XMLNS) ;
DECLARE fielsLength INTEGER LENGTH(fieldValue);


I have tried with both Domains XMLNSC and XMLNS, XMLNS works on windows and they both do not work on AIX.

I also tried to check for null

IF Environment.Payload.XMLNSC IS NULL

didn't work.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Mar 30, 2010 2:45 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.

So you have proved that the message has parsed successfully. Great.

What are the two lines of ESQL you are having trouble with supposed to do?
What value do they serve?
Can you access fields in your message directly?

Remember that the parsed message is a TREE not a string.
_________________
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
matuwe
PostPosted: Tue Mar 30, 2010 2:50 am    Post subject: Reply with quote

Master

Joined: 05 Dec 2007
Posts: 296

Hi

Thanks guys. Looks like it is working, I have removed the problem lines and changed back to check for NULL and it works for XMLNS and not XMLNSC.

Code:


CREATE LASTCHILD OF Environment.Payload DOMAIN ('XMLNS') PARSE ( InputRoot.BLOB.BLOB,InputRoot.Properties.Encoding, InputRoot.Properties.CodedCharSetId);

IF Environment.Payload.XMLNS IS NOT NULL THEN
  SET OutputRoot.XMLNSC.ESB_WRAPPER.INPUTS.INPUTPAYLOAD = Environment.Payload.XMLNS ;
ELSE
   SET OutputRoot.XMLNSC.ESB_WRAPPER.INPUTS.INPUTPAYLOAD = InputRoot.BLOB.BLOB ;
END IF;



Thanks for all the help and optimizing my CODE. cool stuff..

Beautifull stuff
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Check if DOMAIN ('XMLNS') PARSE was successful
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.