Batch Wrapper Schema
How does one implement the batch wrapper to allow batching of V3 messages?
(From Mead Walker) is that the message element in the published schema is replaced by an element or collection of elements for the instance
We have three interactions: PORR_IN049016UV, PORR_IN049017UV, and PORR_IN048918UV (These allows us to submit a report, revise a report, and retract one.).
In my schema, then, i would replace the message element with three elements, one for each of my interactions. Does this mean that the batch has to sort the included messages in the same order as the elements appear in the schema? So, it seems I would be wrong to simply plop the elements in. Do I use xs:choice? Can it be simply inline -within the sequence of elements for the batch, or do I need to keep the message element around?
(from Rene Spronk:) Well, this is part of the XML ITS documentation. The XML ITS requires that the root element of a Message is not Message, but the interaction ID.
Remember that batches are groupers for transport reasons only. An analogy: instead of sending 100 individual envelopes (each with one document) we're sending a single Box which contains the 100 envelopes. The receiver opens the box, takes out the envelopes, *throws away the box*, and starts processing/reading the enevelopes as if they were received as individual envelopes.
In other words: if you strip the Batch-XML away, the remainder should be a series of valid message-XML-snippets which can be processed as if they were received individually. Which means using the interaction ID as the root element of the Messages. I'm not sure if the XML ITS has been updated to include any statements about the use of Batches and the impact that this has on the root element of Messages contained therein. (this change has been discussed with the ITS WG in the past)
Discussion
Simply substituting the "Batch package" as the element content of a message element is this: (and gives an improper extra "Message" element)
<xs:complexType name="MCCI_MT200100UV.Batch"> <xs:sequence> <xs:group ref="InfrastructureRootElements"/> <xs:element name="id" type="II"/> <xs:element name="creationTime" type="TS"/> <xs:element name="securityText" type="ST" minOccurs="0"/> <xs:element name="responseModeCode" type="CS"/> <xs:element name="versionCode" type="CS" minOccurs="0"/> <xs:element name="interactionId" type="II"/> <xs:element name="referenceControlId" type="II" minOccurs="0"/> <xs:element name="name" type="SC" minOccurs="0"/> <xs:element name="batchComment" type="ST" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="transmissionQuantity" type="INT" minOccurs="0"/> <xs:element name="batchTotalNumber" type="INT" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="message" type="MCCI_MT200100UV.Message" nillable="true" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="receiver" type="MCCI_MT200100UV.Receiver"/> <xs:element name="respondTo" type="MCCI_MT200100UV.RespondTo" nillable="true" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="sender" type="MCCI_MT200100UV.Sender"/> <xs:element name="attentionLine" type="MCCI_MT200100UV.AttentionLine" nillable="true" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attributeGroup ref="InfrastructureRootAttributes"/> <xs:attribute name="nullFlavor" type="NullFlavor" use="optional"/> </xs:complexType> AND <xs:complexType name="MCCI_MT200100UV.Message"> <xs:sequence> <xs:group ref="InfrastructureRootElements"/> <xs:element name="PORR_IN049016UV" type="PORR_IN049016UV.MCCI_MT000100UV01.Message" nillable="true" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="PORR_IN049017UV" type="PORR_IN049017UV.MCCI_MT000100UV01.Message" nillable="true" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="PORR_IN049018UV" type="PORR_IN049018UV.MCCI_MT000100UV01.Message" nillable="true" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attributeGroup ref="InfrastructureRootAttributes"/> <xs:attribute name="nullFlavor" type="NullFlavor" use="optional"/> </xs:complexType> '''According to current specs, the proper form is this: (no extra nested message element)''' <xs:complexType name="MCCI_MT200101UV.Batch"> <xs:sequence> <xs:group ref="InfrastructureRootElements"/> <xs:element name="id" type="II"/> <xs:element name="creationTime" type="TS"/> <xs:element name="securityText" type="ST" minOccurs="0"/> <xs:element name="responseModeCode" type="CS"/> <xs:element name="versionCode" type="CS" minOccurs="0"/> <xs:element name="interactionId" type="II"/> <xs:element name="referenceControlId" type="II" minOccurs="0"/> <xs:element name="name" type="SC" minOccurs="0"/> <xs:element name="batchComment" type="ST" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="transmissionQuantity" type="INT" minOccurs="0"/> <xs:element name="batchTotalNumber" type="INT" minOccurs="0" maxOccurs="unbounded"/> <xs:choice minOccurs="1" maxOccurs="unbounded"> <xs:element name="PORR_IN049016UV" type="PORR_IN049016UV.MCCI_MT000100UV01.Message" nillable="false" minOccurs="1" maxOccurs="1"/> <xs:element name="PORR_IN049017UV" type="PORR_IN049017UV.MCCI_MT000100UV01.Message" nillable="false" minOccurs="1" maxOccurs="1"/> <xs:element name="PORR_IN049018UV" type="PORR_IN049018UV.MCCI_MT000100UV01.Message" nillable="false" minOccurs="1" maxOccurs="1"/> </xs:choice> <xs:element name="receiver" type="MCCI_MT200101UV.Receiver"/> <xs:element name="respondTo" type="MCCI_MT200101UV.RespondTo" nillable="true" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="sender" type="MCCI_MT200101UV.Sender"/> <xs:element name="attentionLine" type="MCCI_MT200101UV.AttentionLine" nillable="true" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="acknowledgement" type="MCCI_MT200101UV.Acknowledgement" nillable="true"/> </xs:sequence> <xs:attributeGroup ref="InfrastructureRootAttributes"/> <xs:attribute name="nullFlavor" type="NullFlavor" use="optional"/> </xs:complexType>