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 find a certain attribute in xmlnsc?

Post new topic  Reply to topic
 How to find a certain attribute in xmlnsc? « View previous topic :: View next topic » 
Author Message
hikari_sukunami
PostPosted: Thu Sep 26, 2013 12:41 am    Post subject: How to find a certain attribute in xmlnsc? Reply with quote

Newbie

Joined: 26 Sep 2013
Posts: 6

Hi,

I have an xmlnsc just like this:

<abc:CommandRequestData xmlns:abc="<can't post the url here>">
<abc:Environment>
<abc:Parameter name="ApplicationDomain" value="CAO_LDM_00"/>
</abc:Environment>
<abc:Command>
<abc:Operation namespace="CA" name="Recharge">
<abc:ParameterList>
<abc:StringParameter name="CustomerId">639474210070</abc:StringParameter>
<abc:StringParameter name="AccessKey">639474210070</abc:StringParameter>
<abc:StringParameter name="EventName">flexible</abc:StringParameter>
<abc:LongParameter xsi:type="abc:LongParameter" name="AmountOfUnits">1500</abc:LongParameter>
<abc:StringParameter name="EventClass">flexible</abc:StringParameter>
<abc:ListParameter name="RatingInput">
<abc:StringElement>CSP</abc:StringElement>
<abc:StringElement>OnPeakAccountID</abc:StringElement>
<abc:StringElement>3</abc:StringElement>
<abc:StringElement>1</abc:StringElement>
<abc:StringElement>20110718183457</abc:StringElement>
</abc:ListParameter>
<abc:LongParameter xsi:type="abc:LongParameter" name="MessageId">256118092</abc:LongParameter>
<abc:StringParameter name="EventInfo">CSP|MWRLI|||09194400106|15.00|</abc:StringParameter>
</abc:ParameterList>
</abc:Operation>
</abc:Command>
</abc:CommandRequestData>


What I need to do is to get this <abc:StringParameter name="CustomerId">639474210070</abc:StringParameter>

I need to make a loop in the abc:ParameterList and check if there is a StringParameter whose attribute is CustomerId is existing. If found, I should get its value (that is 639474210070).

The values in ParameterList is dynamic. Meaning the order can be reshuffle.

Say From this one:

<abc:ParameterList>
<abc:StringParameter name="CustomerId">639474210070</abc:StringParameter>
<abc:StringParameter name="AccessKey">639474210070</abc:StringParameter>
<abc:StringParameter name="EventName">flexible</abc:StringParameter>
<abc:LongParameter xsi:type="abc:LongParameter" name="AmountOfUnits" >1500</abc:LongParameter>
<abc:StringParameter name="EventClass">flexible</abc:StringParameter>
<abc:ListParameter name="RatingInput">
<abc:StringElement>CSP</abc:StringElement>
<abc:StringElement>OnPeakAccountID</abc:StringElement>
<abc:StringElement>3</abc:StringElement>
<abc:StringElement>1</abc:StringElement>
<abc:StringElement>20110718183457</abc:StringElement>
</abc:ListParameter>
<abc:LongParameter xsi:type="abc:LongParameter" name="MessageId" >256118092</abc:LongParameter>
<abc:StringParameter name="EventInfo">CSP|MWRLI|||09194400106|15.00|</abc:StringParameter>
</abc:ParameterList>

to this one:

<abc:ParameterList>
<abc:StringParameter name="AccessKey">639474210070</abc:StringParameter>
<abc:StringParameter name="CustomerId">639474210070</abc:StringParameter>
<abc:StringParameter name="EventName">flexible</abc:StringParameter>
<abc:LongParameter xsi:type="abc:LongParameter" name="AmountOfUnits" >1500</abc:LongParameter>
<abc:StringParameter name="EventClass">flexible</abc:StringParameter>
<abc:ListParameter name="RatingInput">
<abc:StringElement>CSP</abc:StringElement>
<abc:StringElement>OnPeakAccountID</abc:StringElement>
<abc:StringElement>3</abc:StringElement>
<abc:StringElement>1</abc:StringElement>
<abc:StringElement>20110718183457</abc:StringElement>
</abc:ListParameter>
<abc:LongParameter xsi:type="abc:LongParameter" name="MessageId">256118092</abc:LongParameter>
<abc:StringParameter name="EventInfo">CSP|MWRLI|||09194400106|15.00|</abc:StringParameter>
</abc:ParameterList>


How will I do this?
This is what I did but it only works if the CustomerId attribute is the first attribute in the ParameterList. Hence it is not working if the CustomerId is in different position.

SET J = CARDINALITY(input.doc:AtomicRequest.abc:CommandRequestData.abc:Command.abc:Operation.abc:ParameterList.*[]);
WHILE I <= J DO
SET Environment.StringParam = input.doc:AtomicRequest.abc:CommandRequestData.abc:Command.abc:Operation.abc:ParameterList.*[I];
IF input.doc:AtomicRequest.abc:CommandRequestData.abc:Command.abc:Operation.abc:ParameterList.abc:StringParameter.*[I] IS NOT NULL THEN
IF input.doc:AtomicRequest.abc:CommandRequestData.abc:Command.abc:Operation.abc:ParameterList.abc:StringParameter.*[I] = 'CustomerId' THEN
SET Environment.msisdn = input.doc:AtomicRequest.abc:CommandRequestData.abc:Command.abc:Operation.abc:ParameterList.*[I];
END IF;
END IF;

Thank you
Back to top
View user's profile Send private message
McueMart
PostPosted: Thu Sep 26, 2013 12:55 am    Post subject: Reply with quote

Chevalier

Joined: 29 Nov 2011
Posts: 490
Location: UK...somewhere

You can use SELECT statements on the logical message tree, just like how you use SELECT statements to select data out of a database.

Your problem should be very easy to solve using a SELECT statement. Have a go and let us know if you hit problems.
Back to top
View user's profile Send private message
aggarwal.intouch
PostPosted: Thu Sep 26, 2013 2:01 am    Post subject: Reply with quote

Acolyte

Joined: 30 May 2011
Posts: 56
Location: India

Please refer the following link:

http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fac67241_.htm
Back to top
View user's profile Send private message Send e-mail
dogorsy
PostPosted: Thu Sep 26, 2013 2:12 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

aggarwal.intouch wrote:
Please refer the following link:

http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fac67241_.htm


It is a good idea to refer to the documentation that is relevant to the release the OP is using, as it might have changed.
Please note that that documentation is talking about the XMLNS parser and the OP might be using XMLNSC parser, in which case he should be using XMLNSC.Attribute, rather than XML.Attribute.
Back to top
View user's profile Send private message
hikari_sukunami
PostPosted: Tue Oct 01, 2013 1:21 am    Post subject: Reply with quote

Newbie

Joined: 26 Sep 2013
Posts: 6

I tried this one but it is not working.

SET OutputRoot.XMLNSC.cri:criInput.min = THE (SELECT ITEM FIELDVALUE(T) FROM input.doc:AtomicRequest.nsn:CommandRequestData.nsn:Command.nsn:Operation.nsn:ParameterList[] AS T WHERE FIELDVALUE(T.(XMLNSC.Attribute)name) = 'CustomerId');
Back to top
View user's profile Send private message
dogorsy
PostPosted: Tue Oct 01, 2013 1:35 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

1- input is not a correlation name, so maybe you should try InputRoot.XMLNSC etc. Ensure the path is correct.
2- nsn:ParameterList[] contains children, which is what you want to search, so this should be nsn:ParameterList.*:*[]
3- run the flow and get a user trace. By reading the user trace you will get a better idea of what is going wrong.
Back to top
View user's profile Send private message
hikari_sukunami
PostPosted: Tue Oct 01, 2013 1:49 am    Post subject: Reply with quote

Newbie

Joined: 26 Sep 2013
Posts: 6

Thank you all
It's working now.

DECLARE input REFERENCE TO Environment.Variables.Input.OriginalMessage;

SET OutputRoot.XMLNSC.cri:criInput.min = THE (SELECT ITEM FIELDVALUE(T) FROM input.doc:AtomicRequest.nsn:CommandRequestData.nsn:Command.nsn:Operation.nsn:ParameterList.*[] AS T WHERE FIELDVALUE(T.(XMLNSC.Attribute)name) = 'CustomerId');
Back to top
View user's profile Send private message
dogorsy
PostPosted: Tue Oct 01, 2013 2:09 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

Good and well done.
You can impove performance by limiting the children you are searching: instead of
Code:
nsn:ParameterList.*[] 
you can use
Code:
 nsn:ParameterList.abc:StringParameter[]
as these are the ones that contain the customer id
Back to top
View user's profile Send private message
hikari_sukunami
PostPosted: Tue Oct 01, 2013 2:16 am    Post subject: Reply with quote

Newbie

Joined: 26 Sep 2013
Posts: 6

wow! I'll try that too.

Thank you dogorsy!
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 find a certain attribute in 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.