geoffcamp
16 years agoContributor
Removing Complex tags when empty.
Hi,
I have a number of Service Operations which contain complex tags that must either be populated, or not exist at all within the request.
This is causing me an issue as each of the tags is parameterised, and therefore if they are not populated then they are passed as blank rather than not existing.
For example:
${DataSource#partyIdentifier}
${DataSource#agreementIdentifier}
${DataSource#agreementType}
${DataSource#agreementSourceSystem}
In this example the distributionAgreement tag itself is conditional. That is to say if any of the tags within the distributionAgreement complex tag are populated then the distributionAgreement tag must exist.
However if each of the three values within the distributionAgreement complex tag are blank then the entire complex tag must not be present.
If any of the tags within the distributionAgreement tag are populated then the following should be sent:
12345678
Agent 01
Agent of
And if none of the tags within the distributionAgreement tag are populated then the following should be sent:
12345678
However because each of the tags is parameterised, when these are passed as blank the actual Request sent currently is:
12345678
I'm sure there must be a number of people who are facing / have faced the same issue.
Is there a way I can ensure that if an entire complex tag is empty then the tag itself is removed?
I could probably cater for this within a groovy script, however I don't want to have to individually script for each complex tag that acts this way within each of our Service Operations.
Is there inbuilt functionality I can use to accomplish this?
Alternatively does anyone have an idea of how I could accomplish this with a single groovy script that I could use as a template for all Service Operations?
Cheers in advance,
Geoff
I have a number of Service Operations which contain complex tags that must either be populated, or not exist at all within the request.
This is causing me an issue as each of the tags is parameterised, and therefore if they are not populated then they are passed as blank rather than not existing.
For example:
In this example the distributionAgreement tag itself is conditional. That is to say if any of the tags within the distributionAgreement complex tag are populated then the distributionAgreement tag must exist.
However if each of the three values within the distributionAgreement complex tag are blank then the entire complex tag must not be present.
If any of the tags within the distributionAgreement tag are populated then the following should be sent:
And if none of the tags within the distributionAgreement tag are populated then the following should be sent:
However because each of the tags is parameterised, when these are passed as blank the actual Request sent currently is:
I'm sure there must be a number of people who are facing / have faced the same issue.
Is there a way I can ensure that if an entire complex tag is empty then the tag itself is removed?
I could probably cater for this within a groovy script, however I don't want to have to individually script for each complex tag that acts this way within each of our Service Operations.
Is there inbuilt functionality I can use to accomplish this?
Alternatively does anyone have an idea of how I could accomplish this with a single groovy script that I could use as a template for all Service Operations?
Cheers in advance,
Geoff