Generating a template payload from a given XML payload



I have a XML file



<wsu:Timestamp wsu:Id="TS-2">
<wsu:Created>{{UTCTIME}}</wsu:Created>
</wsu:Timestamp>
<wsse:UsernameToken>
<wsse:Username>{{USERNAME}}</wsse:Username>
<wsse:Password Type="http://ift.tt/1aTA7XU">{{PASSWORD}}</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soap:Header>
<soap:Body>
<ns2:filter>
<ns2:conjunction>And</ns2:conjunction>
<ns2:group>
<ns2:conjunction>And</ns2:conjunction>
<ns2:upperCaseCompare></ns2:upperCaseCompare>
<ns2:item>
<ns2:conjunction>And</ns2:conjunction>
<ns2:upperCaseCompare></ns2:upperCaseCompare>
<ns2:attribute>PartyName</ns2:attribute>
<ns2:operator>=</ns2:operator>
<ns2:value>{{PARTYNAME}}</ns2:value>
</ns2:item>
</ns2:group>
</ns2:filter>"+
<ns2:excludeAttribute></ns2:excludeAttribute>
</ns1:findCriteria>
<ns2:retrieveAllTranslations></ns2:retrieveAllTranslations>
</ns1:findControl>
</ns1:findOrganization>
</soap:Body>
</soap:Envelope>


I want to generate a generalised template from the given file that I can populate with different values as



<wsu:Timestamp wsu:Id="TS-2">
<wsu:Created>{{UTCTIME}}</wsu:Created>
</wsu:Timestamp>
<wsse:UsernameToken>
<wsse:Username>{{USERNAME}}</wsse:Username>
<wsse:Password Type="http://ift.tt/1aTA7XU">{{PASSWORD}}</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soap:Header>
<soap:Body>
<ns2:fetchStart>{{fetchStart}}</ns2:fetchStart>
<ns2:fetchSize>{{fetchSize}}</ns2:fetchSize>
<ns2:filter>
<ns2:conjunction>{{conjunction}}</ns2:conjunction>
<ns2:group>
<ns2:conjunction>{{conjunction}}</ns2:conjunction>
<ns2:upperCaseCompare>{{upperCaseCompare}}</ns2:upperCaseCompare>
<ns2:item>
<ns2:conjunction>And</ns2:conjunction>
<ns2:upperCaseCompare></ns2:upperCaseCompare>
<ns2:attribute>{{attribute}}</ns2:attribute>
<ns2:operator>{{operator}}</ns2:operator>
<ns2:value>{{value}}</ns2:value>
</ns2:item>
</ns2:group>
</ns2:filter>
<ns2:excludeAttribute>{{excludeAttribute}}</ns2:excludeAttribute>
</ns1:findCriteria>
<ns2:retrieveAllTranslations>{{retrieveAllTranslations}}</ns2:retrieveAllTranslations>
</ns1:findControl>
</ns1:findOrganization>
</soap:Body>
</soap:Envelope>


Please suggest optimal solutions to generate this output template that derives its values from tags.


No comments:

Post a Comment