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 » Problem when create XML Message in Uncommon order

Post new topic  Reply to topic
 Problem when create XML Message in Uncommon order « View previous topic :: View next topic » 
Author Message
Sugiono
PostPosted: Sun Nov 17, 2002 5:20 pm    Post subject: Problem when create XML Message in Uncommon order Reply with quote

Newbie

Joined: 15 Oct 2002
Posts: 3

Hi All,

I need to create an xml message in uncommon order to conform our partner's proprietary format.
Here is the format :

<XMLMessage>
<Order>
<OrderNo>123<OrderNo>
</Order>
<OrderDetail>
<LineNo>1</LineNo>
<LineNo>2</LineNo>
</OrderDetail>
<Order>
<OrderNo>124<OrderNo>
</Order>
<OrderDetail>
<LineNo>1</LineNo>
<LineNo>2</LineNo>
</OrderDetail>
</XMLMessage>

When I tried to create it ( using MQSI 2.1, MQSeries 5.2) , the result is :
<XMLMessage>
<Order>
<OrderNo>123<OrderNo>
</Order>
<Order>
<OrderNo>124<OrderNo>
</Order>
<OrderDetail>
<LineNo>1</LineNo>
<LineNo>2</LineNo>
</OrderDetail>
<OrderDetail>
<LineNo>1</LineNo>
<LineNo>2</LineNo>
</OrderDetail>
</XMLMessage>


Any help please, thanks.

Sugi
Back to top
View user's profile Send private message
seeknee
PostPosted: Mon Nov 18, 2002 1:26 am    Post subject: Reply with quote

Apprentice

Joined: 08 Aug 2002
Posts: 41
Location: Melbourne, Australia

Hi

When creating the XML in the compute node try

OutputRoot.XML.Message.Order[1].OrderNo = '123';
OutputRoot.XML.Message.Order[1].OrderDetails.LineNo[1] = '1';
OutputRoot.XML.Message.Order[1].OrderDetails.LineNo[2] = '2';
OutputRoot.XML.Message.Order[2].OrderNo = '124';
OutputRoot.XML.Message.Order[2].OrderDetails.LineNo[1] = '1';
OutputRoot.XML.Message.Order[2].OrderDetails.LineNo[2] = '2';

Hopefully this is what you are looking for !!
Back to top
View user's profile Send private message
Sugiono
PostPosted: Mon Nov 18, 2002 1:47 am    Post subject: Reply with quote

Newbie

Joined: 15 Oct 2002
Posts: 3

Hi Seeknee...

Thanks for the answer.
Unfortunately, the Order and OrderDetail are the children of root element which is XMLMessage. And as far as we know, root element can be only 1.

Any other ideas ???

Sugi
Back to top
View user's profile Send private message
vmcgloin
PostPosted: Mon Nov 18, 2002 2:18 am    Post subject: Reply with quote

Knight

Joined: 04 Apr 2002
Posts: 560
Location: Scotland

Sugi,

Can you post the ESQL that you are currently using?

I imagine that you have an Order array and an OrderDetail array which is why they are being grouped together.
You might be able to try using ATTACH to get things in the right order.

Vicky
Back to top
View user's profile Send private message
seeknee
PostPosted: Mon Nov 18, 2002 2:33 am    Post subject: Reply with quote

Apprentice

Joined: 08 Aug 2002
Posts: 41
Location: Melbourne, Australia

Have you tried building the xml in the correct order !!!!

OutputRoot.XML.XMLMessage.Order.OrderNo = '123';
OutputRoot.XML.XMLMessage.OrderDetails.LineNo[1] = '1';
OutputRoot.XML.XMLMessage.OrderDetails.LineNo[2] = '2';
OutputRoot.XML.XMLMessage.Order.OrderNo = '124';
OutputRoot.XML.XMLMessage.OrderDetails.LineNo[1] = '1';
OutputRoot.XML.XMLMessage.OrderDetails.LineNo[2] = '2';

OR

Have you tried creating it using NEXTSIBLING ect ect

Other than that I am out of ideas.

Ian
Back to top
View user's profile Send private message
Sugiono
PostPosted: Mon Nov 18, 2002 3:35 am    Post subject: Reply with quote

Newbie

Joined: 15 Oct 2002
Posts: 3

Hi vicky,

You are right that I am using array, because without array, previous one will be overwritten. fyi, in my scenario here, the order and orderdetail will be ALWAYS in one to one relationship.
Here is my very simplified ESQL snippet :

SET lTotalOrders = CARDINALITY(InputRoot.XML.ShippingOrders.Order);

WHILE lSequence <= lTotalOrder DO
SET MyOutput.Order[lSequence].OrderNo = MyInput.Order[lSequence].OrderNo;
SET MyOutput.OrderDetails[lSequence].LineNo = MyInput.Order[lSequence].OrderLine[1].LineNo;

SET lSequence = lSequence + 1;
END WHILE;

About your suggestion using Attach, I cannot figure out how to use it in this context , can you give me a rough idea ? Thanks.

Ian, I have tested your idea, but previous order and orderdetail is overwritten. That's why I am using array at the first place.

Thanks

Sugi
Back to top
View user's profile Send private message
vmcgloin
PostPosted: Mon Nov 18, 2002 3:59 am    Post subject: Reply with quote

Knight

Joined: 04 Apr 2002
Posts: 560
Location: Scotland

Sugi,

I would expect what you are using to work, wheeas I would expect a separate while loops for each array to give the output you are seeing.

I have not actually used attach - maybe Ian can correct me if I am wrong - but try something like:
-- Outside loop
DECLARE ref1 REFERENCE;

-- Inside loop
SET ref1 = XMLMessage.OrderDetails[lSequence];
DETACH ref1;
ATTACH ref1 TO OutputRoot.XML.XMLMessage.Order[lSequence] AS NEXTSIBLING;

Put the above in your while loop after the 2 lines that are there - modifying as appropriate for the actual path names.

Good luck
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 » Problem when create XML Message in Uncommon order
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.