Author |
Message
|
Lebowski |
Posted: Thu Aug 03, 2017 7:00 am Post subject: Issue with deleting client request under usr folder. |
|
|
Newbie
Joined: 26 May 2016 Posts: 7
|
Hi all,
Encountered an issue and I'm really scratching my head over it.
In the message flow we are using aggregation folders to store the original messages.
On the response coming from the backend system there are two client request folders which structure looks like this -
Code: |
<OutputRoot>
<MQRHF2>
<usr>
<INTERNAL_DATA>
<ClientRequests>
<ClientRequest>
<ClientRequest>
|
There is some code to determine if the client request matches the client name we are looking for in the response. Once that is confirmed to match I am wanting to delete the second ClientRequest field as the following service only requires the first one.
When trying to do this however I am encountering an error "Could not create parser"
I've tried using code to set it to NULL, DELETE FIELD yet none seem to work.
Any help would be greatly appreciated. |
|
Back to top |
|
|
Vitor |
Posted: Thu Aug 03, 2017 7:36 am Post subject: Re: Issue with deleting client request under usr folder. |
|
|
Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Lebowski wrote: |
When trying to do this however I am encountering an error "Could not create parser"
I've tried using code to set it to NULL, DELETE FIELD yet none seem to work. |
Please post your code snippet(s) and the actual error. With relevant tags to aid readability if you'd be so good. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
|
fjb_saper |
Posted: Thu Aug 03, 2017 8:22 am Post subject: |
|
|
Grand High Poobah
Joined: 18 Nov 2003 Posts: 20729 Location: LI,NY
|
Looks like you do not understand the nature of the usr folder.
It contains only name value pairs....
So in order to do what you want to do you would need to:
- extract the INTERNAL_DATA from the usr folder.
- Parse the extracted data
- Manipulate the parsed data
- Serialize the manipulated parsed data
- update the INTERNAL_DATA with the serialized data
Have fun _________________ MQ & Broker admin |
|
Back to top |
|
|
inMo |
Posted: Thu Aug 03, 2017 1:03 pm Post subject: |
|
|
Master
Joined: 27 Jun 2009 Posts: 216 Location: NY
|
I second Vitor - I'd like to see the code snipet you are using for this task. |
|
Back to top |
|
|
Lebowski |
Posted: Fri Aug 04, 2017 12:14 am Post subject: |
|
|
Newbie
Joined: 26 May 2016 Posts: 7
|
DECLARE storeRef REFERENCE TO OutputRoot.MQRFH2;
DECLARE found BOOLEAN FALSE;
DECLARE CLIENT_NAME CONSTANT CHAR 'servicename';
DECLARE originalRef REFERENCE TO storeRef;
MOVE storeRef TO
storeRef.usr.INTERNAL_DATA.ClientRequests.ClientRequest[>];
WHILE LASTMOVE(storeRef) DO
IF storeRef.(XML.Attribute)CLIENT_NAME = CLIENT_NAME THEN
RETURN TRUE;
ELSE
MOVE storeRef NEXTSIBLING REPEAT TYPE NAME;
END IF;
END WHILE;
This determines the Client name passed in through the Client request folder matches the one declared in this code. Following this I just simply have -
DELETE FIELD storeRef;
I've tried doing drilling right down rather than deleting the reference and that hasn't worked either. |
|
Back to top |
|
|
inMo |
Posted: Fri Aug 04, 2017 1:19 am Post subject: |
|
|
Master
Joined: 27 Jun 2009 Posts: 216 Location: NY
|
Questions:
1) are you dealing with an MQ message or something else?
2) where is the sample data structure coming from? (How did you get the sample?)
3) assuming sample is correct, are you sure your first line of code actually works? |
|
Back to top |
|
|
Lebowski |
Posted: Fri Aug 04, 2017 2:07 am Post subject: |
|
|
Newbie
Joined: 26 May 2016 Posts: 7
|
1) are you dealing with an MQ message or something else?
Yes it's an xml MQ message
2) where is the sample data structure coming from? (How did you get the sample?)
Sample is just the MQRFH2 header which comes back on the reply
3) assuming sample is correct, are you sure your first line of code actually works?
Yes the code which determines if the CLIENT_NAME matches does work as intended, it's simply when trying to remove the 'storeRef' that I encounter problems. |
|
Back to top |
|
|
fjb_saper |
Posted: Fri Aug 04, 2017 5:00 am Post subject: |
|
|
Grand High Poobah
Joined: 18 Nov 2003 Posts: 20729 Location: LI,NY
|
Lebowski wrote: |
Code: |
DECLARE storeRef REFERENCE TO OutputRoot.MQRFH2;
DECLARE found BOOLEAN FALSE;
DECLARE CLIENT_NAME CONSTANT CHAR 'servicename';
DECLARE originalRef REFERENCE TO storeRef;
MOVE storeRef TO
storeRef.usr.INTERNAL_DATA.ClientRequests.ClientRequest[>]; --not possible as usr.INTERNAL_DATA is the name of a name value pair...
WHILE LASTMOVE(storeRef) DO -- will always return false...
IF storeRef.(XML.Attribute)CLIENT_NAME = CLIENT_NAME THEN
RETURN TRUE;
ELSE
MOVE storeRef NEXTSIBLING REPEAT TYPE NAME;
END IF;
END WHILE; |
This determines the Client name passed in through the Client request folder matches the one declared in this code. Following this I just simply have -
DELETE FIELD storeRef;
I've tried doing drilling right down rather than deleting the reference and that hasn't worked either. |
Your code is not doing what you think. Especially the move before the while... _________________ MQ & Broker admin |
|
Back to top |
|
|
|