Reputation: 938
I have defined a document (from an xsd schema) with some Childs. Those Childs must be in some order, to have correct Xml trnasformation.
When In made some map steps, the element order is not the same as defined in the document reference. How to force that ?
Here the order in te document reference :
And here the order after some map stemp :
The Datas are correct, but not the order.
The problem is that when I make an XmlString, with the documentToXMLString
service, from the document, the order is not correct.
Do you have an idea to force the order, at mapping step or at xml generation ?
Upvotes: 1
Views: 2275
Reputation: 410
Have you tried using the parameter "documentTypeName" to provide the fully qualified document type name for the service pub.xml:documentToXMLString? The documentation "IntegrationServer Build-In Service Reference" states:
documentTypeName String Optional Fully qualified name of the document type that describes the structure and format of the output document (for example, examples.rtd:exampleRecord1). You can use this parameter to ensure that the output includes elements that might not be present in document at run time, or to describe the order in which elements are to appear in the resulting XML String.
EDIT: adding example, using wM 9.7
E.g. I have a xml string like:
<?xml version="1.0"?>
<inputdoc>
<field5>afds</field5>
<field1>asdf</field1>
<field3>asdf</field3>
<field2>asdf</field2>
</inputdoc>
I have an IS doc type with fields field1, field2, field3 and field5 in this order. I have a service where have one input named xmlstring, which contains the above xml string. I call the following services:
This results in the following XML string:
<?xml version="1.0"?>
<field1>asdf</field1>
<field2>asdf</field2>
<field3>asdf</field3>
<field5>afds</field5>
As you can see the order has changed in the correct way.
Greetings
Henning
Upvotes: 1
Reputation: 4278
The easiest is to modify the XSD schema. Use an XSD "sequence" (XSD element Wiki) to defined a specific order for the elements. When that is done, reimport your XSD within webmethods.
If you cannot modify the XSD schema then the other option is create a loop in your flow service and for each PersonalAddress map each field to the fields of your canonical/internal document structure. And in the end, call documentToXMLString
on your internal document.
The best option is to design a solution that doesn't depend on the order of the elements in your document.
Hope this helps!
Upvotes: 1