|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
XML & DTDs |
« View previous topic :: View next topic » |
Author |
Message
|
Gary Ellwood |
Posted: Wed Jul 03, 2002 6:52 am Post subject: XML & DTDs |
|
|
Novice
Joined: 17 Apr 2002 Posts: 12
|
I am attemping to read the XML message (1) below (created by WebSphere Commerce) into MQSI. Unfortunately, MQSI does not appear to be able to read and understand the message in its present format. Will MQSI use the specfified DTD (I've tried changing this to a full path name)??
If I amend the input message into a more simple form (2), MQSI does read and interpret the data, but I can not get it to recognise repeating groups...at the 'ReportPOItem level'. Any Cardinality statements seem to be resolved to 1 (Is this because it is not using the DTD??)!!
Any ideas/ suggestions??
(1)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Report_NC_PurchaseOrder SYSTEM "Report_NC_PO_10.dtd">
<Report_NC_PurchaseOrder version="1.0">
<ControlArea>
<Verb value="Report"> </Verb>
<Noun value="NC_PurchaseOrder"> </Noun>
</ControlArea>
<DataArea>
<ReportPO>
<ReportPOHeader>
<OrderNumberByNC>10253</OrderNumberByNC>
<DateTimeReference>
<PlacedDate>20020205</PlacedDate>
<PlacedTime>152043</PlacedTime>
</DateTimeReference>
<TotalPriceInfo currency="USD">
<TotalNetPrice>60.00000</TotalNetPrice>
<TaxInfo>
<MonetaryAmount currency="USD">3.00000</MonetaryAmount>
</TaxInfo>
<TotalShippingPrice>7.00000</TotalShippingPrice>
<TotalTaxOnShippingPrice>0.00000</TotalTaxOnShippingPrice>
</TotalPriceInfo>
<ShipStatus>C</ShipStatus>
<BillToInfo>
<Address>
<AddressLine>Home</AddressLine>
<AddressLine></AddressLine>
<City>Brum</City>
<State>W Mids</State>
<Zip>B73</Zip>
<Country>England</Country>
</Address>
<ContactPersonName>
<LastName>Fitzsimons</LastName>
<FirstName>Paul</FirstName>
<AlternateName>-1000_1012324915586</AlternateName>
</ContactPersonName>
<ContactInfo>
<Telephone type="primary"></Telephone>
</ContactInfo>
</BillToInfo>
<MerchantInfo>
<OrgName>In Fashion</OrgName>
<OrgId type="NCInternal">10001</OrgId>
<Address>
<AddressLine>12xx Martindale Avenue</AddressLine>
<AddressLine>Suite 9xx</AddressLine>
<City>Clothesville</City>
<State>Ontario</State>
<Zip>Lxx 1xx</Zip>
<Country>Canada</Country>
</Address>
<ContactInfo>
<Telephone type="primary">1-800-555-1234</Telephone>
<Email type="primary">info@infashion.xxx</Email>
<Fax>1-800-555-4321</Fax>
</ContactInfo>
</MerchantInfo>
<PCardInfo>
<MonetaryAmount currency="USD"></MonetaryAmount>
<CardType>Visa</CardType>
<CardNumber>4111111111111111</CardNumber>
</PCardInfo>
<OrderCustomerField></OrderCustomerField>
<OrderCustomerField></OrderCustomerField>
</ReportPOHeader>
<ReportPOItem>
<ItemLineNumber>0</ItemLineNumber>
<ItemNumberByNC>10253</ItemNumberByNC>
<ProductNumberByMerchant>sku-194</ProductNumberByMerchant>
<ItemUnitPrice currency="USD">25.00000</ItemUnitPrice>
<ItemProductQuantity>1.0</ItemProductQuantity>
<ItemProductDescription>Casual shirt</ItemProductDescription>
<ShipToInfo>
<ContactPersonName>
<LastName>Fitzsimons</LastName>
<FirstName>Paul</FirstName>
<AlternateName>-1000_1012324915586</AlternateName>
</ContactPersonName>
<Address>
<AddressLine>Home</AddressLine>
<AddressLine></AddressLine>
<City>Brum</City>
<State>W Mids</State>
<Zip>B73</Zip>
<Country>England</Country>
</Address>
<ContactInfo>
<Telephone type="primary"></Telephone>
</ContactInfo>
</ShipToInfo>
<ShippingCarrierInfo>
<Carrier>XYZ Carrier</Carrier>
<Method>A1</Method>
</ShippingCarrierInfo>
<ShipStatus>C</ShipStatus>
<DateTimeReference>
<PlacedDate>20020205</PlacedDate>
<PlacedTime>114553</PlacedTime>
<LastUpdateDate>20020205</LastUpdateDate>
<LastUpdateTime>152043</LastUpdateTime>
</DateTimeReference>
</ReportPOItem>
<ReportPOItem>
<ItemLineNumber>1</ItemLineNumber>
<ItemNumberByNC>10255</ItemNumberByNC>
<ProductNumberByMerchant>sku-133</ProductNumberByMerchant>
<ItemUnitPricecurrency="USD">35.00000</ItemUnitPrice>
<ItemProductQuantity>1.0</ItemProductQuantity>
<ItemProductDescription>Classic pleated dresspant</ItemProductDescription>
<ShipToInfo>
<ContactPersonName>
<LastName>Fitzsimons</LastName>
<FirstName>Paul</FirstName>
<AlternateName>-1000_1012324915586</AlternateName>
</ContactPersonName>
<Address>
<AddressLine>Home</AddressLine>
<AddressLine></AddressLine>
<City>Brum</City>
<State>W Mids</State>
<Zip>B73</Zip>
<Country>England</Country>
</Address>
<ContactInfo>
<Telephone type="primary"></Telephone>
</ContactInfo>
</ShipToInfo>
<ShippingCarrierInfo>
<Carrier>XYZCarrier</Carrier>
<Method>A1</Method>
</ShippingCarrierInfo>
<ShipStatus>C</ShipStatus>
<DateTimeReference>
<PlacedDate>20020205</PlacedDate>
<PlacedTime>151945</PlacedTime>
<LastUpdateDate>20020205</LastUpdateDate>
<LastUpdateTime>152043</LastUpdateTime>
</DateTimeReference>
</ReportPOItem>
</ReportPO>
</DataArea>
</Report_NC_PurchaseOrder>
(2)
<Report_NC_PurchaseOrder>
<DataArea>
<ReportPO>
<ReportPOHeader>
<OrderNumberByNC>10253</OrderNumberByNC>
<DateTimeReference>
<PlacedDate>20020205</PlacedDate>
<PlacedTime>152043</PlacedTime>
</DateTimeReference>
<TotalPriceInfo currency="USD">
<TotalNetPrice>60.00000</TotalNetPrice>
<TaxInfo>
<MonetaryAmount currency="USD">3.00000</MonetaryAmount>
</TaxInfo>
<TotalShippingPrice>7.00000</TotalShippingPrice>
<TotalTaxOnShippingPrice>0.00000</TotalTaxOnShippingPrice>
</TotalPriceInfo>
<ShipStatus>C</ShipStatus>
<BillToInfo>
<Address>
<AddressLine>Home</AddressLine>
<AddressLine></AddressLine>
<City>Brum</City>
<State>W Mids</State>
<Zip>B73</Zip>
<Country>England</Country>
</Address>
<ContactPersonName>
<LastName>Fitzsimons</LastName>
<FirstName>Paul</FirstName>
<AlternateName>-1000_1012324915586</AlternateName>
</ContactPersonName>
<ContactInfo>
<Telephone type="primary"></Telephone>
</ContactInfo>
</BillToInfo>
<MerchantInfo>
<OrgName>In Fashion</OrgName>
<OrgId type="NCInternal">10001</OrgId>
<Address>
<AddressLine>12xx Martindale Avenue</AddressLine>
<AddressLine>Suite 9xx</AddressLine>
<City>Clothesville</City>
<State>Ontario</State>
<Zip>Lxx 1xx</Zip>
<Country>Canada</Country>
</Address>
<ContactInfo>
<Telephone type="primary">1-800-555-1234</Telephone>
<Email type="primary">info@infashion.xxx</Email>
<Fax>1-800-555-4321</Fax>
</ContactInfo>
</MerchantInfo>
<PCardInfo>
<MonetaryAmount currency="USD"></MonetaryAmount>
<CardType>Visa</CardType>
<CardNumber>4111111111111111</CardNumber>
</PCardInfo>
<OrderCustomerField></OrderCustomerField>
<OrderCustomerField></OrderCustomerField>
</ReportPOHeader>
<ReportPOItem>
<ItemLineNumber>0</ItemLineNumber>
<ItemNumberByNC>10253</ItemNumberByNC>
<ProductNumberByMerchant>sku-194</ProductNumberByMerchant>
<ItemUnitPrice currency="USD">25.00000</ItemUnitPrice>
<ItemProductQuantity>1.0</ItemProductQuantity>
<ItemProductDescription>Casual shirt</ItemProductDescription>
<ShipToInfo>
<ContactPersonName>
<LastName>Fitzsimons</LastName>
<FirstName>Paul</FirstName>
<AlternateName>-1000_1012324915586</AlternateName>
</ContactPersonName>
<Address>
<AddressLine>Home</AddressLine>
<AddressLine></AddressLine>
<City>Brum</City>
<State>W Mids</State>
<Zip>B73</Zip>
<Country>England</Country>
</Address>
<ContactInfo>
<Telephone type="primary"></Telephone>
</ContactInfo>
</ShipToInfo>
<ShippingCarrierInfo>
<Carrier>XYZ Carrier</Carrier>
<Method>A1</Method>
</ShippingCarrierInfo>
<ShipStatus>C</ShipStatus>
<DateTimeReference>
<PlacedDate>20020205</PlacedDate>
<PlacedTime>114553</PlacedTime>
<LastUpdateDate>20020205</LastUpdateDate>
<LastUpdateTime>152043</LastUpdateTime>
</DateTimeReference>
</ReportPOItem>
<ReportPOItem>
<ItemLineNumber>1</ItemLineNumber>
<ItemNumberByNC>10255</ItemNumberByNC>
<ProductNumberByMerchant>sku-133</ProductNumberByMerchant>
<ItemUnitPricecurrency="USD">35.00000</ItemUnitPrice>
<ItemProductQuantity>1.0</ItemProductQuantity>
<ItemProductDescription>Classic pleated dresspant</ItemProductDescription>
<ShipToInfo>
<ContactPersonName>
<LastName>Fitzsimons</LastName>
<FirstName>Paul</FirstName>
<AlternateName>-1000_1012324915586</AlternateName>
</ContactPersonName>
<Address>
<AddressLine>Home</AddressLine>
<AddressLine></AddressLine>
<City>Brum</City>
<State>W Mids</State>
<Zip>B73</Zip>
<Country>England</Country>
</Address>
<ContactInfo>
<Telephone type="primary"></Telephone>
</ContactInfo>
</ShipToInfo>
<ShippingCarrierInfo>
<Carrier>XYZCarrier</Carrier>
<Method>A1</Method>
</ShippingCarrierInfo>
<ShipStatus>C</ShipStatus>
<DateTimeReference>
<PlacedDate>20020205</PlacedDate>
<PlacedTime>151945</PlacedTime>
<LastUpdateDate>20020205</LastUpdateDate>
<LastUpdateTime>152043</LastUpdateTime>
</DateTimeReference>
</ReportPOItem>
</ReportPO>
</DataArea>
</Report_NC_PurchaseOrder>
[/code][/url][/list][/list] |
|
Back to top |
|
 |
kirani |
Posted: Wed Jul 03, 2002 8:47 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Looks like there is a typo error in message (1).
<ItemUnitPricecurrency="USD">35.00000</ItemUnitPrice>
There should be a space between Element name and Attribute name.
You don't need to copy DTD on your machine unless you want to validate the input message against DTD. Could you post the ESQL where you are trying to refer to ReportPOItem Element and we will see what is going wrong there. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
cronydude |
Posted: Wed Jul 03, 2002 9:33 pm Post subject: |
|
|
 Voyager
Joined: 11 Nov 2001 Posts: 85 Location: US
|
Hi,
If kirani's reply did not solve ur problem, then here is my guess...
Probably u r not referring the correct occurance of 'Report_NC_PurchaseOrder' element.When u refer 'InputBody.Report_NC_PurchaseOrder.blah.blah.', MQSI takes the first occurance of 'Report_NC_PurchaseOrder' in DocType declaration.
So, u have to refer it as 'InputBody.Report_NC_PurchaseOrder[2].blah.blah.' instead.
If u r referring to, say, 'ItemLineNumber', u have to use the following ESQL :
InputBody.Report_NC_PurchaseOrder[2].DataArea.ReportPO.ReportPOItem[1].ItemLineNumber;
crony |
|
Back to top |
|
 |
Gary Ellwood |
Posted: Wed Jul 03, 2002 11:52 pm Post subject: |
|
|
Novice
Joined: 17 Apr 2002 Posts: 12
|
Thanks for the responses. I would really like to get mesage 1 working, if possible, as this is the message format presented by WebSphere Commerce.
However, the ESQL I am presently using to extract records from the Message only works with message type 2. The ESQL below extracts the first occurance of the ReportPOItem only:
DECLARE I INTEGER;
SET I = 1;
WHILE I < CARDINALITY(InputRoot.*[]) DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I=I+1;
END WHILE;
SET I=1;
-- Enter SQL below this line. SQL above this line might be regenerated, causing any modifications to be lost.
SET OutputRoot.XML.ManOrder.PlacedDate = InputBody.Report_NC_PurchaseOrder.DataArea.ReportPO.ReportPOHeader.DateTimeReference.PlacedDate;
SET OutputRoot.XML.ManOrder.PlaceTime = InputBody.Report_NC_PurchaseOrder.DataArea.ReportPO.ReportPOHeader.DateTimeReference.PlacedTime;
SET OutputRoot.XML.ManOrder.OrderNumberByNC = InputBody.Report_NC_PurchaseOrder.DataArea.ReportPO.ReportPOHeader.OrderNumberByNC;
WHILE I <= CARDINALITY(InputBody."Report_NC_PurchaseOrder"."DataArea"."ReportPO"."ReportPOItem"."ItemLineNumber"[]) DO
SET OutputRoot.XML.ManOrder.ItemLineNumber = InputBody.Report_NC_PurchaseOrder.DataArea.ReportPO.ReportPOItem.ItemLineNumber[I];
SET OutputRoot.XML.ManOrder.ProductNumberByMerchant = InputBody."Report_NC_PurchaseOrder"."DataArea"."ReportPO"."ReportPOItem"."ProductNumberByMerchant"[I];
SET OutputRoot.XML.ManOrder.ItemProductQuantity = InputBody."Report_NC_PurchaseOrder"."DataArea"."ReportPO"."ReportPOItem"."ItemProductQuantity"[I];
SET I=I+1;
END WHILE;
I'm sure the cardinality test in the above is at the wrong level, but if I put it at the ReportPOItem, it fails with the following message in the usertrace log:
'CARDINALITY(InputBody.Report_NC_PurchaseOrder.DataArea.ReportPO.ReportPOItem[])'.
No user action required.
2002-07-02 18:32:13.076999 2036 Error BIP2628E: Exception condition detected on input node 'Gary_Test.MQInput1'.
The input node 'Gary_Test.MQInput1' detected an error whilst processing a message. The message flow has been rolled-back and, if the message was being processed in a unit of work, it will remain on the input queue to be processed again. Following messages will indicate the cause of this exception.
Check the error messages which follow to determine why the exception was generated, and take action as described by those messages.
2002-07-02 18:32:13.076999 2036 ImbComputeNode::evaluate
2002-07-02 18:32:13.076999 2036 ImbXmlParser::parseRightSibling
2002-07-02 18:32:13.076999 2036 XmlBrokerAsgardParser::error , 10, , 103, 27, Expected an attribute name, ReportPOItem
Thanks for the assistance. Much appreciated. |
|
Back to top |
|
 |
kirani |
Posted: Thu Jul 04, 2002 8:54 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Gary,
You could get the cardinality of ReportPOItem using following ESQL for message 1,
CARDINALITY(InputBody.(XML.Element)Report_NC_PurchaseOrder.DataArea.ReportPO.ReportPOItem[])
You will have to modify ESQL in your compute node to use above reference while creating new output message.
Hope this helps! _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
Gary Ellwood |
Posted: Fri Jul 05, 2002 12:54 am Post subject: |
|
|
Novice
Joined: 17 Apr 2002 Posts: 12
|
Kirani,
Thanks for that.
I now have a partial success with the ESQL you suggested. Adding ".(XML.Element)" seems to allow me to read message 1 and extract information from the ReportPOHeader area.
However, the Cardinality statement continues to report the same error:
CARDINALITY(InputBody.(XML.Element)Report_NC_PurchaseOrder.DataArea.ReportPO.ReportPOItem[])'.
No user action required.
2002-07-05 09:18:37.317001 2064 Error BIP2628E: Exception condition detected on input node 'Gary_Test.MQInput1'.
The input node 'Gary_Test.MQInput1' detected an error whilst processing a message. The message flow has been rolled-back and, if the message was being processed in a unit of work, it will remain on the input queue to be processed again. Following messages will indicate the cause of this exception.
Check the error messages which follow to determine why the exception was generated, and take action as described by those messages.
2002-07-05 09:18:37.317001 2064 ImbComputeNode::evaluate
2002-07-05 09:18:37.317001 2064 ImbXmlParser::parseRightSibling
2002-07-05 09:18:37.317001 2064 XmlBrokerAsgardParser::error , 10, , 103, 27, Expected an attribute name, ReportPOItem
2002-07-05 09:18:38.318000 2064 UserTrace BIP2638I: MQPUT to queue 'DLQ' on queue manager 'MQSIV2': MQCC=0, MQRC=0
Again, you help is much appreciated.
Regards
Gary Ellwood |
|
Back to top |
|
 |
kirani |
Posted: Fri Jul 05, 2002 8:04 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Gary,
This is how your ESQL in compute node should look like:
Code: |
SET I=1;
SET OutputRoot.XML.ManOrder.PlacedDate = InputBody.(XML.Element)Report_NC_PurchaseOrder.DataArea.ReportPO.ReportPOHeader.DateTimeReference.PlacedDate;
SET OutputRoot.XML.ManOrder.PlaceTime = InputBody.(XML.Element)Report_NC_PurchaseOrder.DataArea.ReportPO.ReportPOHeader.DateTimeReference.PlacedTime;
SET OutputRoot.XML.ManOrder.OrderNumberByNC = InputBody.(XML.Element)Report_NC_PurchaseOrder.DataArea.ReportPO.ReportPOHeader.OrderNumberByNC;
WHILE I <= CARDINALITY(InputBody.(XML.Element)Report_NC_PurchaseOrder.DataArea.ReportPO.ReportPOItem[]) DO
SET OutputRoot.XML.ManOrder.ItemLineNumber[I] = InputBody.(XML.Element)Report_NC_PurchaseOrder.DataArea.ReportPO.ReportPOItem[I].ItemLineNumber;
SET OutputRoot.XML.ManOrder.ProductNumberByMerchant[I] = InputBody.(XML.Element)Report_NC_PurchaseOrder.DataArea.ReportPO.ReportPOItem[I].ProductNumberByMerchant;
SET OutputRoot.XML.ManOrder.ItemProductQuantity[I] = InputBody.(XML.Element)Report_NC_PurchaseOrder.DataArea.ReportPO.ReportPOItem[I].ItemProductQuantity;
SET I=I+1;
END WHILE;
|
Given Message 1 as input to this node, it will generate following output message.
Code: |
<ManOrder>
<PlacedDate>20020205</PlacedDate>
<PlaceTime>152043</PlaceTime>
<OrderNumberByNC>10253</OrderNumberByNC>
<ItemLineNumber>0</ItemLineNumber>
<ItemLineNumber>1</ItemLineNumber>
<ProductNumberByMerchant>sku-194</ProductNumberByMerchant>
<ProductNumberByMerchant>sku-133</ProductNumberByMerchant>
<ItemProductQuantity>1.0</ItemProductQuantity>
<ItemProductQuantity>1.0</ItemProductQuantity>
</ManOrder>
|
_________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
Gary Ellwood |
Posted: Mon Jul 08, 2002 12:15 am Post subject: |
|
|
Novice
Joined: 17 Apr 2002 Posts: 12
|
Thanks again Kirani.
I have amended the ESQL within the compute node as you specified. However, I am still getting the following error :
CARDINALITY(InputBody.(XML.Element)Report_NC_PurchaseOrder.DataArea.ReportPO.ReportPOItem[])' at (14, 12).
The expression being evaluated was 'CARDINALITY(InputBody.(XML.Element)Report_NC_PurchaseOrder.DataArea.ReportPO.ReportPOItem[])'.
No user action required.
2002-07-08 09:23:02.711999 860 Error BIP2628E: Exception condition detected on input node 'Gary_Test.MQInput1'.
The input node 'Gary_Test.MQInput1' detected an error whilst processing a message. The message flow has been rolled-back and, if the message was being processed in a unit of work, it will remain on the input queue to be processed again. Following messages will indicate the cause of this exception.
Check the error messages which follow to determine why the exception was generated, and take action as described by those messages.
2002-07-08 09:23:02.711999 860 ImbComputeNode::evaluate
2002-07-08 09:23:02.711999 860 ImbXmlParser::parseRightSibling
2002-07-08 09:23:02.711999 860 XmlBrokerAsgardParser::error , 10, , 108, 27, Expected an attribute name, ReportPOItem
2002-07-08 09:23:03.713999 860 UserTrace BIP2638I: MQPUT to queue 'DLQ' on queue manager 'MQSIV2': MQCC=0, MQRC=0; node 'Gary_Test.MQInput1'.
The node 'Gary_Test.MQInput1' attempted to write a message to the specified queue 'DLQ' connected to queue manager 'MQSIV2'. The MQCC was 0 and the MQRC was 0.
It still apeears not to like ReportPOItem[].....
Apologies if this is becoming a bit of a saga!!
Regards
Gary Ellwood |
|
Back to top |
|
 |
kirani |
Posted: Mon Jul 08, 2002 6:53 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Gary,
I have tested above ESQL with Message (1) myself and it works fine for me. Are you sure you are sending correct input message? In my earlier post I pointed out an error in Message (1), you need to correct that first. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
Gary Ellwood |
Posted: Thu Jul 11, 2002 2:33 am Post subject: |
|
|
Novice
Joined: 17 Apr 2002 Posts: 12
|
Thanks very much for the assistance. I now have this working, it was the error in the input XML that you pointed out causing the problem.
Thanks again.
Gary E. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|