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 SupportHelp with XMLNSC message

Post new topicReply to topic
Help with XMLNSC message View previous topic :: View next topic
Author Message
paulobugmann
PostPosted: Fri Jul 27, 2018 12:36 pm Post subject: Help with XMLNSC message Reply with quote

Newbie

Joined: 27 Jul 2018
Posts: 4

I have a system sending a message via httpinput. I need to retrieve the value of the OperationCode tag, however my system is including the xml with scape within the xmlMessage tag.

<?xml version="1.0" encoding="utf-8"?><soap:Envelope><soap:Body><ProcessMessage><xmlMessage>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;FlexNet.BusinessFacade.Utility.TransactionHistoryWriter.WriteTransactionHistory&gt;
&lt;SessionContext&gt;
&lt;EmployeeID&gt;1&lt;/EmployeeID&gt;
&lt;EmployeeNo&gt;ADMIN&lt;/EmployeeNo&gt;
&lt;OperationCode&gt;ProductionOrder.StatusChange.OUT&lt;/OperationCode&gt;
&lt;/SessionContext&gt;
&lt;FlexNet.BusinessFacade.Utility.TransactionHistoryWriter.TransactionName &gt;
&lt;TransactionName&gt;POStatusChange&lt;/TransactionName&gt;
&lt;/FlexNet.BusinessFacade.Utility.TransactionHistoryWriter.TransactionName&gt;
&lt;/FlexNet.BusinessFacade.Utility.TransactionHistoryWriter.WriteTransactionHistory&gt;</xmlMessage><applicationName>WebMethodAdapter</applicationName></ProcessMessage></soap:Body></soap:Envelope>


I need some help, to recover the value of the OperationCode tag via ESQL.
Back to top
View user's profile Send private message
timber
PostPosted: Fri Jul 27, 2018 1:50 pm Post subject: Reply with quote

Sentinel

Joined: 25 Aug 2015
Posts: 856

You are receiving two separate XML documents. The inner document is just a text value within the outer document. Your message flow needs to parse the inner document (convert it from a string to a message tree).

There are lots of examples in this forum showing how to do this. You will need a CREATE statement with a PARSE clause, and you should specify DOMAIN('XMLNSC').
Tip: You don't actually need to convert the CHARACTER string into a BLOB before you pass it into the CREATE...PARSE statement. I'm fairly sure that IIB will do that for you.
Back to top
View user's profile Send private message
paulobugmann
PostPosted: Tue Jul 31, 2018 5:48 am Post subject: Reply with quote

Newbie

Joined: 27 Jul 2018
Posts: 4

Thanks for the support.
I tested it in many ways, but it still is not working.
Could someone help please?

I removed the Soap envelope. Here is the last test I did.

DECLARE l_iInCCSID INTEGER InputRoot.Properties.CodedCharSetId;
DECLARE l_iInEncoding INTEGER InputRoot.Properties.Encoding;
DECLARE r_In REFERENCE TO InputRoot;

-- Convert Character entities to the XML tree
DECLARE l_bSOAPReqCharEntitiesBlob BLOB CAST(InputRoot.XMLNSC.*:ProcessMessage.*:xmlMessage AS BLOB CCSID l_iInCCSID);
CREATE LASTCHILD OF Environment.Variables.SOAPInputData AS r_In DOMAIN 'XMLNSC' PARSE(l_bSOAPReqCharEntitiesBlob, l_iInEncoding, l_iInCCSID);
MOVE r_In TO r_In.*:"FlexNet.BusinessFacade.Utility.TransactionHistoryWriter.WriteTransactionHistory";

SET OutputRoot = InputRoot;
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jul 31, 2018 6:15 am Post subject: Reply with quote

Grand High Poobah

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

paulobugmann wrote:
Could someone help please?


@timber did help - he told you to parse the second doc. Parsing is not the same as just adding something to the tree.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
paulobugmann
PostPosted: Tue Jul 31, 2018 12:39 pm Post subject: Reply with quote

Newbie

Joined: 27 Jul 2018
Posts: 4

Sorry for my ignorance, but I'm not able to access the second document.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jul 31, 2018 6:21 pm Post subject: Reply with quote

Grand Poobah

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

paulobugmann wrote:
Sorry for my ignorance, but I'm not able to access the second document.

That's because you cannot change the InputRoot tree.
You need to change the OutputRoot tree when copying your tree part...
Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
timber
PostPosted: Wed Aug 01, 2018 1:43 am Post subject: Reply with quote

Sentinel

Joined: 25 Aug 2015
Posts: 856

Quote:
I'm not able to access the second document
How did you try to access it? What happened?
Back to top
View user's profile Send private message
paulobugmann
PostPosted: Wed Aug 01, 2018 5:07 am Post subject: Reply with quote

Newbie

Joined: 27 Jul 2018
Posts: 4

I do not have much knowledge in ESQL.
But I've tried in many ways to get the contents of the doc and I can not.

DECLARE l_iInCCSID INTEGER InputRoot.Properties.CodedCharSetId;
DECLARE l_iInEncoding INTEGER InputRoot.Properties.Encoding;
DECLARE r_In REFERENCE TO InputRoot;

-- Convert Character entities to the XML tree
DECLARE l_bSOAPReqCharEntitiesBlob BLOB CAST(InputRoot.XMLNSC.*:ProcessMessage.*:xmlMessage AS BLOB CCSID l_iInCCSID);
CREATE LASTCHILD OF Environment.Variables.SOAPInputData AS r_In DOMAIN 'XMLNSC' PARSE(l_bSOAPReqCharEntitiesBlob, l_iInEncoding, l_iInCCSID);
MOVE r_In TO r_In.*:"FlexNet.BusinessFacade.Utility.TransactionHistoryWriter.WriteTransactionHistory";

IF FIELDVALUE(r_In.XMLNSC.*:SessionContext.OperationCode) = 'ProductionOrder.StatusChange.OUT' THEN
PROPAGATE TO TERMINAL 'out';
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Aug 01, 2018 5:24 am Post subject: Reply with quote

Grand High Poobah

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

paulobugmann wrote:
I've tried in many ways to get the contents of the doc and I can not.


You've posted this code twice. What are the other ways you've tried?

Also, as my worthy associate asked, what happened in each of these ways? "I can not" is hardly descriptive or informative.

paulobugmann wrote:
I do not have much knowledge in ESQL.


Does the person who gave you this task know this? Can they get you ESQL assistance from people on site, who will be more able to relate to your situation than a much of anonymous strangers on the Internet?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Aug 02, 2018 1:31 am Post subject: Reply with quote

Grand Poobah

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

paulobugmann wrote:
I do not have much knowledge in ESQL.
But I've tried in many ways to get the contents of the doc and I can not.

Code:
 DECLARE r_In REFERENCE TO InputRoot;
.....

              CREATE LASTCHILD OF Environment.Variables.SOAPInputData AS r_In DOMAIN 'XMLNSC' PARSE(l_bSOAPReqCharEntitiesBlob, l_iInEncoding, l_iInCCSID);
             

Again the INPUT Tree is NOT MUTABLE. This means you're not allowed to change it and if you try nothing happens... Try changing the OUTPUT tree instead!
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
timber
PostPosted: Thu Aug 02, 2018 11:23 pm Post subject: Reply with quote

Sentinel

Joined: 25 Aug 2015
Posts: 856

1. This comment is not accurate:
Code:
-- Convert Character entities to the XML tree
You are not 'converting character entities'. That would simply give you a string that looks like XML. You are parsing the value of the xmlMessage tag to create a message tree.

2. This line of code is probably not required.
Code:
DECLARE l_bSOAPReqCharEntitiesBlob BLOB CAST(InputRoot.XMLNSC.*:ProcessMessage.*:xmlMessage AS BLOB CCSID l_iInCCSID);
(I did mention that in my first response)

3. Looks OK:
Code:
CREATE LASTCHILD OF Environment.Variables.SOAPInputData AS r_In DOMAIN 'XMLNSC' PARSE(l_bSOAPReqCharEntitiesBlob, l_iInEncoding, l_iInCCSID);
...although you may want to experiment with removing the iinEncoding and iInCCSID parameters, because ESQL will set them for itself if you give it a CHARACTER instead of a BLOB.

4. This is where your problem is:
Code:
MOVE r_In TO r_In.*:"FlexNet.BusinessFacade.Utility.TransactionHistoryWriter.WriteTransactionHistory";
The reference r_In is already positioned on Environment.Variables.SOAPInputData."FlexNet.BusinessFacade.Utility.TransactionHistoryWriter.WriteTransactionHistory". You are now trying to move to a non-existent child of that node.

Tip: You would probably have found this defect within 15 minutes if you had taken a user trace. If you are going to write and debug a lot of ESQL then you should get comfortable with taking a reading a user trace. See other posts in this forum for how to use mqsichangetrace, mqsireadlog and mqsiformatlog.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportHelp with XMLNSC message
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.