Author |
Message
|
marcin.kasinski |
Posted: Fri Feb 09, 2007 12:10 pm Post subject: Strange ESQL problem... |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
Hi
I have some problem with my flow.
WMB 6 on AIX
There is input message
Quote: |
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns="http://aaa.com.pl/"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<A>
<D>ABC</D>
</A>
</soapenv:Body>
</soapenv:Envelope>
|
The case is to modify message by removing Envelope and Body tag.
On output of the flow I would like to have message
Quote: |
<A>
<D>ABC</D>
</A>
|
Message flow looks very simple
MQInput -> Compute -> MQOutput
My ESQL code is :
Quote: |
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
DECLARE cursor REFERENCE TO InputRoot.XMLNS;
MOVE cursor FIRSTCHILD TYPE 0x01000000;
MOVE cursor FIRSTCHILD TYPE 0x01000000;
SET Environment.cursor=cursor;
CREATE NEXTSIBLING OF InputRoot.MQMD DOMAIN('XMLNS') ;
SET OutputRoot.XMLNS=Environment.cursor;
RETURN TRUE;
END;
|
Problem is that this doesn't work.
Below you have trace
Quote: |
21:04:26.524770
Root:
(
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 273
(0x03000000):CodedCharSetId = 819
(0x03000000):Transactional = TRUE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2007-02-09 20:04:26.510'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 5
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'MQ'
(0x03000000):Topic = NULL
(0x03000000):ContentType = ''
)
(0x01000000):MQMD = (
(0x03000000):SourceQueue = 'MQSI.APPQM1.QIN'
(0x03000000):Transactional = TRUE
(0x03000000):Encoding = 273
(0x03000000):CodedCharSetId = 819
(0x03000000):Format = 'MQSTR '
(0x03000000):Version = 2
(0x03000000):Report = 0
(0x03000000):MsgType = 1
(0x03000000):Expiry = -1
(0x03000000):Feedback = 0
(0x03000000):Priority = 5
(0x03000000):Persistence = 0
(0x03000000):MsgId = X'414d5120514d3120202020202020202043aacc4520010002'
(0x03000000):CorrelId = X'000000000000000000000000000000000000000000000000'
(0x03000000):BackoutCount = 0
(0x03000000):ReplyToQ = 'QIN '
(0x03000000):ReplyToQMgr = 'QM1 '
(0x03000000):UserIdentifier = 'musr_mqadmin'
(0x03000000):AccountingToken = X'16010515000000a1f404621c09b00907e53b2bee03000000000000000000000b'
(0x03000000):ApplIdentityData = ' '
(0x03000000):PutApplType = 28
(0x03000000):PutApplName = 'WebSphere MQ Client for Java'
(0x03000000):PutDate = DATE '2007-02-09'
(0x03000000):PutTime = GMTTIME '20:04:26.510'
(0x03000000):ApplOriginData = ' '
(0x03000000):GroupId = X'414d5120514d3120202020202020202043aacc4520010003'
(0x03000000):MsgSeqNumber = 1
(0x03000000):Offset = 0
(0x03000000):MsgFlags = 1
(0x03000000):OriginalLength = -1
)
(0x01000010):XMLNS = (
(0x01000000)http://aaa.com.pl/:A = (
(0x01000000)http://aaa.com.pl/:D = (
(0x02000000): = 'ABC'
)
)
(0x02000000): = ' '
)
)
Environment
(
(0x01000000):cursor = (
(0x01000000)http://aaa.com.pl/:A = (
(0x03000000)http://aaa.com.pl/:D = 'ABC'
)
(0x02000000): = ' '
)
)
LocalEnvironment
ExceptionList
(
(0x01000000):RecoverableException = (
(0x03000000):File = 'F:\build\S000_P\src\DataFlowEngine\ImbDataFlowNode.cpp'
(0x03000000):Line = 616
(0x03000000):Function = 'ImbDataFlowNode::createExceptionList'
(0x03000000):Type = 'ComIbmMQOutputNode'
(0x03000000):Name = 'TestFlow#FCMComposite_1_2'
(0x03000000):Label = 'TestFlow.MQOutput'
(0x03000000):Catalog = 'BIPv600'
(0x03000000):Severity = 3
(0x03000000):Number = 2230
(0x03000000):Text = 'Node throwing exception'
(0x01000000):ParserException = (
(0x03000000):File = 'F:\build\S000_P\src\MTI\MTIforBroker\GenXmlParser2\XmlImbParser.cpp'
(0x03000000):Line = 371
(0x03000000):Function = 'XmlImbParser::refreshBitStreamFromElements'
(0x03000000):Type = 'ComIbmMQInputNode'
(0x03000000):Name = 'TestFlow#FCMComposite_1_1'
(0x03000000):Label = 'TestFlow.MQInput'
(0x03000000):Catalog = 'BIPv600'
(0x03000000):Severity = 3
(0x03000000):Number = 5010
(0x03000000):Text = 'XML Writing Errors have occurred'
(0x01000000):ParserException = (
(0x03000000):File = 'F:\build\S000_P\src\MTI\MTIforBroker\GenXmlParser2\XmlImbParser.cpp'
(0x03000000):Line = 630
(0x03000000):Function = 'XmlImbParser::validateTree'
(0x03000000):Type = ''
(0x03000000):Name = ''
(0x03000000):Label = ''
(0x03000000):Catalog = 'BIPv600'
(0x03000000):Severity = 3
(0x03000000):Number = 5007
(0x03000000):Text = 'Invalid top level element found.'
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = ''
)
)
)
)
)
-----------------------------------------------------------------
|
For me this XML is OK.
Funny thing is that when I change line from
SET OutputRoot.XMLNS=Environment.cursor;
to
SET OutputRoot.XMLNS.XXXXXXXX=Environment.cursor;
everything is OK and in output queue I have XML message (not I expected, but XML).
Can you explain it to me, please ?
Best Regards
Marcin
Last edited by marcin.kasinski on Fri Feb 09, 2007 10:55 pm; edited 1 time in total |
|
Back to top |
|
 |
Bill.Matthews |
Posted: Fri Feb 09, 2007 12:54 pm Post subject: |
|
|
 Master
Joined: 23 Sep 2003 Posts: 232 Location: IBM (Retired)
|
You may want to take a look at the IA9O SOAP Nodes supportpac. It provides a pair of nodes called SOAPExtract and SOAPEnvelope.
Best used with WMB runtime 6.0.0.3 and Toolkit 602
The SOAPExtract will remove the message from the body make it available as Root.XMLNSC.A (in your case). _________________ Bill Matthews |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Fri Feb 09, 2007 1:09 pm Post subject: |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
Bill.Matthews wrote: |
You may want to take a look at the IA9O SOAP Nodes supportpac. It provides a pair of nodes called SOAPExtract and SOAPEnvelope.
Best used with WMB runtime 6.0.0.3 and Toolkit 602
The SOAPExtract will remove the message from the body make it available as Root.XMLNSC.A (in your case). |
Thanks Bill but let say I'm not going to use IA90.
Can you look at my code and tell me why I got error in my first example ?
I know that I can do it in another way. I have my workaround (code bellow)
Quote: |
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
DECLARE cursor REFERENCE TO InputRoot.XMLNS;
MOVE cursor FIRSTCHILD TYPE 0x01000000;
MOVE cursor FIRSTCHILD TYPE 0x01000000;
MOVE cursor FIRSTCHILD TYPE 0x01000000;
SET Environment.cursor=cursor;
SET Environment.firsttagname=FIELDNAME(cursor);
-- CALL
CREATE NEXTSIBLING OF InputRoot.MQMD DOMAIN('XMLNS') ;
SET OutputRoot.XMLNS.{Environment.firsttagname}=Environment.cursor;
RETURN TRUE;
END;
|
I'm only interested in why code SET OutputRoot.XMLNS=Environment.cursor; doesnt work
but code SET OutputRoot.XMLNS.A=Environment.cursor; works OK
Best Regards
Marcin |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Feb 09, 2007 9:37 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi marcin.kasinski,
I have a feeling that when you do a OutputRoot.XMLNS = Environment.cursor, the element A is at the level of XMLNS...hence the output is only the element D...and the root tag cannot contain a value hence the error
marcin.kasinski wrote: |
(0x03000000):Text = 'Invalid top level element found.' |
When you are doing a OuputRoot.XMLNS.A = Environment.cursor, you are creating another root tag over the element D, hence things work...
Try this
Code: |
SET OutputRoot.XMLNS = Environment.* |
If my hunch is right, this should work...
Regards. |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Fri Feb 09, 2007 10:57 pm Post subject: |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
marcin.kasinski wrote: |
Bill.Matthews wrote: |
You may want to take a look at the IA9O SOAP Nodes supportpac. It provides a pair of nodes called SOAPExtract and SOAPEnvelope.
Best used with WMB runtime 6.0.0.3 and Toolkit 602
The SOAPExtract will remove the message from the body make it available as Root.XMLNSC.A (in your case). |
Thanks Bill but let say I'm not going to use IA90.
Can you look at my code and tell me why I got error in my first example ?
I know that I can do it in another way. I have my workaround (code bellow)
Quote: |
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
DECLARE cursor REFERENCE TO InputRoot.XMLNS;
MOVE cursor FIRSTCHILD TYPE 0x01000000;
MOVE cursor FIRSTCHILD TYPE 0x01000000;
MOVE cursor FIRSTCHILD TYPE 0x01000000;
SET Environment.cursor=cursor;
SET Environment.firsttagname=FIELDNAME(cursor);
-- CALL
CREATE NEXTSIBLING OF InputRoot.MQMD DOMAIN('XMLNS') ;
SET OutputRoot.XMLNS.{Environment.firsttagname}=Environment.cursor;
RETURN TRUE;
END;
|
I'm only interested in why code SET OutputRoot.XMLNS=Environment.cursor; doesnt work
but code SET OutputRoot.XMLNS.A=Environment.cursor; works OK (XML structure is not I expected, but for parser its is correct XML message)
Best Regards
Marcin |
Last edited by marcin.kasinski on Fri Feb 09, 2007 11:51 pm; edited 1 time in total |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Feb 09, 2007 11:18 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi marcin.kasinski,
Did I miss something
Regards. |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Sat Feb 10, 2007 12:07 am Post subject: |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
Hi
I will try to prepare simple exaple
This code works OK.
...
SET Environment.XMLNS=InputRoot.XMLNS;
SET OutputRoot.XMLNS=Environment.XMLNS;
...
But this code generate incorrect top leve error
...
SET Environment.XMLNS=InputRoot.XMLNS.soapenv:Envelope;-- or similar
SET OutputRoot.XMLNS=Environment.XMLNS;
...
The question is why I can not assign something what is inside my input XML as a Outpux XML.
Marcin |
|
Back to top |
|
 |
jefflowrey |
Posted: Sat Feb 10, 2007 4:01 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Typically, people have problems using the environment in the way you are trying to do, because they don't create a tree in Environment that has the right parser.
Also please look at elvis_gn's comments about values and children. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Sat Feb 10, 2007 8:03 am Post subject: |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
jefflowrey wrote: |
Typically, people have problems using the environment in the way you are trying to do, because they don't create a tree in Environment that has the right parser.
|
Hi Jeff,
Can you provide me with example how can I do it with ESQL ?
Marcin |
|
Back to top |
|
 |
elvis_gn |
Posted: Sat Feb 10, 2007 8:57 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Feb 10, 2007 7:57 pm Post subject: Re: Strange ESQL problem... |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
marcin.kasinski wrote: |
My ESQL code is :
...
CREATE NEXTSIBLING OF InputRoot.MQMD DOMAIN('XMLNS') ;
SET OutputRoot.XMLNS=Environment.cursor;
RETURN TRUE;
END;
Problem is that this doesn't work.
Below you have trace
Marcin |
Which part of the manual did you skip?
It says explicitely that the INPUT Tree i.e. InputRoot is not modifiable...
Unless above is a typo ??
Should it not in fact read :
Code: |
CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNS' NAME 'XMLNS';
SET OutputRoot.XMLNS = Environment.cursor;
--or
SET OutputRoot.XMLNS VALUE = Environment.cursor; |
Note that the last 2 assignments may have a very different behavior depending on the presence of name spaces...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|