· Mar 6, 2017

XML Virtual Documents programmatic handling


In Ensemble we have a http service that need to handle various ISO200022 xml structures .
We would want to use the Virtual Document message structures to pass this xml document on to the reset of the Production for processing. 

From the documentation and class EnsLib.EDI.XML.Document it seems that this should be possible, but we are unsure of the correct way to do this.
Also this will enable us to be able to search the messages in Ensemble and validate the xml document , on specific properties inside the xml document.

Are there any documentation to assist with this or some example on how to create such a virtual document to send it to a Route EnsLib.MsgRouter.VDocRoutingEngine process to do translation etc.

Then for the reverse is it also possible to create a Virtual Document form a Persistent Object programmatically and send it out via a http business operation?



Discussion (1)0
Log in or sign up to continue


Hope I understood your question correctly, if not then let me know.

In general, when dealing with XML VDoc documents (files), you need to create a production that uses services based on

EnsLib.EDI.XML.Service.FileService, operations based on EnsLib.EDI.XML.Operation.FileOperation and a routing process - EnsLib.MsgRouter.VDocRoutingEngine. There is no need to do any coding, just supply parameters in the production diagram.

You may need to provide DocSchemaCategory setting for a service, for this, you need to import the XML Schema, using Import button at Ensemble->Interopeate->XML->XML Schema Structures page.

for actual routing, you need to design a rule, and supply path to the document element/attribute that's used to decide where the rule sends document to. I prefer using XPATH expressions for this.

An example of routing rule contents is here:

<ruleDefinition alias="" context="EnsLib.MsgRouter.VDocRoutingEngine" production="tzp.dasta.router.Production">
<ruleSet name="" effectiveBegin="" effectiveEnd="">
<trace value="Document.{/dasta/is/ip/lo/loi/@material}"></trace>
<rule name="">
<constraint name="source" value="Dasta3Zadanka"></constraint>
<constraint name="msgClass" value="EnsLib.EDI.XML.Document"></constraint>
<constraint name="docCategory" value="ds030101"></constraint>
<when condition="Document.{/dasta/is/ip/lo/loi/@material}=&quot;B&quot;">
<send transform="" target="Dasta3Biochemie"></send>
<send transform="" target="Dasta3Mikrobiologie"></send>

You can create a VDOC document from a persistent (any, not only persistent) object, as long as it extends also from %XML.Adaptor. First, you serialize your object instance to XML stream or string, and then using ImportFromString/ImportFromLibraryStream (or other - see online reference for EnsLib.EDI.XML.Document class) method you instantiate a VDoc document.