Author |
Message
|
wbirookie |
Posted: Fri Jan 16, 2009 3:02 pm Post subject: Message was not in order when sends to Websphere MQ |
|
|
Novice
Joined: 16 Jan 2009 Posts: 13
|
I have an esql which send message to MQ but I open it the message was not in Order. If I send only one order, there is no problem but when I send multiple order , the sequence was not in order. Any help will be appreciated.
I supposed to get
<Envlope>
<Data>
<Header></Header>
<Detail>
<Item></Item>
<Item></Item>
</Detail>
<Header></Header>
<Detail>
<Item></Item>
</Detail>
<Header></Header>
<Detatil>
<item></Item>
<item></Item>
</Detail>
</Data>
<Envelope>
but what I am getting was
<Envlope>
<Data>
<Header></Header>
<Header></Header>
<header></Header>
<Detail>
<Item></Item>
<Item></Item>
<item></Item>
</Detail>
</Data>
<Envelope> |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jan 16, 2009 3:21 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
One message relying on the previous one is called "message affinity" and is considered bad for reasons including the one you've found.
WMQ does not guarantee that messages will be delivered in the order sent unless you take specific action to group and order the messages. This really only works if you have a small, discrete block of messages sent around the same time.
But you're better off removing the affinity. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Jan 17, 2009 1:20 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
And I sure hope you are not talking about a soap message because your setup is completely wrong for a soap message  _________________ MQ & Broker admin |
|
Back to top |
|
 |
wbirookie |
Posted: Sat Jan 17, 2009 2:28 pm Post subject: |
|
|
Novice
Joined: 16 Jan 2009 Posts: 13
|
What is supposed to be the setup for SOAP Message, I am new to WBI so I know nothing about this setup. If you want I can send you the code. Thank you. |
|
Back to top |
|
 |
zpat |
Posted: Sun Jan 18, 2009 12:51 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
This is about the order of tags, not the order of messages. |
|
Back to top |
|
 |
mqjeff |
Posted: Sun Jan 18, 2009 9:54 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The order of "tags" in a message created by ESQL is exactly equivalent to the order of the statements that SET those tags...
That is, it is exactly equivalent to the chain of FIRST CHILD, NEXT SIBLING relationships in the message tree.
This is true of all message trees, regardless of whether they are created by ESQL or not, except in some specialized cases with MRM where the parser will order tags according to the order in the message definition.
ERGO, wbirookie: You are getting all of your headers first because you are setting all your headers first. |
|
Back to top |
|
 |
wbirookie |
Posted: Sun Jan 18, 2009 10:25 am Post subject: ESQL |
|
|
Novice
Joined: 16 Jan 2009 Posts: 13
|
You're right my ESQL write the <Header> first and then <Detail>. This is true if I process one record. Heres my ESQL. Thanks for all your help.
CREATE COMPUTE MODULE OPNA_ILS_ASB_INVOICE_ACK_CreateXML
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
DECLARE DateTimeStp CHARACTER;
DECLARE ackTimeStp CHARACTER;
DECLARE pattern CHARACTER 'yyyy-MM-dd"T"HH.mm.ss';
DECLARE i INT 1;
DECLARE k INT;
DECLARE Count INT;
DECLARE Dtl INT;
SET Count = CARDINALITY(Environment.IXSB005P[]);
WHILE (i<=Count) DO
CALL CopyMessageHeaders();
SET OutputRoot.XML.Envelope.PO[i].ASBPartnerID=Environment.IXSB005P[i].ASBPID;
SET OutputRoot.XML.Envelope.PO.POHeader[i].PONumber=Environment.IXSB005P[i].CUSPO;
SET OutputRoot.XML.Envelope.PO.POHeader[i].ASBOrderNumber=Environment.IXSB005P[i].ASBORD;
SET ackTimeStp = CAST(Environment.IXSB005P[i].ACKTMS AS CHARACTER);
SET DateTimeStp = SUBSTRING(ackTimeStp FROM 1 FOR 10)||'T'||SUBSTRING(ackTimeStp FROM 12 FOR 2)||':'||SUBSTRING(ackTimeStp FROM 15 FOR 2)||':'||SUBSTRING(ackTimeStp FROM 18 FOR 2);
SET OutputRoot.XML.Envelope.PO.POHeader[i].AcknowledgmentTimestamp=DateTimeStp;
SET OutputRoot.XML.Envelope.PO.POHeader[i].PODisposition=Environment.IXSB005P[i].PODISP;
SET OutputRoot.XML.Envelope.PO.POHeader[i].PODispositionComments=Environment.IXSB005P[i].POREJR;
SET k=1;
SET Dtl = CARDINALITY(Environment.IXSB006P[]);
WHILE (k<=Dtl) DO
IF( Environment.IXSB005P[i].CUSPO = Environment.IXSB006P[k].CUSPO) THEN
SET OutputRoot.XML.Envelope.PO.PODetail.Item[k].ItemNumber = Environment.IXSB006P[k].CUSITM;
SET OutputRoot.XML.Envelope.PO.PODetail.Item[k].AvyItemNumber = Environment.IXSB006P[k].AVYITM;
SET OutputRoot.XML.Envelope.PO.PODetail.Item[k].ArtworkNumber = Environment.IXSB006P[k].ARWKID;
SET OutputRoot.XML.Envelope.PO.PODetail.Item[k].ItemSequence = Environment.IXSB006P[k].ITMSEQ;
SET OutputRoot.XML.Envelope.PO.PODetail.Item[k].Qty = CAST(Environment.IXSB006P[k].POQTY as CHARACTER);
SET OutputRoot.XML.Envelope.PO.PODetail.Item[k].ItemDisposition = Environment.IXSB006P[k].ITDISP;
SET OutputRoot.XML.Envelope.PO.PODetail.Item[k].ItemDispositionComments = Environment.IXSB006P[k].ITREJR;
END IF;
SET k=k+1;
END WHILE;
SET i=i+1;
END WHILE;
PROPAGATE DELETE NONE;
RETURN FALSE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE; |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Jan 18, 2009 11:25 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Do not use the XML parser it is deprecated and will not support soap.
Use XMLNSC or XMLNS
Then on a Soap message you should always have
Declare soap NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
OutputRoot.XMLNSC.soap:Envelope.soap:Body.messagexmlroot
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
wbirookie |
Posted: Sun Jan 18, 2009 9:53 pm Post subject: XML Schema. |
|
|
Novice
Joined: 16 Jan 2009 Posts: 13
|
Below is the XML Schema, I have imported it to my Message Set Definition but its in Default Namespace, How I am going use this in my ESQL, I mean use in my Declare statement. Thanks again for all your help.
?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="Envelope">
<xs:complexType>
<xs:sequence>
<xs:element name="POAcknowledgement" maxOccurs="unbounded" minOccurs="1">
<xs:complexType>
<xs:element name="ASBPartnerID" type="xs:string"/>
<xs:sequence>
<xs:element name="POAcknowledgementHeader" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="PONumber" type="xs:string"/>
<xs:element name="ASBOrderNumber" type="xs:string"/>
<xs:element name="AcknowledgementTimestamp" type="xs:dateTime"/>
<xs:element name="TradingPartnerID" type="xs:string"/>
<xs:element name="PODisposition" type="xs:string"/>
<xs:element name="PODispositionComments" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="POAcknowledgementDetail" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="Item" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="ItemNumber" type="xs:string"/>
<xs:element name="AvyItemNumber" type="xs:string"/>
<xs:element name="ArtworkNumber" type="xs:string"/>
<xs:element name="ItemSequence" type="xs:string"/>
<xs:element name="Qty" type="xs:string"/>
<xs:element name="ItemDisposition" type="xs:string"/>
<xs:element name="ItemDispositionComments" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema> |
|
Back to top |
|
 |
wbirookie |
Posted: Sun Jan 18, 2009 9:56 pm Post subject: |
|
|
Novice
Joined: 16 Jan 2009 Posts: 13
|
My goal here is to have an XML in the following order.
<Envelope>
<PO>
<ASBPartnerID>ECI </ASBPartnerID>
<POHeader>
<PONumber>10472 </PONumber>
<ASBOrderNumber>649 </ASBOrderNumber>
<AcknowledgmentTimestamp>2009-01-14T15:49:55</AcknowledgmentTimestamp>
<PODisposition>PASS </PODisposition>
<PODispositionComments> </PODispositionComments>
</POHeader>
<PODetail>
<Item>
<ItemNumber>777112095000001</ItemNumber>
<AvyItemNumber> </AvyItemNumber>
<ArtworkNumber>2904 </ArtworkNumber>
<ItemSequence>1</ItemSequence>
<Qty>1</Qty>
<ItemDisposition>PASS </ItemDisposition>
<ItemDispositionComments> </ItemDispositionComments>
</Item>
<Item>
<ItemNumber>777112095000001</ItemNumber>
<AvyItemNumber> </AvyItemNumber>
<ArtworkNumber>3190 </ArtworkNumber>
<ItemSequence>1</ItemSequence>
<Qty>1</Qty>
<ItemDisposition>Pass </ItemDisposition>
<ItemDispositionComments> </ItemDispositionComments>
</Item>
</PODetail>
<ASBPartnerID>ECI </ASBPartnerID>
******New Lines of XML ******************************
<POHeader>
<PONumber>10473 </PONumber>
<ASBOrderNumber>799 </ASBOrderNumber>
<AcknowledgmentTimestamp>2009-01-15T14:44:49</AcknowledgmentTimestamp>
<PODisposition>Pass </PODisposition>
<PODispositionComments> </PODispositionComments>
</POHeader>
<PODetail>
<Item>
<ItemNumber>AVE20900 </ItemNumber>
<AvyItemNumber> </AvyItemNumber>
<ArtworkNumber>3191 </ArtworkNumber>
<ItemSequence>2</ItemSequence>
<Qty>1</Qty>
<ItemDisposition>Pass </ItemDisposition>
<ItemDispositionComments> </ItemDispositionComments>
</Item>
<Item>
<ItemNumber>AVE20900 </ItemNumber>
<AvyItemNumber> </AvyItemNumber>
<ArtworkNumber>3192 </ArtworkNumber>
<ItemSequence>3</ItemSequence>
<Qty>2</Qty>
<ItemDisposition>Pass </ItemDisposition>
<ItemDispositionComments> </ItemDispositionComments>
</Item>
<Item>
<ItemNumber>AVE20900 </ItemNumber>
<AvyItemNumber> </AvyItemNumber>
<ArtworkNumber>3192 </ArtworkNumber>
<ItemSequence>3</ItemSequence>
<Qty>2</Qty>
<ItemDisposition>Pass </ItemDisposition>
<ItemDispositionComments> </ItemDispositionComments>
</Item>
</PODetail>
</PO>
</Envelope> |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jan 19, 2009 2:44 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
This would all be part of the soap:Body...
Just define them in that order and you should be fine.
Remember to look at it as a tree and you are walking its branches in sequence...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
wbirookie |
Posted: Mon Jan 19, 2009 10:13 am Post subject: |
|
|
Novice
Joined: 16 Jan 2009 Posts: 13
|
Hi, maybe I am asking too much but how will I set my outputroot. Just give me an idea. I am really new to this area. just like how I will assigned my Header to the OutputRoot. Whats the syntax.... Let say this is my first statement. Thanks a lot.
SET OutputRoot.XMLNS.Envelope.POAcknowledgement.POAcknowledgementHeader[x].PONumber=Environment.IXSB055PX[x].CUSPO; |
|
Back to top |
|
 |
|